sbIDeviceInfoRegistrar.idl
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #include "nsISupports.idl"
26 
27 interface nsIArray;
28 
29 interface sbIDevice;
30 interface sbIDeviceCapabilities;
31 interface sbIMediaItem;
32 interface sbITranscodeProfile;
33 
42 [scriptable, uuid(280ea825-00bd-4e02-910b-5fd7291903c2)]
44 {
45  /* Types of registrars */
49  const PRUint32 NONE = 0;
50 
54  const PRUint32 DEFAULT = 1;
55 
59  const PRUint32 GENERIC = 2;
60 
64  const PRUint32 DEVICE_SPECIFIC = 3;
65 
66  readonly attribute PRUint32 type;
67 
75  void addCapabilities(in sbIDevice aDevice,
76  in sbIDeviceCapabilities aDeviceCapabilities);
77 
85  AString getDefaultName(in sbIDevice aDevice);
86 
96  AString getDeviceFolder(in sbIDevice aDevice,
97  in unsigned long aContentType);
98 
110  nsIArray getImportRules(in sbIDevice aDevice);
111 
123  unsigned long getMountTimeout(in sbIDevice aDevice);
124 
130  AString getExcludedFolders(in sbIDevice aDevice);
131 
135  boolean getDoesDeviceSupportReformat(in sbIDevice aDevice);
136 
144  boolean getOnlyMountMediaFolders(in sbIDevice aDevice);
145 
162  nsIArray getStorageDeviceInfoList(in sbIDevice aDevice);
163 
171  AString getDeviceIcon(in sbIDevice aDevice);
172 
177  boolean interestedInDevice(in sbIDevice aDevice);
178 };
179 
180 %{C++
181 #include "nsCOMPtr.h"
182 #include "nsIComponentManager.h"
183 #include "nsICategoryManager.h"
184 #include "nsIServiceManager.h"
185 #include "nsStringGlue.h"
186 #include "nsXPCOMCID.h"
187 
188 class nsIFile;
189 struct nsModuleComponentInfo;
190 
191 #define SB_DEVICE_INFO_REGISTRAR_CATEGORY "songbird-device-info-registrar"
192 
215 #define SB_DEVICE_INFO_REGISTRAR_REGISTERSELF(_name) \
216  \
217  NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr, \
218  nsIFile* aPath, \
219  const char* registryLocation, \
220  const char* componentType, \
221  const nsModuleComponentInfo* info); \
222  \
223  NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
224  nsIFile* aPath, \
225  const char* registryLocation, \
226  const nsModuleComponentInfo* info)
227 
231 #define SB_DEVICE_INFO_REGISTRAR_REGISTERSELF_IMPL(_name, _desc) \
232  \
233  NS_METHOD \
234  _name##RegisterSelf(nsIComponentManager* aCompMgr, \
235  nsIFile* aPath, \
236  const char* registryLocation, \
237  const char* componentType, \
238  const nsModuleComponentInfo* info) \
239  { \
240  nsresult rv; \
241  nsCOMPtr<nsICategoryManager> catMan = \
242  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
243  NS_ENSURE_SUCCESS(rv, rv); \
244  nsCAutoString prevEntry; \
245  rv = catMan->AddCategoryEntry(SB_DEVICE_INFO_REGISTRAR_CATEGORY, \
246  _desc, \
247  info->mContractID, \
248  PR_TRUE, PR_TRUE, \
249  getter_Copies(prevEntry)); \
250  NS_ENSURE_SUCCESS(rv, rv); \
251  NS_WARN_IF_FALSE(prevEntry.IsEmpty(), \
252  "Another controller was registered with that id!"); \
253  return NS_OK; \
254  } \
255  \
256  NS_METHOD \
257  _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
258  nsIFile* aPath, \
259  const char* registryLocation, \
260  const nsModuleComponentInfo* info) \
261  { \
262  nsresult rv; \
263  nsCOMPtr<nsICategoryManager> catMan = \
264  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
265  NS_ENSURE_SUCCESS(rv, rv); \
266  rv = catMan->DeleteCategoryEntry(SB_DEVICE_INFO_REGISTRAR_CATEGORY, \
267  _desc, \
268  PR_TRUE); \
269  NS_ENSURE_SUCCESS(rv, rv); \
270  return NS_OK; \
271  }
272 %}
273 
[UNIMPLEMENTED UNTIL AFTER 0.3]
AString getDeviceFolder(in sbIDevice aDevice, in unsigned long aContentType)
Return the device folder URL for the device and content type specified by aDevice and aContentType...
AString getExcludedFolders(in sbIDevice aDevice)
Return the excluded folder list as a comma separate string.
An object defining a transcoding profile.
nsIArray getImportRules(in sbIDevice aDevice)
Return a list of "rules" to apply to files imported from aDevice. Each rule is itself an nsIArray of ...
var uuid
boolean getOnlyMountMediaFolders(in sbIDevice aDevice)
Return true if only the media folders should be mounted rather than the entire storage volume...
function C(H)
boolean getDoesDeviceSupportReformat(in sbIDevice aDevice)
Returns true if the device supports reformat.
unsigned long getMountTimeout(in sbIDevice aDevice)
Return the mount timeout value in seconds for the device specified by aDevice.
nsIArray getStorageDeviceInfoList(in sbIDevice aDevice)
Return the storage device info list as an nsIArray of nsIPropertyBag elements.
AString getDefaultName(in sbIDevice aDevice)
Return the default name for the device.
boolean interestedInDevice(in sbIDevice aDevice)
Determines if the registrar is interested in this device.
Interface that defines a single item of media in the system.
readonly attribute PRUint32 type
void addCapabilities(in sbIDevice aDevice, in sbIDeviceCapabilities aDeviceCapabilities)
Allows a third party to augment the device capabilities.
AString getDeviceIcon(in sbIDevice aDevice)
Return the device icon file URL for the device specified by aDevice.