sbRemoteWebLibrary.cpp
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
27 #include "sbRemotePlayer.h"
28 #include "sbRemoteWebLibrary.h"
29 #include "sbRemoteWebMediaList.h"
30 
31 #include <prlog.h>
32 #include <sbClassInfoUtils.h>
33 
34 /*
35  * To log this module, set the following environment variable:
36  * NSPR_LOG_MODULES=sbRemoteLibrary:5
37  * LOG_LIB defined in sbRemoteLibraryBase.h/.cpp
38  */
39 #undef LOG
40 #define LOG(args) LOG_LIB(args)
41 
42 const static char* sPublicWProperties[] = { "" };
43 
44 const static char* sPublicRProperties[] =
45  { // sbIMediaList
46  "library_read:name",
47  "library_read:type",
48  "library_read:length",
49 
50  // sbIRemoteLibrary
51  "library_read:scanMediaOnCreation",
52 
53  // nsIClassInfo
54  "classinfo:classDescription",
55  "classinfo:contractID",
56  "classinfo:classID",
57  "classinfo:implementationLanguage",
58  "classinfo:flags"
59  };
60 
61 const static char* sPublicMethods[] =
62  { // sbIMediaList
63  "library_read:getItemByGuid",
64  "library_read:getItemByIndex",
65  "library_read:enumerateAllItems",
66  "library_read:enumerateItemsByProperty",
67  "library_read:indexOf",
68  "library_read:lastIndexOf",
69  "library_read:contains",
70  "library_read:getDistinctValuesForProperty",
71 
72  // sbILibraryResource
73  "library_read:getProperty",
74  "library_read:equals"
75  };
76 
79  nsIClassInfo )
80 
81 NS_IMPL_CI_INTERFACE_GETTER10( sbRemoteWebLibrary,
92 
93 SB_IMPL_CLASSINFO_INTERFACES_ONLY(sbRemoteWebLibrary)
94 
96 
97 sbRemoteWebLibrary::sbRemoteWebLibrary(sbRemotePlayer* aRemotePlayer) :
98  sbRemoteLibrary(aRemotePlayer)
99 {
100  LOG_LIB(("sbRemoteWebLibrary::sbRemoteWebLibrary()"));
101 }
102 
104 {
105  LOG_LIB(("sbRemoteWebLibrary::~sbRemoteWebLibrary()"));
106 }
107 
108 // ---------------------------------------------------------------------------
109 //
110 // Helper Methods
111 //
112 // ---------------------------------------------------------------------------
113 
114 nsresult
116 {
117  LOG_LIB(("sbRemoteWebLibrary::InitInternalMediaList()"));
118  NS_ASSERTION( mLibrary, "EEK! Initing internals without a mLibrary" );
119 
120  nsCOMPtr<sbIMediaList> mediaList( do_QueryInterface(mLibrary) );
121  NS_ENSURE_TRUE( mediaList, NS_ERROR_FAILURE );
122 
123  nsCOMPtr<sbIMediaListView> mediaListView;
124  nsresult rv = mediaList->CreateView( nsnull, getter_AddRefs(mediaListView) );
125  NS_ENSURE_SUCCESS( rv, rv );
126 
128  mediaList,
129  mediaListView );
130  NS_ENSURE_TRUE( mRemMediaList, NS_ERROR_OUT_OF_MEMORY );
131 
132  rv = mRemMediaList->Init();
133  NS_ENSURE_SUCCESS( rv, rv );
134 
135  return rv;
136 }
#define SB_IMPL_SECURITYCHECKEDCOMP_INIT(_class)
Definition: sbRemoteAPI.h:82
static const char * sPublicWProperties[]
static const char * sPublicMethods[]
virtual nsresult InitInternalMediaList()
A brief description of the contents of this interface.
static const char * sPublicRProperties[]
nsISecurityCheckedComponent
A marker interface for objects that aggregate the security mixin.
nsRefPtr< sbRemoteMediaListBase > mRemMediaList
General interface to data resources.
An interface to control a media library from remote web pages.
NS_IMPL_ISUPPORTS_INHERITED1(sbRemoteWebLibrary, sbRemoteLibrary, nsIClassInfo) NS_IMPL_CI_INTERFACE_GETTER10(sbRemoteWebLibrary
nsCOMPtr< sbILibrary > mLibrary
Interface that defines a single item of media in the system.
nsRefPtr< sbRemotePlayer > mRemotePlayer
#define SB_IMPL_CLASSINFO_INTERFACES_ONLY(_class)
An interface to control a media list from remote web pages.
#define LOG_LIB(args)