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

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.h

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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
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 virtual 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 virtual void OnScanStarted(const std::string& extension_id) override;
66 virtual void OnScanCancelled(const std::string& extension_id) OVERRIDE; 66 virtual void OnScanCancelled(const std::string& extension_id) override;
67 virtual void OnScanFinished( 67 virtual void OnScanFinished(
68 const std::string& extension_id, 68 const std::string& extension_id,
69 int gallery_count, 69 int gallery_count,
70 const MediaGalleryScanResult& file_counts) OVERRIDE; 70 const MediaGalleryScanResult& file_counts) override;
71 virtual void OnScanError(const std::string& extension_id) OVERRIDE; 71 virtual void OnScanError(const std::string& extension_id) override;
72 72
73 private: 73 private:
74 friend class BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>; 74 friend class BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>;
75 75
76 void DispatchEventToExtension(const std::string& extension_id, 76 void DispatchEventToExtension(const std::string& extension_id,
77 const std::string& event_name, 77 const std::string& event_name,
78 scoped_ptr<base::ListValue> event_args); 78 scoped_ptr<base::ListValue> event_args);
79 79
80 explicit MediaGalleriesEventRouter(content::BrowserContext* context); 80 explicit MediaGalleriesEventRouter(content::BrowserContext* context);
81 virtual ~MediaGalleriesEventRouter(); 81 virtual ~MediaGalleriesEventRouter();
82 82
83 // BrowserContextKeyedAPI implementation. 83 // BrowserContextKeyedAPI implementation.
84 static const char* service_name() { 84 static const char* service_name() {
85 return "MediaGalleriesAPI"; 85 return "MediaGalleriesAPI";
86 } 86 }
87 static const bool kServiceIsNULLWhileTesting = true; 87 static const bool kServiceIsNULLWhileTesting = true;
88 88
89 // GalleryWatchManagerObserver 89 // GalleryWatchManagerObserver
90 virtual void OnGalleryChanged(const std::string& extension_id, 90 virtual void OnGalleryChanged(const std::string& extension_id,
91 MediaGalleryPrefId gallery_id) OVERRIDE; 91 MediaGalleryPrefId gallery_id) override;
92 virtual void OnGalleryWatchDropped(const std::string& extension_id, 92 virtual void OnGalleryWatchDropped(const std::string& extension_id,
93 MediaGalleryPrefId gallery_id) OVERRIDE; 93 MediaGalleryPrefId gallery_id) override;
94 94
95 // extensions::EventRouter::Observer implementation. 95 // extensions::EventRouter::Observer implementation.
96 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; 96 virtual void OnListenerRemoved(const EventListenerInfo& details) override;
97 97
98 // Current profile. 98 // Current profile.
99 Profile* profile_; 99 Profile* profile_;
100 100
101 base::WeakPtrFactory<MediaGalleriesEventRouter> weak_ptr_factory_; 101 base::WeakPtrFactory<MediaGalleriesEventRouter> weak_ptr_factory_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesEventRouter); 103 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesEventRouter);
104 }; 104 };
105 105
106 class MediaGalleriesGetMediaFileSystemsFunction 106 class MediaGalleriesGetMediaFileSystemsFunction
107 : public ChromeAsyncExtensionFunction { 107 : public ChromeAsyncExtensionFunction {
108 public: 108 public:
109 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems", 109 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems",
110 MEDIAGALLERIES_GETMEDIAFILESYSTEMS) 110 MEDIAGALLERIES_GETMEDIAFILESYSTEMS)
111 111
112 protected: 112 protected:
113 virtual ~MediaGalleriesGetMediaFileSystemsFunction(); 113 virtual ~MediaGalleriesGetMediaFileSystemsFunction();
114 virtual bool RunAsync() OVERRIDE; 114 virtual bool RunAsync() override;
115 115
116 private: 116 private:
117 // Bottom half for RunAsync, invoked after the preferences is initialized. 117 // Bottom half for RunAsync, invoked after the preferences is initialized.
118 void OnPreferencesInit( 118 void OnPreferencesInit(
119 MediaGalleries::GetMediaFileSystemsInteractivity interactive); 119 MediaGalleries::GetMediaFileSystemsInteractivity interactive);
120 120
121 // Always show the dialog. 121 // Always show the dialog.
122 void AlwaysShowDialog(const std::vector<MediaFileSystemInfo>& filesystems); 122 void AlwaysShowDialog(const std::vector<MediaFileSystemInfo>& filesystems);
123 123
124 // If no galleries are found, show the dialog, otherwise return them. 124 // If no galleries are found, show the dialog, otherwise return them.
(...skipping 16 matching lines...) Expand all
141 }; 141 };
142 142
143 class MediaGalleriesGetAllMediaFileSystemMetadataFunction 143 class MediaGalleriesGetAllMediaFileSystemMetadataFunction
144 : public ChromeAsyncExtensionFunction { 144 : public ChromeAsyncExtensionFunction {
145 public: 145 public:
146 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllMediaFileSystemMetadata", 146 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllMediaFileSystemMetadata",
147 MEDIAGALLERIES_GETALLMEDIAFILESYSTEMMETADATA) 147 MEDIAGALLERIES_GETALLMEDIAFILESYSTEMMETADATA)
148 148
149 protected: 149 protected:
150 virtual ~MediaGalleriesGetAllMediaFileSystemMetadataFunction(); 150 virtual ~MediaGalleriesGetAllMediaFileSystemMetadataFunction();
151 virtual bool RunAsync() OVERRIDE; 151 virtual bool RunAsync() override;
152 152
153 private: 153 private:
154 // Bottom half for RunAsync, invoked after the preferences is initialized. 154 // Bottom half for RunAsync, invoked after the preferences is initialized.
155 // Gets the list of permitted galleries and checks if they are available. 155 // Gets the list of permitted galleries and checks if they are available.
156 void OnPreferencesInit(); 156 void OnPreferencesInit();
157 157
158 // Callback to run upon getting the list of available devices. 158 // Callback to run upon getting the list of available devices.
159 // Sends the list of media filesystem metadata back to the extension. 159 // Sends the list of media filesystem metadata back to the extension.
160 void OnGetGalleries( 160 void OnGetGalleries(
161 const MediaGalleryPrefIdSet& permitted_gallery_ids, 161 const MediaGalleryPrefIdSet& permitted_gallery_ids,
162 const storage_monitor::MediaStorageUtil::DeviceIdSet* available_devices); 162 const storage_monitor::MediaStorageUtil::DeviceIdSet* available_devices);
163 }; 163 };
164 164
165 class MediaGalleriesAddUserSelectedFolderFunction 165 class MediaGalleriesAddUserSelectedFolderFunction
166 : public ChromeAsyncExtensionFunction { 166 : public ChromeAsyncExtensionFunction {
167 public: 167 public:
168 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addUserSelectedFolder", 168 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addUserSelectedFolder",
169 MEDIAGALLERIES_ADDUSERSELECTEDFOLDER) 169 MEDIAGALLERIES_ADDUSERSELECTEDFOLDER)
170 170
171 protected: 171 protected:
172 virtual ~MediaGalleriesAddUserSelectedFolderFunction(); 172 virtual ~MediaGalleriesAddUserSelectedFolderFunction();
173 virtual bool RunAsync() OVERRIDE; 173 virtual bool RunAsync() override;
174 174
175 private: 175 private:
176 // Bottom half for RunAsync, invoked after the preferences is initialized. 176 // Bottom half for RunAsync, invoked after the preferences is initialized.
177 void OnPreferencesInit(); 177 void OnPreferencesInit();
178 178
179 // Callback for the directory prompt request, with the input from the user. 179 // Callback for the directory prompt request, with the input from the user.
180 // If |selected_directory| is empty, then the user canceled. 180 // If |selected_directory| is empty, then the user canceled.
181 // Either handle the user canceled case or add the selected gallery. 181 // Either handle the user canceled case or add the selected gallery.
182 void OnDirectorySelected(const base::FilePath& selected_directory); 182 void OnDirectorySelected(const base::FilePath& selected_directory);
183 183
(...skipping 12 matching lines...) Expand all
196 }; 196 };
197 197
198 class MediaGalleriesDropPermissionForMediaFileSystemFunction 198 class MediaGalleriesDropPermissionForMediaFileSystemFunction
199 : public ChromeAsyncExtensionFunction { 199 : public ChromeAsyncExtensionFunction {
200 public: 200 public:
201 DECLARE_EXTENSION_FUNCTION("mediaGalleries.dropPermissionForMediaFileSystem", 201 DECLARE_EXTENSION_FUNCTION("mediaGalleries.dropPermissionForMediaFileSystem",
202 MEDIAGALLERIES_DROPPERMISSIONFORMEDIAFILESYSTEM) 202 MEDIAGALLERIES_DROPPERMISSIONFORMEDIAFILESYSTEM)
203 203
204 protected: 204 protected:
205 virtual ~MediaGalleriesDropPermissionForMediaFileSystemFunction(); 205 virtual ~MediaGalleriesDropPermissionForMediaFileSystemFunction();
206 virtual bool RunAsync() OVERRIDE; 206 virtual bool RunAsync() override;
207 207
208 private: 208 private:
209 // Bottom half for RunAsync, invoked after the preferences is initialized. 209 // Bottom half for RunAsync, invoked after the preferences is initialized.
210 void OnPreferencesInit(MediaGalleryPrefId pref_id); 210 void OnPreferencesInit(MediaGalleryPrefId pref_id);
211 }; 211 };
212 212
213 class MediaGalleriesStartMediaScanFunction 213 class MediaGalleriesStartMediaScanFunction
214 : public ChromeAsyncExtensionFunction { 214 : public ChromeAsyncExtensionFunction {
215 public: 215 public:
216 DECLARE_EXTENSION_FUNCTION("mediaGalleries.startMediaScan", 216 DECLARE_EXTENSION_FUNCTION("mediaGalleries.startMediaScan",
217 MEDIAGALLERIES_STARTMEDIASCAN) 217 MEDIAGALLERIES_STARTMEDIASCAN)
218 218
219 protected: 219 protected:
220 virtual ~MediaGalleriesStartMediaScanFunction(); 220 virtual ~MediaGalleriesStartMediaScanFunction();
221 virtual bool RunAsync() OVERRIDE; 221 virtual bool RunAsync() override;
222 222
223 private: 223 private:
224 // Bottom half for RunAsync, invoked after the preferences is initialized. 224 // Bottom half for RunAsync, invoked after the preferences is initialized.
225 void OnPreferencesInit(); 225 void OnPreferencesInit();
226 }; 226 };
227 227
228 class MediaGalleriesCancelMediaScanFunction 228 class MediaGalleriesCancelMediaScanFunction
229 : public ChromeAsyncExtensionFunction { 229 : public ChromeAsyncExtensionFunction {
230 public: 230 public:
231 DECLARE_EXTENSION_FUNCTION("mediaGalleries.cancelMediaScan", 231 DECLARE_EXTENSION_FUNCTION("mediaGalleries.cancelMediaScan",
232 MEDIAGALLERIES_CANCELMEDIASCAN) 232 MEDIAGALLERIES_CANCELMEDIASCAN)
233 233
234 protected: 234 protected:
235 virtual ~MediaGalleriesCancelMediaScanFunction(); 235 virtual ~MediaGalleriesCancelMediaScanFunction();
236 virtual bool RunAsync() OVERRIDE; 236 virtual bool RunAsync() override;
237 237
238 private: 238 private:
239 // Bottom half for RunAsync, invoked after the preferences is initialized. 239 // Bottom half for RunAsync, invoked after the preferences is initialized.
240 void OnPreferencesInit(); 240 void OnPreferencesInit();
241 }; 241 };
242 242
243 class MediaGalleriesAddScanResultsFunction 243 class MediaGalleriesAddScanResultsFunction
244 : public ChromeAsyncExtensionFunction { 244 : public ChromeAsyncExtensionFunction {
245 public: 245 public:
246 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addScanResults", 246 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addScanResults",
247 MEDIAGALLERIES_ADDSCANRESULTS) 247 MEDIAGALLERIES_ADDSCANRESULTS)
248 248
249 protected: 249 protected:
250 virtual ~MediaGalleriesAddScanResultsFunction(); 250 virtual ~MediaGalleriesAddScanResultsFunction();
251 virtual bool RunAsync() OVERRIDE; 251 virtual bool RunAsync() override;
252 252
253 // Pulled out for testing. 253 // Pulled out for testing.
254 virtual MediaGalleriesScanResultController* MakeDialog( 254 virtual MediaGalleriesScanResultController* MakeDialog(
255 content::WebContents* web_contents, 255 content::WebContents* web_contents,
256 const extensions::Extension& extension, 256 const extensions::Extension& extension,
257 const base::Closure& on_finish); 257 const base::Closure& on_finish);
258 258
259 private: 259 private:
260 // Bottom half for RunAsync, invoked after the preferences is initialized. 260 // Bottom half for RunAsync, invoked after the preferences is initialized.
261 void OnPreferencesInit(); 261 void OnPreferencesInit();
262 262
263 // Grabs galleries from the media file system registry and passes them to 263 // Grabs galleries from the media file system registry and passes them to
264 // ReturnGalleries(). 264 // ReturnGalleries().
265 void GetAndReturnGalleries(); 265 void GetAndReturnGalleries();
266 266
267 // Returns galleries to the caller. 267 // Returns galleries to the caller.
268 void ReturnGalleries(const std::vector<MediaFileSystemInfo>& filesystems); 268 void ReturnGalleries(const std::vector<MediaFileSystemInfo>& filesystems);
269 }; 269 };
270 270
271 class MediaGalleriesGetMetadataFunction : public ChromeAsyncExtensionFunction { 271 class MediaGalleriesGetMetadataFunction : public ChromeAsyncExtensionFunction {
272 public: 272 public:
273 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", 273 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata",
274 MEDIAGALLERIES_GETMETADATA) 274 MEDIAGALLERIES_GETMETADATA)
275 275
276 protected: 276 protected:
277 virtual ~MediaGalleriesGetMetadataFunction(); 277 virtual ~MediaGalleriesGetMetadataFunction();
278 virtual bool RunAsync() OVERRIDE; 278 virtual bool RunAsync() override;
279 279
280 private: 280 private:
281 // Bottom half for RunAsync, invoked after the preferences is initialized. 281 // Bottom half for RunAsync, invoked after the preferences is initialized.
282 void OnPreferencesInit(MediaGalleries::GetMetadataType metadata_type, 282 void OnPreferencesInit(MediaGalleries::GetMetadataType metadata_type,
283 const std::string& blob_uuid); 283 const std::string& blob_uuid);
284 284
285 void GetMetadata(MediaGalleries::GetMetadataType metadata_type, 285 void GetMetadata(MediaGalleries::GetMetadataType metadata_type,
286 const std::string& blob_uuid, 286 const std::string& blob_uuid,
287 scoped_ptr<std::string> blob_header, 287 scoped_ptr<std::string> blob_header,
288 int64 total_blob_length); 288 int64 total_blob_length);
(...skipping 10 matching lines...) Expand all
299 }; 299 };
300 300
301 class MediaGalleriesAddGalleryWatchFunction 301 class MediaGalleriesAddGalleryWatchFunction
302 : public ChromeAsyncExtensionFunction { 302 : public ChromeAsyncExtensionFunction {
303 public: 303 public:
304 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addGalleryWatch", 304 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addGalleryWatch",
305 MEDIAGALLERIES_ADDGALLERYWATCH); 305 MEDIAGALLERIES_ADDGALLERYWATCH);
306 306
307 protected: 307 protected:
308 virtual ~MediaGalleriesAddGalleryWatchFunction(); 308 virtual ~MediaGalleriesAddGalleryWatchFunction();
309 virtual bool RunAsync() OVERRIDE; 309 virtual bool RunAsync() override;
310 310
311 private: 311 private:
312 void OnPreferencesInit(const std::string& pref_id); 312 void OnPreferencesInit(const std::string& pref_id);
313 313
314 // Gallery watch request handler. 314 // Gallery watch request handler.
315 void HandleResponse(MediaGalleryPrefId gallery_id, const std::string& error); 315 void HandleResponse(MediaGalleryPrefId gallery_id, const std::string& error);
316 }; 316 };
317 317
318 class MediaGalleriesRemoveGalleryWatchFunction 318 class MediaGalleriesRemoveGalleryWatchFunction
319 : public ChromeAsyncExtensionFunction { 319 : public ChromeAsyncExtensionFunction {
320 public: 320 public:
321 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeGalleryWatch", 321 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeGalleryWatch",
322 MEDIAGALLERIES_REMOVEGALLERYWATCH); 322 MEDIAGALLERIES_REMOVEGALLERYWATCH);
323 323
324 protected: 324 protected:
325 virtual ~MediaGalleriesRemoveGalleryWatchFunction(); 325 virtual ~MediaGalleriesRemoveGalleryWatchFunction();
326 virtual bool RunAsync() OVERRIDE; 326 virtual bool RunAsync() override;
327 327
328 private: 328 private:
329 void OnPreferencesInit(const std::string& pref_id); 329 void OnPreferencesInit(const std::string& pref_id);
330 }; 330 };
331 331
332 class MediaGalleriesGetAllGalleryWatchFunction 332 class MediaGalleriesGetAllGalleryWatchFunction
333 : public ChromeAsyncExtensionFunction { 333 : public ChromeAsyncExtensionFunction {
334 public: 334 public:
335 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllGalleryWatch", 335 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getAllGalleryWatch",
336 MEDIAGALLERIES_GETALLGALLERYWATCH); 336 MEDIAGALLERIES_GETALLGALLERYWATCH);
337 337
338 protected: 338 protected:
339 virtual ~MediaGalleriesGetAllGalleryWatchFunction(); 339 virtual ~MediaGalleriesGetAllGalleryWatchFunction();
340 virtual bool RunAsync() OVERRIDE; 340 virtual bool RunAsync() override;
341 341
342 private: 342 private:
343 void OnPreferencesInit(); 343 void OnPreferencesInit();
344 }; 344 };
345 345
346 class MediaGalleriesRemoveAllGalleryWatchFunction 346 class MediaGalleriesRemoveAllGalleryWatchFunction
347 : public ChromeAsyncExtensionFunction { 347 : public ChromeAsyncExtensionFunction {
348 public: 348 public:
349 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeAllGalleryWatch", 349 DECLARE_EXTENSION_FUNCTION("mediaGalleries.removeAllGalleryWatch",
350 MEDIAGALLERIES_REMOVEALLGALLERYWATCH); 350 MEDIAGALLERIES_REMOVEALLGALLERYWATCH);
351 351
352 protected: 352 protected:
353 virtual ~MediaGalleriesRemoveAllGalleryWatchFunction(); 353 virtual ~MediaGalleriesRemoveAllGalleryWatchFunction();
354 virtual bool RunAsync() OVERRIDE; 354 virtual bool RunAsync() override;
355 355
356 private: 356 private:
357 void OnPreferencesInit(); 357 void OnPreferencesInit();
358 }; 358 };
359 359
360 } // namespace extensions 360 } // namespace extensions
361 361
362 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 362 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698