| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR
IVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR
IVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR
IVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PR
IVATE_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // The profile-keyed service that manages the media galleries private extension | 30 // The profile-keyed service that manages the media galleries private extension |
| 31 // API. Created at the same time as the Profile. | 31 // API. Created at the same time as the Profile. |
| 32 class MediaGalleriesPrivateAPI : public BrowserContextKeyedAPI, | 32 class MediaGalleriesPrivateAPI : public BrowserContextKeyedAPI, |
| 33 public EventRouter::Observer { | 33 public EventRouter::Observer { |
| 34 public: | 34 public: |
| 35 explicit MediaGalleriesPrivateAPI(content::BrowserContext* context); | 35 explicit MediaGalleriesPrivateAPI(content::BrowserContext* context); |
| 36 virtual ~MediaGalleriesPrivateAPI(); | 36 virtual ~MediaGalleriesPrivateAPI(); |
| 37 | 37 |
| 38 // KeyedService implementation. | 38 // KeyedService implementation. |
| 39 virtual void Shutdown() OVERRIDE; | 39 virtual void Shutdown() override; |
| 40 | 40 |
| 41 // BrowserContextKeyedAPI implementation. | 41 // BrowserContextKeyedAPI implementation. |
| 42 static BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>* | 42 static BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>* |
| 43 GetFactoryInstance(); | 43 GetFactoryInstance(); |
| 44 | 44 |
| 45 // Convenience method to get the MediaGalleriesPrivateAPI for a profile. | 45 // Convenience method to get the MediaGalleriesPrivateAPI for a profile. |
| 46 static MediaGalleriesPrivateAPI* Get(content::BrowserContext* context); | 46 static MediaGalleriesPrivateAPI* Get(content::BrowserContext* context); |
| 47 | 47 |
| 48 // EventRouter::Observer implementation. | 48 // EventRouter::Observer implementation. |
| 49 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 49 virtual void OnListenerAdded(const EventListenerInfo& details) override; |
| 50 | 50 |
| 51 MediaGalleriesPrivateEventRouter* GetEventRouter(); | 51 MediaGalleriesPrivateEventRouter* GetEventRouter(); |
| 52 GalleryWatchStateTracker* GetGalleryWatchStateTracker(); | 52 GalleryWatchStateTracker* GetGalleryWatchStateTracker(); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>; | 55 friend class BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>; |
| 56 | 56 |
| 57 void MaybeInitializeEventRouterAndTracker(); | 57 void MaybeInitializeEventRouterAndTracker(); |
| 58 | 58 |
| 59 // BrowserContextKeyedAPI implementation. | 59 // BrowserContextKeyedAPI implementation. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 81 class MediaGalleriesPrivateAddGalleryWatchFunction | 81 class MediaGalleriesPrivateAddGalleryWatchFunction |
| 82 : public ChromeAsyncExtensionFunction { | 82 : public ChromeAsyncExtensionFunction { |
| 83 public: | 83 public: |
| 84 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.addGalleryWatch", | 84 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.addGalleryWatch", |
| 85 MEDIAGALLERIESPRIVATE_ADDGALLERYWATCH); | 85 MEDIAGALLERIESPRIVATE_ADDGALLERYWATCH); |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 virtual ~MediaGalleriesPrivateAddGalleryWatchFunction(); | 88 virtual ~MediaGalleriesPrivateAddGalleryWatchFunction(); |
| 89 | 89 |
| 90 // AsyncExtensionFunction overrides. | 90 // AsyncExtensionFunction overrides. |
| 91 virtual bool RunAsync() OVERRIDE; | 91 virtual bool RunAsync() override; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 void OnPreferencesInit(const std::string& pref_id); | 94 void OnPreferencesInit(const std::string& pref_id); |
| 95 | 95 |
| 96 // Gallery watch request handler. | 96 // Gallery watch request handler. |
| 97 void HandleResponse(MediaGalleryPrefId gallery_id, bool success); | 97 void HandleResponse(MediaGalleryPrefId gallery_id, bool success); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 // Implements the chrome.mediaGalleriesPrivate.removeGalleryWatch method. | 100 // Implements the chrome.mediaGalleriesPrivate.removeGalleryWatch method. |
| 101 class MediaGalleriesPrivateRemoveGalleryWatchFunction | 101 class MediaGalleriesPrivateRemoveGalleryWatchFunction |
| 102 : public ChromeAsyncExtensionFunction { | 102 : public ChromeAsyncExtensionFunction { |
| 103 public: | 103 public: |
| 104 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.removeGalleryWatch", | 104 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.removeGalleryWatch", |
| 105 MEDIAGALLERIESPRIVATE_REMOVEGALLERYWATCH); | 105 MEDIAGALLERIESPRIVATE_REMOVEGALLERYWATCH); |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 virtual ~MediaGalleriesPrivateRemoveGalleryWatchFunction(); | 108 virtual ~MediaGalleriesPrivateRemoveGalleryWatchFunction(); |
| 109 | 109 |
| 110 // SyncExtensionFunction overrides. | 110 // SyncExtensionFunction overrides. |
| 111 virtual bool RunAsync() OVERRIDE; | 111 virtual bool RunAsync() override; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 void OnPreferencesInit(const std::string& pref_id); | 114 void OnPreferencesInit(const std::string& pref_id); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 // Implements the chrome.mediaGalleriesPrivate.getAllGalleryWatch method. | 117 // Implements the chrome.mediaGalleriesPrivate.getAllGalleryWatch method. |
| 118 class MediaGalleriesPrivateGetAllGalleryWatchFunction | 118 class MediaGalleriesPrivateGetAllGalleryWatchFunction |
| 119 : public ChromeAsyncExtensionFunction { | 119 : public ChromeAsyncExtensionFunction { |
| 120 public: | 120 public: |
| 121 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.getAllGalleryWatch", | 121 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.getAllGalleryWatch", |
| 122 MEDIAGALLERIESPRIVATE_GETALLGALLERYWATCH); | 122 MEDIAGALLERIESPRIVATE_GETALLGALLERYWATCH); |
| 123 protected: | 123 protected: |
| 124 virtual ~MediaGalleriesPrivateGetAllGalleryWatchFunction(); | 124 virtual ~MediaGalleriesPrivateGetAllGalleryWatchFunction(); |
| 125 | 125 |
| 126 // SyncExtensionFunction overrides. | 126 // SyncExtensionFunction overrides. |
| 127 virtual bool RunAsync() OVERRIDE; | 127 virtual bool RunAsync() override; |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 void OnPreferencesInit(); | 130 void OnPreferencesInit(); |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 // Implements the chrome.mediaGalleriesPrivate.removeAllGalleryWatch method. | 133 // Implements the chrome.mediaGalleriesPrivate.removeAllGalleryWatch method. |
| 134 class MediaGalleriesPrivateRemoveAllGalleryWatchFunction | 134 class MediaGalleriesPrivateRemoveAllGalleryWatchFunction |
| 135 : public ChromeAsyncExtensionFunction { | 135 : public ChromeAsyncExtensionFunction { |
| 136 public: | 136 public: |
| 137 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.removeAllGalleryWatch", | 137 DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.removeAllGalleryWatch", |
| 138 MEDIAGALLERIESPRIVATE_REMOVEALLGALLERYWATCH); | 138 MEDIAGALLERIESPRIVATE_REMOVEALLGALLERYWATCH); |
| 139 protected: | 139 protected: |
| 140 virtual ~MediaGalleriesPrivateRemoveAllGalleryWatchFunction(); | 140 virtual ~MediaGalleriesPrivateRemoveAllGalleryWatchFunction(); |
| 141 | 141 |
| 142 // SyncExtensionFunction overrides. | 142 // SyncExtensionFunction overrides. |
| 143 virtual bool RunAsync() OVERRIDE; | 143 virtual bool RunAsync() override; |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 void OnPreferencesInit(); | 146 void OnPreferencesInit(); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| 150 | 150 |
| 151 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES
_PRIVATE_API_H_ | 151 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES
_PRIVATE_API_H_ |
| OLD | NEW |