Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Side by Side Diff: chrome/browser/media_gallery/media_galleries_preferences.h

Issue 12095074: Media Galleries: Keep media gallery permission dialogs in sync with the gallery (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: merge Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_
6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERY_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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 typedef std::map<MediaGalleryPrefId, MediaGalleryPrefInfo> 71 typedef std::map<MediaGalleryPrefId, MediaGalleryPrefInfo>
72 MediaGalleriesPrefInfoMap; 72 MediaGalleriesPrefInfoMap;
73 typedef std::set<MediaGalleryPrefId> MediaGalleryPrefIdSet; 73 typedef std::set<MediaGalleryPrefId> MediaGalleryPrefIdSet;
74 74
75 // A class to manage the media gallery preferences. There is one instance per 75 // A class to manage the media gallery preferences. There is one instance per
76 // user profile. 76 // user profile.
77 class MediaGalleriesPreferences : public ProfileKeyedService { 77 class MediaGalleriesPreferences : public ProfileKeyedService {
78 public: 78 public:
79 class GalleryChangeObserver { 79 class GalleryChangeObserver {
80 public: 80 public:
81 virtual void OnGalleryChanged(MediaGalleriesPreferences* pref) {} 81 virtual void OnGalleryChanged(MediaGalleriesPreferences* pref,
vandebo (ex-Chrome) 2013/02/08 19:57:41 nit: add comment about empty string when the chang
Greg Billock 2013/02/08 20:09:25 Should this pass any information about which galle
Lei Zhang 2013/02/08 21:02:12 It's expecting the client to do a rescan. The situ
Lei Zhang 2013/02/09 00:07:43 Done.
82 const std::string& extension_id) {}
82 83
83 protected: 84 protected:
84 virtual ~GalleryChangeObserver(); 85 virtual ~GalleryChangeObserver();
85 }; 86 };
86 87
87 explicit MediaGalleriesPreferences(Profile* profile); 88 explicit MediaGalleriesPreferences(Profile* profile);
88 virtual ~MediaGalleriesPreferences(); 89 virtual ~MediaGalleriesPreferences();
89 90
90 void AddGalleryChangeObserver(GalleryChangeObserver* observer); 91 void AddGalleryChangeObserver(GalleryChangeObserver* observer);
91 void RemoveGalleryChangeObserver(GalleryChangeObserver* observer); 92 void RemoveGalleryChangeObserver(GalleryChangeObserver* observer);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 DeviceIdPrefIdsMap; 152 DeviceIdPrefIdsMap;
152 153
153 // Populates the default galleries if this is a fresh profile. 154 // Populates the default galleries if this is a fresh profile.
154 void AddDefaultGalleriesIfFreshProfile(); 155 void AddDefaultGalleriesIfFreshProfile();
155 156
156 // Builds |known_galleries_| from the persistent store. 157 // Builds |known_galleries_| from the persistent store.
157 // Notifies GalleryChangeObservers if |notify_observers| is true. 158 // Notifies GalleryChangeObservers if |notify_observers| is true.
158 void InitFromPrefs(bool notify_observers); 159 void InitFromPrefs(bool notify_observers);
159 160
160 // Notifies |gallery_change_observers_| about changes in |known_galleries_|. 161 // Notifies |gallery_change_observers_| about changes in |known_galleries_|.
161 void NotifyChangeObservers(); 162 void NotifyChangeObservers(const std::string& extension_id);
162 163
163 extensions::ExtensionPrefs* GetExtensionPrefs() const; 164 extensions::ExtensionPrefs* GetExtensionPrefs() const;
164 165
165 // The profile that owns |this|. 166 // The profile that owns |this|.
166 Profile* profile_; 167 Profile* profile_;
167 168
168 // An in-memory cache of known galleries. 169 // An in-memory cache of known galleries.
169 MediaGalleriesPrefInfoMap known_galleries_; 170 MediaGalleriesPrefInfoMap known_galleries_;
170 171
171 // A mapping from device id to the set of gallery pref ids on that device. 172 // A mapping from device id to the set of gallery pref ids on that device.
172 // All pref ids in |device_map_| are also in |known_galleries_|. 173 // All pref ids in |device_map_| are also in |known_galleries_|.
173 DeviceIdPrefIdsMap device_map_; 174 DeviceIdPrefIdsMap device_map_;
174 175
175 ObserverList<GalleryChangeObserver> gallery_change_observers_; 176 ObserverList<GalleryChangeObserver> gallery_change_observers_;
176 177
177 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); 178 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences);
178 }; 179 };
179 180
180 } // namespace chrome 181 } // namespace chrome
181 182
182 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_ 183 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698