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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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_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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // the name constructed from volume metadata. 104 // the name constructed from volume metadata.
105 int prefs_version; 105 int prefs_version;
106 }; 106 };
107 107
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 ProfileKeyedService, 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:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const extensions::Extension& extension) const; 183 const extensions::Extension& extension) const;
184 184
185 void SetGalleryPermissionForExtension(const extensions::Extension& extension, 185 void SetGalleryPermissionForExtension(const extensions::Extension& extension,
186 MediaGalleryPrefId pref_id, 186 MediaGalleryPrefId pref_id,
187 bool has_permission); 187 bool has_permission);
188 188
189 const MediaGalleriesPrefInfoMap& known_galleries() const { 189 const MediaGalleriesPrefInfoMap& known_galleries() const {
190 return known_galleries_; 190 return known_galleries_;
191 } 191 }
192 192
193 // ProfileKeyedService implementation: 193 // BrowserContextKeyedService implementation:
194 virtual void Shutdown() OVERRIDE; 194 virtual void Shutdown() OVERRIDE;
195 195
196 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); 196 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
197 197
198 // Returns true if the media gallery preferences system has ever been used 198 // Returns true if the media gallery preferences system has ever been used
199 // for this profile. To be exact, it checks if a gallery has ever been added 199 // for this profile. To be exact, it checks if a gallery has ever been added
200 // (including defaults). 200 // (including defaults).
201 static bool APIHasBeenUsed(Profile* profile); 201 static bool APIHasBeenUsed(Profile* profile);
202 202
203 private: 203 private:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 DeviceIdPrefIdsMap device_map_; 246 DeviceIdPrefIdsMap device_map_;
247 247
248 ObserverList<GalleryChangeObserver> gallery_change_observers_; 248 ObserverList<GalleryChangeObserver> gallery_change_observers_;
249 249
250 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); 250 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences);
251 }; 251 };
252 252
253 } // namespace chrome 253 } // namespace chrome
254 254
255 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ 255 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698