OLD | NEW |
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 // GalleryWatchStateTracker tracks the gallery watchers, updates the | 5 // GalleryWatchStateTracker tracks the gallery watchers, updates the |
6 // extension state storage and observes the extension registry events. | 6 // extension state storage and observes the extension registry events. |
7 // GalleryWatchStateTracker lives on the UI thread. | 7 // GalleryWatchStateTracker lives on the UI thread. |
8 | 8 |
9 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_STAT
E_TRACKER_H_ | 9 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_STAT
E_TRACKER_H_ |
10 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_STAT
E_TRACKER_H_ | 10 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_STAT
E_TRACKER_H_ |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Value: True if the watcher is active. Watcher will be active only if | 83 // Value: True if the watcher is active. Watcher will be active only if |
84 // the extension has access permission to the watched gallery and a watcher | 84 // the extension has access permission to the watched gallery and a watcher |
85 // has been successfully setup. | 85 // has been successfully setup. |
86 typedef std::map<MediaGalleryPrefId, bool> WatchedGalleriesMap; | 86 typedef std::map<MediaGalleryPrefId, bool> WatchedGalleriesMap; |
87 | 87 |
88 // Key: Extension identifier. | 88 // Key: Extension identifier. |
89 // Value: Map of watched gallery information. | 89 // Value: Map of watched gallery information. |
90 typedef std::map<std::string, WatchedGalleriesMap> WatchedExtensionsMap; | 90 typedef std::map<std::string, WatchedGalleriesMap> WatchedExtensionsMap; |
91 | 91 |
92 // extensions::ExtensionRegistryObserver implementation. | 92 // extensions::ExtensionRegistryObserver implementation. |
93 virtual void OnExtensionLoaded(const Extension* extension) OVERRIDE; | 93 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
94 virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE; | 94 const Extension* extension) OVERRIDE; |
| 95 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 96 const Extension* extension) OVERRIDE; |
95 | 97 |
96 // Syncs media gallery watch data for the given extension to/from the state | 98 // Syncs media gallery watch data for the given extension to/from the state |
97 // storage. | 99 // storage. |
98 void WriteToStorage(const std::string& extension_id); | 100 void WriteToStorage(const std::string& extension_id); |
99 void ReadFromStorage(const std::string& extension_id, | 101 void ReadFromStorage(const std::string& extension_id, |
100 scoped_ptr<base::Value> value); | 102 scoped_ptr<base::Value> value); |
101 | 103 |
102 // Sets up the gallery watcher on the receipt of granted gallery permission | 104 // Sets up the gallery watcher on the receipt of granted gallery permission |
103 // event. | 105 // event. |
104 void SetupGalleryWatch(const std::string& extension_id, | 106 void SetupGalleryWatch(const std::string& extension_id, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 141 |
140 // A map of watched gallery details, per extension. | 142 // A map of watched gallery details, per extension. |
141 WatchedExtensionsMap watched_extensions_map_; | 143 WatchedExtensionsMap watched_extensions_map_; |
142 | 144 |
143 DISALLOW_COPY_AND_ASSIGN(GalleryWatchStateTracker); | 145 DISALLOW_COPY_AND_ASSIGN(GalleryWatchStateTracker); |
144 }; | 146 }; |
145 | 147 |
146 } // namespace extensions | 148 } // namespace extensions |
147 | 149 |
148 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_S
TATE_TRACKER_H_ | 150 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_S
TATE_TRACKER_H_ |
OLD | NEW |