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

Unified Diff: chrome/browser/media_gallery/media_galleries_preferences.h

Issue 10836199: Clean up media gallery preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tets x2 Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_gallery/media_galleries_preferences.h
diff --git a/chrome/browser/media_gallery/media_galleries_preferences.h b/chrome/browser/media_gallery/media_galleries_preferences.h
index 20aa036ef0ffc1fad79c7a8cac233268fc03841e..c0983aafc297048f366ab25b4544fcb134114bac 100644
--- a/chrome/browser/media_gallery/media_galleries_preferences.h
+++ b/chrome/browser/media_gallery/media_galleries_preferences.h
@@ -65,6 +65,7 @@ struct MediaGalleryPrefInfo {
typedef std::map<MediaGalleryPrefId, MediaGalleryPrefInfo>
MediaGalleriesPrefInfoMap;
+typedef std::set<MediaGalleryPrefId> MediaGalleryPrefIdSet;
// A class to manage the media gallery preferences. There is one instance per
// user profile.
@@ -85,6 +86,9 @@ class MediaGalleriesPreferences : public ProfileKeyedService {
bool LookUpGalleryByPath(const FilePath& path,
MediaGalleryPrefInfo* gallery) const;
+ MediaGalleryPrefIdSet LookUpGalleriesByDeviceId(
+ const std::string& device_id) const;
+
// Teaches the registry about a new gallery.
MediaGalleryPrefId AddGallery(const std::string& device_id,
const string16& display_name,
@@ -99,7 +103,7 @@ class MediaGalleriesPreferences : public ProfileKeyedService {
// Removes the gallery identified by |id| from the store.
void ForgetGalleryById(MediaGalleryPrefId id);
- std::set<MediaGalleryPrefId> GalleriesForExtension(
+ MediaGalleryPrefIdSet GalleriesForExtension(
const extensions::Extension& extension) const;
void SetGalleryPermissionForExtension(const extensions::Extension& extension,
@@ -123,12 +127,18 @@ class MediaGalleriesPreferences : public ProfileKeyedService {
static string16 ComputeDisplayName(const FilePath& path);
private:
+ typedef std::map<std::string /*device id*/, MediaGalleryPrefIdSet>
+ DeviceIdPrefIdsMap;
+
// The profile that owns |this|.
Profile* profile_;
// An in-memory cache of known galleries.
MediaGalleriesPrefInfoMap known_galleries_;
+ // A mapping from device id to the set of gallery pref ids on that device.
+ DeviceIdPrefIdsMap device_map_;
+
extensions::ExtensionPrefs* GetExtensionPrefs() const;
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences);

Powered by Google App Engine
This is Rietveld 408576698