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

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

Issue 12114019: Media Galleries: Add MediaGalleriesPreferences::GalleryChangeObserver class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_galleries_preferences.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_gallery/media_galleries_preferences.h
===================================================================
--- chrome/browser/media_gallery/media_galleries_preferences.h (revision 179736)
+++ chrome/browser/media_gallery/media_galleries_preferences.h (working copy)
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/observer_list.h"
#include "base/string16.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
@@ -75,9 +76,20 @@
// user profile.
class MediaGalleriesPreferences : public ProfileKeyedService {
public:
+ class GalleryChangeObserver {
+ public:
+ virtual void OnGalleryChanged(MediaGalleriesPreferences* pref) {}
+
+ protected:
+ virtual ~GalleryChangeObserver();
+ };
+
explicit MediaGalleriesPreferences(Profile* profile);
virtual ~MediaGalleriesPreferences();
+ void AddGalleryChangeObserver(GalleryChangeObserver* observer);
+ void RemoveGalleryChangeObserver(GalleryChangeObserver* observer);
+
// Lookup a media gallery and fill in information about it and return true.
// If the media gallery does not already exist, fill in as much of the
// MediaGalleryPrefInfo struct as we can and return false.
@@ -90,12 +102,14 @@
const std::string& device_id) const;
// Teaches the registry about a new gallery.
+ // Returns the gallery's pref id.
MediaGalleryPrefId AddGallery(const std::string& device_id,
const string16& display_name,
const FilePath& relative_path,
bool user_added);
// Teach the registry about a user added registry simply from the path.
+ // Returns the gallery's pref id.
MediaGalleryPrefId AddGalleryByPath(const FilePath& path);
// Removes the gallery identified by |id| from the store.
@@ -130,8 +144,14 @@
void AddDefaultGalleriesIfFreshProfile();
// Builds |known_galleries_| from the persistent store.
- void InitFromPrefs();
+ // Notifies GalleryChangeObservers if |notify_observers| is true.
+ void InitFromPrefs(bool notify_observers);
+ // Notifies |gallery_change_observers_| about changes in |known_galleries_|.
+ void NotifyChangeObservers();
+
+ extensions::ExtensionPrefs* GetExtensionPrefs() const;
+
// The profile that owns |this|.
Profile* profile_;
@@ -142,7 +162,7 @@
// All pref ids in |device_map_| are also in |known_galleries_|.
DeviceIdPrefIdsMap device_map_;
- extensions::ExtensionPrefs* GetExtensionPrefs() const;
+ ObserverList<GalleryChangeObserver> gallery_change_observers_;
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences);
};
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_galleries_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698