OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 typedef std::map<MediaGalleryPrefId, MediaGalleryPrefInfo> | 108 typedef std::map<MediaGalleryPrefId, MediaGalleryPrefInfo> |
109 MediaGalleriesPrefInfoMap; | 109 MediaGalleriesPrefInfoMap; |
110 typedef std::set<MediaGalleryPrefId> MediaGalleryPrefIdSet; | 110 typedef std::set<MediaGalleryPrefId> MediaGalleryPrefIdSet; |
111 | 111 |
112 // A class to manage the media gallery preferences. There is one instance per | 112 // A class to manage the media gallery preferences. There is one instance per |
113 // user profile. | 113 // user profile. |
114 class MediaGalleriesPreferences : public BrowserContextKeyedService, | 114 class MediaGalleriesPreferences : public BrowserContextKeyedService, |
115 public RemovableStorageObserver { | 115 public RemovableStorageObserver { |
116 public: | 116 public: |
117 class GalleryChangeObserver { | 117 class GalleryChangeObserver { |
118 public: | 118 public: |
119 // |extension_id| specifies the extension affected by this change. | 119 // |extension_id| specifies the extension affected by this change. |
120 // It is empty if the gallery change affects all extensions. | 120 // It is empty if the gallery change affects all extensions. |
121 virtual void OnGalleryChanged(MediaGalleriesPreferences* pref, | 121 virtual void OnGalleryChanged(MediaGalleriesPreferences* pref, |
122 const std::string& extension_id) {} | 122 const std::string& extension_id) {} |
123 | 123 |
124 protected: | 124 protected: |
125 virtual ~GalleryChangeObserver(); | 125 virtual ~GalleryChangeObserver(); |
126 }; | 126 }; |
127 | 127 |
128 explicit MediaGalleriesPreferences(Profile* profile); | 128 explicit MediaGalleriesPreferences(Profile* profile); |
129 virtual ~MediaGalleriesPreferences(); | 129 virtual ~MediaGalleriesPreferences(); |
130 | 130 |
131 void AddGalleryChangeObserver(GalleryChangeObserver* observer); | 131 void AddGalleryChangeObserver(GalleryChangeObserver* observer); |
132 void RemoveGalleryChangeObserver(GalleryChangeObserver* observer); | 132 void RemoveGalleryChangeObserver(GalleryChangeObserver* observer); |
133 | 133 |
134 // RemovableStorageObserver implementation. | 134 // RemovableStorageObserver implementation. |
135 virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE; | 135 virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 DeviceIdPrefIdsMap device_map_; | 249 DeviceIdPrefIdsMap device_map_; |
250 | 250 |
251 ObserverList<GalleryChangeObserver> gallery_change_observers_; | 251 ObserverList<GalleryChangeObserver> gallery_change_observers_; |
252 | 252 |
253 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); | 253 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); |
254 }; | 254 }; |
255 | 255 |
256 } // namespace chrome | 256 } // namespace chrome |
257 | 257 |
258 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 258 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
OLD | NEW |