sbMediaListViewMap.h
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 
32 #ifndef __SB_MEDIALISTVIEWMAP_H__
33 #define __SB_MEDIALISTVIEWMAP_H__
34 
35 #include <nsIObserver.h>
36 #include <sbILibrary.h>
37 #include <sbIMediaListViewMap.h>
38 #include <sbIMediaListView.h>
39 
40 #include <nsCOMPtr.h>
41 #include <nsHashKeys.h>
42 #include <nsClassHashtable.h>
43 #include <nsInterfaceHashtable.h>
44 #include <nsTHashtable.h>
45 #include <prlock.h>
46 
47 #include <sbWeakReference.h>
48 
49 #define SONGBIRD_MEDIALISTVIEWMAP_DESCRIPTION \
50  "Songbird MediaListViewMap"
51 #define SONGBIRD_MEDIALISTVIEWMAP_CONTRACTID \
52  "@songbirdnest.com/Songbird/library/MediaListViewMap;1"
53 #define SONGBIRD_MEDIALISTVIEWMAP_CLASSNAME \
54  "Songbird MediaListViewMap"
55 #define SONGBIRD_MEDIALISTVIEWMAP_CID \
56 { 0x16ea057c, 0xd4c2, 0x4921, { 0x99, 0x84, 0x13, 0xac, 0x42, 0x1a, 0x5f, 0x8d } }
57 
58 
59 class nsIComponentManager;
60 class nsIFile;
61 class nsIRDFDataSource;
62 class sbILibraryFactory;
63 class sbILibraryLoader;
64 
65 struct nsModuleComponentInfo;
66 
68  public nsIObserver,
70 {
71 
72 public:
74  NS_DECL_NSIOBSERVER
75  NS_DECL_SBIMEDIALISTVIEWMAP
76 
78 
79  static NS_METHOD RegisterSelf(nsIComponentManager* aCompMgr,
80  nsIFile* aPath,
81  const char* aLoaderStr,
82  const char* aType,
83  const nsModuleComponentInfo *aInfo);
84 
85  nsresult Init();
86 
87 private:
88  ~sbMediaListViewMap();
89 
90 private:
91  struct sbViewStateInfo {
92  sbViewStateInfo(const nsAString& aLibraryGuid,
93  const nsAString& aListGuid,
95  : libraryGuid(aLibraryGuid),
96  listGuid(aListGuid),
97  state(aState)
98  {
99  MOZ_COUNT_CTOR(sbViewStateInfo);
100  }
101 
102  ~sbViewStateInfo()
103  {
104  MOZ_COUNT_DTOR(sbViewStateInfo);
105  }
106 
107  nsString libraryGuid;
108  nsString listGuid;
109  nsCOMPtr<sbIMediaListViewState> state;
110  };
111 
112  typedef nsClassHashtableMT< nsISupportsHashKey, sbViewStateInfo > sbViewMapInner;
113  typedef nsClassHashtableMT< nsISupportsHashKey, sbViewMapInner > sbViewMap;
114 
115  sbViewMap mViewMap;
116 };
117 
118 #endif /* __SB_MEDIALISTVIEWMAP_H__ */
_updateCookies aPath
Factory for new library instances.
NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER NS_DECL_SBIMEDIALISTVIEWMAP sbMediaListViewMap()
Saved state of a media list view.
[USER CODE SHOULD NOT REFERENCE THIS CLASS]
A mapping from nsISupports objects to save sbIMediaListView states.
nsresult Init()
Register with the Observer Service.
restoreWindow aState
static NS_METHOD RegisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)