34 #include <nsIClassInfoImpl.h>
35 #include <nsIGenericFactory.h>
36 #include <nsIProgrammingLanguage.h>
38 #include <nsServiceManagerUtils.h>
39 #include <nsIPropertyBag2.h>
54 sbCDDeviceController::sbCDDeviceController()
57 nsresult rv = SetControllerIdInternal(
id);
58 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller id");
61 rv = SetMarshallIdInternal(marshallId);
62 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller id");
64 rv = SetControllerNameInternal(NS_LITERAL_STRING(
"sbCDDeviceController"));
65 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller name");
76 sbCDDeviceController::GetCompatibility(nsIPropertyBag *aParams,
79 NS_ENSURE_ARG_POINTER(aParams);
80 NS_ENSURE_ARG_POINTER(aRetVal);
85 nsRefPtr<sbDeviceCompatibility> deviceCompatibility;
87 NS_ENSURE_TRUE(deviceCompatibility, NS_ERROR_OUT_OF_MEMORY);
90 nsCOMPtr<nsIVariant> property;
91 rv = aParams->GetProperty(NS_LITERAL_STRING(
"DeviceType"),
92 getter_AddRefs(property));
93 NS_ENSURE_SUCCESS(rv, rv);
96 rv =
property->GetAsAString(deviceType);
97 NS_ENSURE_SUCCESS(rv, rv);
99 if (deviceType.EqualsLiteral(
"CD")) {
100 rv = deviceCompatibility->Init(
109 NS_ENSURE_SUCCESS(rv, rv);
112 NS_ADDREF(*aRetVal = deviceCompatibility);
117 sbCDDeviceController::CreateDevice(nsIPropertyBag *aParams,
120 NS_ENSURE_ARG_POINTER(aParams);
121 NS_ENSURE_ARG_POINTER(aRetVal);
125 NS_ENSURE_SUCCESS(rv, rv);
127 nsRefPtr<sbCDDevice> cdDevice;
129 NS_ENSURE_SUCCESS(rv, rv);
133 NS_ENSURE_SUCCESS(rv, rv);
136 NS_ADDREF(*aRetVal = cdDevice);
142 sbCDDeviceController::ControlsDevice(
sbIDevice *aDevice, PRBool *aRetVal)
148 sbCDDeviceController::ConnectDevices()
154 sbCDDeviceController::DisconnectDevices()
160 sbCDDeviceController::ReleaseDevice(
sbIDevice *aDevice)
166 sbCDDeviceController::ReleaseDevices()
172 sbCDDeviceController::GetId(nsID **aId)
174 NS_ENSURE_ARG_POINTER(aId);
177 *aId =
static_cast<nsID *
>(NS_Alloc(
sizeof(nsID)));
189 sbCDDeviceController::GetName(nsAString &
aName)
195 sbCDDeviceController::GetMarshallId(nsID **aId)
197 NS_ENSURE_ARG_POINTER(aId);
200 *aId =
static_cast<nsID *
>(NS_Alloc(
sizeof(nsID)));
212 sbCDDeviceController::GetDevices(nsIArray **aDevices)
nsresult DisconnectDevicesInternal()
nsresult ReleaseDeviceInternal(sbIDevice *aDevice)
nsresult GetMarshallIdInternal(nsID &aID)
#define SB_CDDEVICE_CONTROLLER_CONTRACTID
NS_IMPL_THREADSAFE_RELEASE(sbRequestItem)
NS_IMPL_THREADSAFE_ADDREF(sbRequestItem)
virtual ~sbCDDeviceController()
readonly attribute nsIDPtr id
[UNIMPLEMENTED UNTIL AFTER 0.3]
SB_DEVICE_CONTROLLER_REGISTERSELF_IMPL(sbCDDeviceController,"@songbirdnest.com/Songbird/CDDeviceController;1") sbCDDeviceController
nsresult ReleaseDevicesInternal()
const unsigned long PREFERENCE_SELECTED
nsresult GetControllerNameInternal(nsAString &aName)
#define SB_CDDEVICE_CONTROLLER_CID
[UNIMPLEMENTED UNTIL AFTER 0.3]
nsresult GetDevicesInternal(nsIArray **aDevices)
nsresult AddDeviceInternal(sbIDevice *aDevice)
nsresult GetControllerIdInternal(nsID &aID)
const unsigned long COMPATIBLE_ENHANCED_SUPPORT
nsresult ControlsDeviceInternal(sbIDevice *aDevice, PRBool *_retval)
#define SB_CDDEVICE_MARSHALL_CID
static nsresult New(const nsID &aControllerId, nsIPropertyBag *aProperties, sbCDDevice **aOutCDDevice)
const unsigned long PREFERENCE_UNKNOWN
nsresult ConnectDevicesInternal()
NS_INTERFACE_MAP_END NS_IMPL_CI_INTERFACE_GETTER1(CDatabaseQuery, sbIDatabaseQuery) CDatabaseQuery
const unsigned long INCOMPATIBLE