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

Unified Diff: chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Improve tracker code 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h
diff --git a/chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h b/chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h
index 559497abfb7a2ff409dd2aee3dcb8061b3b8872e..e453ae671176a435c3333ce14d7b4f5294de0631 100644
--- a/chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h
+++ b/chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h
@@ -25,6 +25,10 @@ namespace base {
class Value;
}
+namespace chrome {
+class MediaGalleriesPreferences;
+}
+
namespace extensions {
class GalleryWatchStateTracker
@@ -53,9 +57,11 @@ class GalleryWatchStateTracker
// |has_permission| is set to true if the user granted permission to
// access the gallery associated with the |gallery_id| and is set to false
// if the user revoked the gallery permission.
- void OnGalleryPermissionChanged(const std::string& extension_id,
- chrome::MediaGalleryPrefId gallery_id,
- bool has_permission);
+ void OnGalleryPermissionChanged(
+ const std::string& extension_id,
+ chrome::MediaGalleryPrefId gallery_id,
+ bool has_permission,
+ chrome::MediaGalleriesPreferences* preferences);
// Returns a set of watched gallery identifiers for the extension specified
// by the |extension_id|.
@@ -87,16 +93,28 @@ class GalleryWatchStateTracker
void WriteToStorage(const std::string& extension_id);
void ReadFromStorage(const std::string& extension_id,
scoped_ptr<base::Value> value);
+ void ReadFromStorageWithPreferences(
+ const std::string& extension_id,
+ chrome::MediaGalleryPrefIdSet gallery_ids,
+ chrome::MediaGalleriesPreferences* preferences);
+
+ // Bottom half of |RemoveAllGalleryWatchersForExtension| called
+ // after we retrieve the preferences for the profile.
+ void RemoveAllGalleryWatchersWithPreferences(
+ const std::string& extension_id,
+ chrome::MediaGalleriesPreferences* preferences);
// Sets up the gallery watcher on the receipt of granted gallery permission
// event.
void SetupGalleryWatch(const std::string& extension_id,
- chrome::MediaGalleryPrefId gallery_id);
+ chrome::MediaGalleryPrefId gallery_id,
+ chrome::MediaGalleriesPreferences* preferences);
// Removes the gallery watcher on the receipt of revoked gallery permission
// event.
void RemoveGalleryWatch(const std::string& extension_id,
- chrome::MediaGalleryPrefId gallery_id);
+ chrome::MediaGalleryPrefId gallery_id,
+ chrome::MediaGalleriesPreferences* preferences);
// Returns true if a gallery watcher exists for the extension.
// Set |has_active_watcher| to true to find if the gallery watcher is active.

Powered by Google App Engine
This is Rietveld 408576698