| 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 // Defines the Chrome Extensions Media Galleries API functions for accessing | 5 // Defines the Chrome Extensions Media Galleries API functions for accessing |
| 6 // user's media files, as specified in the extension API IDL. | 6 // user's media files, as specified in the extension API IDL. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
| 9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class Extension; | 42 class Extension; |
| 43 | 43 |
| 44 // The profile-keyed service that manages the media galleries extension API. | 44 // The profile-keyed service that manages the media galleries extension API. |
| 45 // Created at the same time as the Profile. This is also the event router. | 45 // Created at the same time as the Profile. This is also the event router. |
| 46 class MediaGalleriesEventRouter : public BrowserContextKeyedAPI, | 46 class MediaGalleriesEventRouter : public BrowserContextKeyedAPI, |
| 47 public GalleryWatchManagerObserver, | 47 public GalleryWatchManagerObserver, |
| 48 public MediaScanManagerObserver, | 48 public MediaScanManagerObserver, |
| 49 public extensions::EventRouter::Observer { | 49 public extensions::EventRouter::Observer { |
| 50 public: | 50 public: |
| 51 // KeyedService implementation. | 51 // KeyedService implementation. |
| 52 virtual void Shutdown() override; | 52 void Shutdown() override; |
| 53 | 53 |
| 54 // BrowserContextKeyedAPI implementation. | 54 // BrowserContextKeyedAPI implementation. |
| 55 static BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>* | 55 static BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>* |
| 56 GetFactoryInstance(); | 56 GetFactoryInstance(); |
| 57 | 57 |
| 58 // Convenience method to get the MediaGalleriesAPI for a profile. | 58 // Convenience method to get the MediaGalleriesAPI for a profile. |
| 59 static MediaGalleriesEventRouter* Get(content::BrowserContext* context); | 59 static MediaGalleriesEventRouter* Get(content::BrowserContext* context); |
| 60 | 60 |
| 61 bool ExtensionHasGalleryChangeListener(const std::string& extension_id) const; | 61 bool ExtensionHasGalleryChangeListener(const std::string& extension_id) const; |
| 62 bool ExtensionHasScanProgressListener(const std::string& extension_id) const; | 62 bool ExtensionHasScanProgressListener(const std::string& extension_id) const; |
| 63 | 63 |
| 64 // MediaScanManagerObserver implementation. | 64 // MediaScanManagerObserver implementation. |
| 65 virtual void OnScanStarted(const std::string& extension_id) override; | 65 void OnScanStarted(const std::string& extension_id) override; |
| 66 virtual void OnScanCancelled(const std::string& extension_id) override; | 66 void OnScanCancelled(const std::string& extension_id) override; |
| 67 virtual void OnScanFinished( | 67 void OnScanFinished(const std::string& extension_id, |
| 68 const std::string& extension_id, | 68 int gallery_count, |
| 69 int gallery_count, | 69 const MediaGalleryScanResult& file_counts) override; |
| 70 const MediaGalleryScanResult& file_counts) override; | 70 void OnScanError(const std::string& extension_id) override; |
| 71 virtual void OnScanError(const std::string& extension_id) override; | |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 friend class BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>; | 73 friend class BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>; |
| 75 | 74 |
| 76 void DispatchEventToExtension(const std::string& extension_id, | 75 void DispatchEventToExtension(const std::string& extension_id, |
| 77 const std::string& event_name, | 76 const std::string& event_name, |
| 78 scoped_ptr<base::ListValue> event_args); | 77 scoped_ptr<base::ListValue> event_args); |
| 79 | 78 |
| 80 explicit MediaGalleriesEventRouter(content::BrowserContext* context); | 79 explicit MediaGalleriesEventRouter(content::BrowserContext* context); |
| 81 virtual ~MediaGalleriesEventRouter(); | 80 ~MediaGalleriesEventRouter() override; |
| 82 | 81 |
| 83 // BrowserContextKeyedAPI implementation. | 82 // BrowserContextKeyedAPI implementation. |
| 84 static const char* service_name() { | 83 static const char* service_name() { |
| 85 return "MediaGalleriesAPI"; | 84 return "MediaGalleriesAPI"; |
| 86 } | 85 } |
| 87 static const bool kServiceIsNULLWhileTesting = true; | 86 static const bool kServiceIsNULLWhileTesting = true; |
| 88 | 87 |
| 89 // GalleryWatchManagerObserver | 88 // GalleryWatchManagerObserver |
| 90 virtual void OnGalleryChanged(const std::string& extension_id, | 89 void OnGalleryChanged(const std::string& extension_id, |
| 91 MediaGalleryPrefId gallery_id) override; | 90 MediaGalleryPrefId gallery_id) override; |
| 92 virtual void OnGalleryWatchDropped(const std::string& extension_id, | 91 void OnGalleryWatchDropped(const std::string& extension_id, |
| 93 MediaGalleryPrefId gallery_id) override; | 92 MediaGalleryPrefId gallery_id) override; |
| 94 | 93 |
| 95 // extensions::EventRouter::Observer implementation. | 94 // extensions::EventRouter::Observer implementation. |
| 96 virtual void OnListenerRemoved(const EventListenerInfo& details) override; | 95 void OnListenerRemoved(const EventListenerInfo& details) override; |
| 97 | 96 |
| 98 // Current profile. | 97 // Current profile. |
| 99 Profile* profile_; | 98 Profile* profile_; |
| 100 | 99 |
| 101 base::WeakPtrFactory<MediaGalleriesEventRouter> weak_ptr_factory_; | 100 base::WeakPtrFactory<MediaGalleriesEventRouter> weak_ptr_factory_; |
| 102 | 101 |
| 103 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesEventRouter); | 102 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesEventRouter); |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 class MediaGalleriesGetMediaFileSystemsFunction | 105 class MediaGalleriesGetMediaFileSystemsFunction |
| 107 : public ChromeAsyncExtensionFunction { | 106 : public ChromeAsyncExtensionFunction { |
| 108 public: | 107 public: |
| 109 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems", | 108 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems", |
| 110 MEDIAGALLERIES_GETMEDIAFILESYSTEMS) | 109 MEDIAGALLERIES_GETMEDIAFILESYSTEMS) |
| 111 | 110 |
| 112 protected: | 111 protected: |
| 113 virtual ~MediaGalleriesGetMediaFileSystemsFunction(); | 112 ~MediaGalleriesGetMediaFileSystemsFunction() override; |
| 114 virtual bool RunAsync() override; | 113 bool RunAsync() override; |
| 115 | 114 |
| 116 private: | 115 private: |
| 117 // Bottom half for RunAsync, invoked after the preferences is initialized. | 116 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 118 void OnPreferencesInit( | 117 void OnPreferencesInit( |
| 119 MediaGalleries::GetMediaFileSystemsInteractivity interactive); | 118 MediaGalleries::GetMediaFileSystemsInteractivity interactive); |
| 120 | 119 |
| 121 // Always show the dialog. | 120 // Always show the dialog. |
| 122 void AlwaysShowDialog(const std::vector<MediaFileSystemInfo>& filesystems); | 121 void AlwaysShowDialog(const std::vector<MediaFileSystemInfo>& filesystems); |
| 123 | 122 |
| 124 // If no galleries are found, show the dialog, otherwise return them. | 123 // If no galleries are found, show the dialog, otherwise return them. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 140 void GetMediaFileSystemsForExtension(const MediaFileSystemsCallback& cb); | 139 void GetMediaFileSystemsForExtension(const MediaFileSystemsCallback& cb); |
| 141 }; | 140 }; |
| 142 | 141 |
| 143 class MediaGalleriesGetAllMediaFileSystemMetadataFunction | 142 class MediaGalleriesGetAllMediaFileSystemMetadataFunction |
| 144 : public ChromeAsyncExtensionFunction { | 143 : public ChromeAsyncExtensionFunction { |
| 145 public: | 144 public: |
| 146 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllMediaFileSystemMetadata", | 145 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllMediaFileSystemMetadata", |
| 147 MEDIAGALLERIES_GETALLMEDIAFILESYSTEMMETADATA) | 146 MEDIAGALLERIES_GETALLMEDIAFILESYSTEMMETADATA) |
| 148 | 147 |
| 149 protected: | 148 protected: |
| 150 virtual ~MediaGalleriesGetAllMediaFileSystemMetadataFunction(); | 149 ~MediaGalleriesGetAllMediaFileSystemMetadataFunction() override; |
| 151 virtual bool RunAsync() override; | 150 bool RunAsync() override; |
| 152 | 151 |
| 153 private: | 152 private: |
| 154 // Bottom half for RunAsync, invoked after the preferences is initialized. | 153 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 155 // Gets the list of permitted galleries and checks if they are available. | 154 // Gets the list of permitted galleries and checks if they are available. |
| 156 void OnPreferencesInit(); | 155 void OnPreferencesInit(); |
| 157 | 156 |
| 158 // Callback to run upon getting the list of available devices. | 157 // Callback to run upon getting the list of available devices. |
| 159 // Sends the list of media filesystem metadata back to the extension. | 158 // Sends the list of media filesystem metadata back to the extension. |
| 160 void OnGetGalleries( | 159 void OnGetGalleries( |
| 161 const MediaGalleryPrefIdSet& permitted_gallery_ids, | 160 const MediaGalleryPrefIdSet& permitted_gallery_ids, |
| 162 const storage_monitor::MediaStorageUtil::DeviceIdSet* available_devices); | 161 const storage_monitor::MediaStorageUtil::DeviceIdSet* available_devices); |
| 163 }; | 162 }; |
| 164 | 163 |
| 165 class MediaGalleriesAddUserSelectedFolderFunction | 164 class MediaGalleriesAddUserSelectedFolderFunction |
| 166 : public ChromeAsyncExtensionFunction { | 165 : public ChromeAsyncExtensionFunction { |
| 167 public: | 166 public: |
| 168 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addUserSelectedFolder", | 167 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addUserSelectedFolder", |
| 169 MEDIAGALLERIES_ADDUSERSELECTEDFOLDER) | 168 MEDIAGALLERIES_ADDUSERSELECTEDFOLDER) |
| 170 | 169 |
| 171 protected: | 170 protected: |
| 172 virtual ~MediaGalleriesAddUserSelectedFolderFunction(); | 171 ~MediaGalleriesAddUserSelectedFolderFunction() override; |
| 173 virtual bool RunAsync() override; | 172 bool RunAsync() override; |
| 174 | 173 |
| 175 private: | 174 private: |
| 176 // Bottom half for RunAsync, invoked after the preferences is initialized. | 175 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 177 void OnPreferencesInit(); | 176 void OnPreferencesInit(); |
| 178 | 177 |
| 179 // Callback for the directory prompt request, with the input from the user. | 178 // Callback for the directory prompt request, with the input from the user. |
| 180 // If |selected_directory| is empty, then the user canceled. | 179 // If |selected_directory| is empty, then the user canceled. |
| 181 // Either handle the user canceled case or add the selected gallery. | 180 // Either handle the user canceled case or add the selected gallery. |
| 182 void OnDirectorySelected(const base::FilePath& selected_directory); | 181 void OnDirectorySelected(const base::FilePath& selected_directory); |
| 183 | 182 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 195 void GetMediaFileSystemsForExtension(const MediaFileSystemsCallback& cb); | 194 void GetMediaFileSystemsForExtension(const MediaFileSystemsCallback& cb); |
| 196 }; | 195 }; |
| 197 | 196 |
| 198 class MediaGalleriesDropPermissionForMediaFileSystemFunction | 197 class MediaGalleriesDropPermissionForMediaFileSystemFunction |
| 199 : public ChromeAsyncExtensionFunction { | 198 : public ChromeAsyncExtensionFunction { |
| 200 public: | 199 public: |
| 201 DECLARE_EXTENSION_FUNCTION("mediaGalleries.dropPermissionForMediaFileSystem", | 200 DECLARE_EXTENSION_FUNCTION("mediaGalleries.dropPermissionForMediaFileSystem", |
| 202 MEDIAGALLERIES_DROPPERMISSIONFORMEDIAFILESYSTEM) | 201 MEDIAGALLERIES_DROPPERMISSIONFORMEDIAFILESYSTEM) |
| 203 | 202 |
| 204 protected: | 203 protected: |
| 205 virtual ~MediaGalleriesDropPermissionForMediaFileSystemFunction(); | 204 ~MediaGalleriesDropPermissionForMediaFileSystemFunction() override; |
| 206 virtual bool RunAsync() override; | 205 bool RunAsync() override; |
| 207 | 206 |
| 208 private: | 207 private: |
| 209 // Bottom half for RunAsync, invoked after the preferences is initialized. | 208 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 210 void OnPreferencesInit(MediaGalleryPrefId pref_id); | 209 void OnPreferencesInit(MediaGalleryPrefId pref_id); |
| 211 }; | 210 }; |
| 212 | 211 |
| 213 class MediaGalleriesStartMediaScanFunction | 212 class MediaGalleriesStartMediaScanFunction |
| 214 : public ChromeAsyncExtensionFunction { | 213 : public ChromeAsyncExtensionFunction { |
| 215 public: | 214 public: |
| 216 DECLARE_EXTENSION_FUNCTION("mediaGalleries.startMediaScan", | 215 DECLARE_EXTENSION_FUNCTION("mediaGalleries.startMediaScan", |
| 217 MEDIAGALLERIES_STARTMEDIASCAN) | 216 MEDIAGALLERIES_STARTMEDIASCAN) |
| 218 | 217 |
| 219 protected: | 218 protected: |
| 220 virtual ~MediaGalleriesStartMediaScanFunction(); | 219 ~MediaGalleriesStartMediaScanFunction() override; |
| 221 virtual bool RunAsync() override; | 220 bool RunAsync() override; |
| 222 | 221 |
| 223 private: | 222 private: |
| 224 // Bottom half for RunAsync, invoked after the preferences is initialized. | 223 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 225 void OnPreferencesInit(); | 224 void OnPreferencesInit(); |
| 226 }; | 225 }; |
| 227 | 226 |
| 228 class MediaGalleriesCancelMediaScanFunction | 227 class MediaGalleriesCancelMediaScanFunction |
| 229 : public ChromeAsyncExtensionFunction { | 228 : public ChromeAsyncExtensionFunction { |
| 230 public: | 229 public: |
| 231 DECLARE_EXTENSION_FUNCTION("mediaGalleries.cancelMediaScan", | 230 DECLARE_EXTENSION_FUNCTION("mediaGalleries.cancelMediaScan", |
| 232 MEDIAGALLERIES_CANCELMEDIASCAN) | 231 MEDIAGALLERIES_CANCELMEDIASCAN) |
| 233 | 232 |
| 234 protected: | 233 protected: |
| 235 virtual ~MediaGalleriesCancelMediaScanFunction(); | 234 ~MediaGalleriesCancelMediaScanFunction() override; |
| 236 virtual bool RunAsync() override; | 235 bool RunAsync() override; |
| 237 | 236 |
| 238 private: | 237 private: |
| 239 // Bottom half for RunAsync, invoked after the preferences is initialized. | 238 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 240 void OnPreferencesInit(); | 239 void OnPreferencesInit(); |
| 241 }; | 240 }; |
| 242 | 241 |
| 243 class MediaGalleriesAddScanResultsFunction | 242 class MediaGalleriesAddScanResultsFunction |
| 244 : public ChromeAsyncExtensionFunction { | 243 : public ChromeAsyncExtensionFunction { |
| 245 public: | 244 public: |
| 246 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addScanResults", | 245 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addScanResults", |
| 247 MEDIAGALLERIES_ADDSCANRESULTS) | 246 MEDIAGALLERIES_ADDSCANRESULTS) |
| 248 | 247 |
| 249 protected: | 248 protected: |
| 250 virtual ~MediaGalleriesAddScanResultsFunction(); | 249 ~MediaGalleriesAddScanResultsFunction() override; |
| 251 virtual bool RunAsync() override; | 250 bool RunAsync() override; |
| 252 | 251 |
| 253 // Pulled out for testing. | 252 // Pulled out for testing. |
| 254 virtual MediaGalleriesScanResultController* MakeDialog( | 253 virtual MediaGalleriesScanResultController* MakeDialog( |
| 255 content::WebContents* web_contents, | 254 content::WebContents* web_contents, |
| 256 const extensions::Extension& extension, | 255 const extensions::Extension& extension, |
| 257 const base::Closure& on_finish); | 256 const base::Closure& on_finish); |
| 258 | 257 |
| 259 private: | 258 private: |
| 260 // Bottom half for RunAsync, invoked after the preferences is initialized. | 259 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 261 void OnPreferencesInit(); | 260 void OnPreferencesInit(); |
| 262 | 261 |
| 263 // Grabs galleries from the media file system registry and passes them to | 262 // Grabs galleries from the media file system registry and passes them to |
| 264 // ReturnGalleries(). | 263 // ReturnGalleries(). |
| 265 void GetAndReturnGalleries(); | 264 void GetAndReturnGalleries(); |
| 266 | 265 |
| 267 // Returns galleries to the caller. | 266 // Returns galleries to the caller. |
| 268 void ReturnGalleries(const std::vector<MediaFileSystemInfo>& filesystems); | 267 void ReturnGalleries(const std::vector<MediaFileSystemInfo>& filesystems); |
| 269 }; | 268 }; |
| 270 | 269 |
| 271 class MediaGalleriesGetMetadataFunction : public ChromeAsyncExtensionFunction { | 270 class MediaGalleriesGetMetadataFunction : public ChromeAsyncExtensionFunction { |
| 272 public: | 271 public: |
| 273 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", | 272 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", |
| 274 MEDIAGALLERIES_GETMETADATA) | 273 MEDIAGALLERIES_GETMETADATA) |
| 275 | 274 |
| 276 protected: | 275 protected: |
| 277 virtual ~MediaGalleriesGetMetadataFunction(); | 276 ~MediaGalleriesGetMetadataFunction() override; |
| 278 virtual bool RunAsync() override; | 277 bool RunAsync() override; |
| 279 | 278 |
| 280 private: | 279 private: |
| 281 // Bottom half for RunAsync, invoked after the preferences is initialized. | 280 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 282 void OnPreferencesInit(MediaGalleries::GetMetadataType metadata_type, | 281 void OnPreferencesInit(MediaGalleries::GetMetadataType metadata_type, |
| 283 const std::string& blob_uuid); | 282 const std::string& blob_uuid); |
| 284 | 283 |
| 285 void GetMetadata(MediaGalleries::GetMetadataType metadata_type, | 284 void GetMetadata(MediaGalleries::GetMetadataType metadata_type, |
| 286 const std::string& blob_uuid, | 285 const std::string& blob_uuid, |
| 287 scoped_ptr<std::string> blob_header, | 286 scoped_ptr<std::string> blob_header, |
| 288 int64 total_blob_length); | 287 int64 total_blob_length); |
| 289 | 288 |
| 290 void OnSafeMediaMetadataParserDone( | 289 void OnSafeMediaMetadataParserDone( |
| 291 bool parse_success, scoped_ptr<base::DictionaryValue> result_dictionary, | 290 bool parse_success, scoped_ptr<base::DictionaryValue> result_dictionary, |
| 292 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images); | 291 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images); |
| 293 | 292 |
| 294 void ConstructNextBlob( | 293 void ConstructNextBlob( |
| 295 scoped_ptr<base::DictionaryValue> result_dictionary, | 294 scoped_ptr<base::DictionaryValue> result_dictionary, |
| 296 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images, | 295 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images, |
| 297 scoped_ptr<std::vector<std::string> > blob_uuids, | 296 scoped_ptr<std::vector<std::string> > blob_uuids, |
| 298 scoped_ptr<content::BlobHandle> current_blob); | 297 scoped_ptr<content::BlobHandle> current_blob); |
| 299 }; | 298 }; |
| 300 | 299 |
| 301 class MediaGalleriesAddGalleryWatchFunction | 300 class MediaGalleriesAddGalleryWatchFunction |
| 302 : public ChromeAsyncExtensionFunction { | 301 : public ChromeAsyncExtensionFunction { |
| 303 public: | 302 public: |
| 304 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addGalleryWatch", | 303 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addGalleryWatch", |
| 305 MEDIAGALLERIES_ADDGALLERYWATCH); | 304 MEDIAGALLERIES_ADDGALLERYWATCH); |
| 306 | 305 |
| 307 protected: | 306 protected: |
| 308 virtual ~MediaGalleriesAddGalleryWatchFunction(); | 307 ~MediaGalleriesAddGalleryWatchFunction() override; |
| 309 virtual bool RunAsync() override; | 308 bool RunAsync() override; |
| 310 | 309 |
| 311 private: | 310 private: |
| 312 void OnPreferencesInit(const std::string& pref_id); | 311 void OnPreferencesInit(const std::string& pref_id); |
| 313 | 312 |
| 314 // Gallery watch request handler. | 313 // Gallery watch request handler. |
| 315 void HandleResponse(MediaGalleryPrefId gallery_id, const std::string& error); | 314 void HandleResponse(MediaGalleryPrefId gallery_id, const std::string& error); |
| 316 }; | 315 }; |
| 317 | 316 |
| 318 class MediaGalleriesRemoveGalleryWatchFunction | 317 class MediaGalleriesRemoveGalleryWatchFunction |
| 319 : public ChromeAsyncExtensionFunction { | 318 : public ChromeAsyncExtensionFunction { |
| 320 public: | 319 public: |
| 321 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeGalleryWatch", | 320 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeGalleryWatch", |
| 322 MEDIAGALLERIES_REMOVEGALLERYWATCH); | 321 MEDIAGALLERIES_REMOVEGALLERYWATCH); |
| 323 | 322 |
| 324 protected: | 323 protected: |
| 325 virtual ~MediaGalleriesRemoveGalleryWatchFunction(); | 324 ~MediaGalleriesRemoveGalleryWatchFunction() override; |
| 326 virtual bool RunAsync() override; | 325 bool RunAsync() override; |
| 327 | 326 |
| 328 private: | 327 private: |
| 329 void OnPreferencesInit(const std::string& pref_id); | 328 void OnPreferencesInit(const std::string& pref_id); |
| 330 }; | 329 }; |
| 331 | 330 |
| 332 class MediaGalleriesGetAllGalleryWatchFunction | 331 class MediaGalleriesGetAllGalleryWatchFunction |
| 333 : public ChromeAsyncExtensionFunction { | 332 : public ChromeAsyncExtensionFunction { |
| 334 public: | 333 public: |
| 335 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllGalleryWatch", | 334 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllGalleryWatch", |
| 336 MEDIAGALLERIES_GETALLGALLERYWATCH); | 335 MEDIAGALLERIES_GETALLGALLERYWATCH); |
| 337 | 336 |
| 338 protected: | 337 protected: |
| 339 virtual ~MediaGalleriesGetAllGalleryWatchFunction(); | 338 ~MediaGalleriesGetAllGalleryWatchFunction() override; |
| 340 virtual bool RunAsync() override; | 339 bool RunAsync() override; |
| 341 | 340 |
| 342 private: | 341 private: |
| 343 void OnPreferencesInit(); | 342 void OnPreferencesInit(); |
| 344 }; | 343 }; |
| 345 | 344 |
| 346 class MediaGalleriesRemoveAllGalleryWatchFunction | 345 class MediaGalleriesRemoveAllGalleryWatchFunction |
| 347 : public ChromeAsyncExtensionFunction { | 346 : public ChromeAsyncExtensionFunction { |
| 348 public: | 347 public: |
| 349 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeAllGalleryWatch", | 348 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeAllGalleryWatch", |
| 350 MEDIAGALLERIES_REMOVEALLGALLERYWATCH); | 349 MEDIAGALLERIES_REMOVEALLGALLERYWATCH); |
| 351 | 350 |
| 352 protected: | 351 protected: |
| 353 virtual ~MediaGalleriesRemoveAllGalleryWatchFunction(); | 352 ~MediaGalleriesRemoveAllGalleryWatchFunction() override; |
| 354 virtual bool RunAsync() override; | 353 bool RunAsync() override; |
| 355 | 354 |
| 356 private: | 355 private: |
| 357 void OnPreferencesInit(); | 356 void OnPreferencesInit(); |
| 358 }; | 357 }; |
| 359 | 358 |
| 360 } // namespace extensions | 359 } // namespace extensions |
| 361 | 360 |
| 362 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 361 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
| OLD | NEW |