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

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

Issue 1695563002: Media Galleries Partial Deprecation: Remove scan functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 // Implements the Chrome Extensions Media Galleries API. 5 // Implements the Chrome Extensions Media Galleries API.
6 6
7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h" 7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <set> 10 #include <set>
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 24 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
25 #include "chrome/browser/extensions/blob_reader.h" 25 #include "chrome/browser/extensions/blob_reader.h"
26 #include "chrome/browser/extensions/chrome_extension_function_details.h" 26 #include "chrome/browser/extensions/chrome_extension_function_details.h"
27 #include "chrome/browser/extensions/extension_tab_util.h" 27 #include "chrome/browser/extensions/extension_tab_util.h"
28 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h" 28 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h"
29 #include "chrome/browser/media_galleries/gallery_watch_manager.h" 29 #include "chrome/browser/media_galleries/gallery_watch_manager.h"
30 #include "chrome/browser/media_galleries/media_file_system_registry.h" 30 #include "chrome/browser/media_galleries/media_file_system_registry.h"
31 #include "chrome/browser/media_galleries/media_galleries_histograms.h" 31 #include "chrome/browser/media_galleries/media_galleries_histograms.h"
32 #include "chrome/browser/media_galleries/media_galleries_permission_controller.h " 32 #include "chrome/browser/media_galleries/media_galleries_permission_controller.h "
33 #include "chrome/browser/media_galleries/media_galleries_preferences.h" 33 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
34 #include "chrome/browser/media_galleries/media_galleries_scan_result_controller. h"
35 #include "chrome/browser/media_galleries/media_scan_manager.h"
36 #include "chrome/browser/platform_util.h" 34 #include "chrome/browser/platform_util.h"
37 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/ui/chrome_select_file_policy.h" 36 #include "chrome/browser/ui/chrome_select_file_policy.h"
39 #include "chrome/common/extensions/api/media_galleries.h" 37 #include "chrome/common/extensions/api/media_galleries.h"
40 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
41 #include "chrome/grit/generated_resources.h" 39 #include "chrome/grit/generated_resources.h"
42 #include "components/storage_monitor/storage_info.h" 40 #include "components/storage_monitor/storage_info.h"
43 #include "content/public/browser/blob_handle.h" 41 #include "content/public/browser/blob_handle.h"
44 #include "content/public/browser/browser_context.h" 42 #include "content/public/browser/browser_context.h"
45 #include "content/public/browser/browser_thread.h" 43 #include "content/public/browser/browser_thread.h"
(...skipping 29 matching lines...) Expand all
75 73
76 namespace { 74 namespace {
77 75
78 const char kDisallowedByPolicy[] = 76 const char kDisallowedByPolicy[] =
79 "Media Galleries API is disallowed by policy: "; 77 "Media Galleries API is disallowed by policy: ";
80 const char kFailedToSetGalleryPermission[] = 78 const char kFailedToSetGalleryPermission[] =
81 "Failed to set gallery permission."; 79 "Failed to set gallery permission.";
82 const char kInvalidGalleryIdMsg[] = "Invalid gallery id."; 80 const char kInvalidGalleryIdMsg[] = "Invalid gallery id.";
83 const char kMissingEventListener[] = "Missing event listener registration."; 81 const char kMissingEventListener[] = "Missing event listener registration.";
84 const char kNonExistentGalleryId[] = "Non-existent gallery id."; 82 const char kNonExistentGalleryId[] = "Non-existent gallery id.";
85 const char kNoScanPermission[] = "No permission to scan.";
86 83
87 const char kDeviceIdKey[] = "deviceId"; 84 const char kDeviceIdKey[] = "deviceId";
88 const char kGalleryIdKey[] = "galleryId"; 85 const char kGalleryIdKey[] = "galleryId";
89 const char kIsAvailableKey[] = "isAvailable"; 86 const char kIsAvailableKey[] = "isAvailable";
90 const char kIsMediaDeviceKey[] = "isMediaDevice"; 87 const char kIsMediaDeviceKey[] = "isMediaDevice";
91 const char kIsRemovableKey[] = "isRemovable"; 88 const char kIsRemovableKey[] = "isRemovable";
92 const char kNameKey[] = "name"; 89 const char kNameKey[] = "name";
93 90
94 const char kMetadataKey[] = "metadata"; 91 const char kMetadataKey[] = "metadata";
95 const char kAttachedImagesBlobInfoKey[] = "attachedImagesBlobInfo"; 92 const char kAttachedImagesBlobInfoKey[] = "attachedImagesBlobInfo";
96 const char kBlobUUIDKey[] = "blobUUID"; 93 const char kBlobUUIDKey[] = "blobUUID";
97 const char kTypeKey[] = "type"; 94 const char kTypeKey[] = "type";
98 const char kSizeKey[] = "size"; 95 const char kSizeKey[] = "size";
99 96
100 const char kInvalidGalleryId[] = "-1"; 97 const char kInvalidGalleryId[] = "-1";
101 98
102 MediaFileSystemRegistry* media_file_system_registry() { 99 MediaFileSystemRegistry* media_file_system_registry() {
103 return g_browser_process->media_file_system_registry(); 100 return g_browser_process->media_file_system_registry();
104 } 101 }
105 102
106 GalleryWatchManager* gallery_watch_manager() { 103 GalleryWatchManager* gallery_watch_manager() {
107 return media_file_system_registry()->gallery_watch_manager(); 104 return media_file_system_registry()->gallery_watch_manager();
108 } 105 }
109 106
110 MediaScanManager* media_scan_manager() {
111 return media_file_system_registry()->media_scan_manager();
112 }
113
114 // Checks whether the MediaGalleries API is currently accessible (it may be 107 // Checks whether the MediaGalleries API is currently accessible (it may be
115 // disallowed even if an extension has the requisite permission). Then 108 // disallowed even if an extension has the requisite permission). Then
116 // initializes the MediaGalleriesPreferences 109 // initializes the MediaGalleriesPreferences
117 bool Setup(Profile* profile, std::string* error, base::Closure callback) { 110 bool Setup(Profile* profile, std::string* error, base::Closure callback) {
118 if (!ChromeSelectFilePolicy::FileSelectDialogsAllowed()) { 111 if (!ChromeSelectFilePolicy::FileSelectDialogsAllowed()) {
119 *error = std::string(kDisallowedByPolicy) + 112 *error = std::string(kDisallowedByPolicy) +
120 prefs::kAllowFileSelectionDialogs; 113 prefs::kAllowFileSelectionDialogs;
121 return false; 114 return false;
122 } 115 }
123 116
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (has_copy_to_permission) { 203 if (has_copy_to_permission) {
211 policy->GrantCopyInto(child_id, filesystems[i].path); 204 policy->GrantCopyInto(child_id, filesystems[i].path);
212 } 205 }
213 } 206 }
214 } 207 }
215 } 208 }
216 209
217 return list.release(); 210 return list.release();
218 } 211 }
219 212
220 bool CheckScanPermission(const extensions::Extension* extension,
221 std::string* error) {
222 DCHECK(extension);
223 DCHECK(error);
224 MediaGalleriesPermission::CheckParam scan_param(
225 MediaGalleriesPermission::kScanPermission);
226 bool has_scan_permission =
227 extension->permissions_data()->CheckAPIPermissionWithParam(
228 APIPermission::kMediaGalleries, &scan_param);
229 if (!has_scan_permission)
230 *error = kNoScanPermission;
231 return has_scan_permission;
232 }
233
234 class SelectDirectoryDialog : public ui::SelectFileDialog::Listener, 213 class SelectDirectoryDialog : public ui::SelectFileDialog::Listener,
235 public base::RefCounted<SelectDirectoryDialog> { 214 public base::RefCounted<SelectDirectoryDialog> {
236 public: 215 public:
237 // Selected file path, or an empty path if the user canceled. 216 // Selected file path, or an empty path if the user canceled.
238 typedef base::Callback<void(const base::FilePath&)> Callback; 217 typedef base::Callback<void(const base::FilePath&)> Callback;
239 218
240 SelectDirectoryDialog(WebContents* web_contents, const Callback& callback) 219 SelectDirectoryDialog(WebContents* web_contents, const Callback& callback)
241 : web_contents_(web_contents), 220 : web_contents_(web_contents),
242 callback_(callback) { 221 callback_(callback) {
243 select_file_dialog_ = ui::SelectFileDialog::Create( 222 select_file_dialog_ = ui::SelectFileDialog::Create(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 MediaGalleriesEventRouter::MediaGalleriesEventRouter( 270 MediaGalleriesEventRouter::MediaGalleriesEventRouter(
292 content::BrowserContext* context) 271 content::BrowserContext* context)
293 : profile_(Profile::FromBrowserContext(context)), weak_ptr_factory_(this) { 272 : profile_(Profile::FromBrowserContext(context)), weak_ptr_factory_(this) {
294 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 273 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
295 DCHECK(profile_); 274 DCHECK(profile_);
296 275
297 EventRouter::Get(profile_)->RegisterObserver( 276 EventRouter::Get(profile_)->RegisterObserver(
298 this, MediaGalleries::OnGalleryChanged::kEventName); 277 this, MediaGalleries::OnGalleryChanged::kEventName);
299 278
300 gallery_watch_manager()->AddObserver(profile_, this); 279 gallery_watch_manager()->AddObserver(profile_, this);
301 media_scan_manager()->AddObserver(profile_, this);
302 } 280 }
303 281
304 MediaGalleriesEventRouter::~MediaGalleriesEventRouter() { 282 MediaGalleriesEventRouter::~MediaGalleriesEventRouter() {
305 } 283 }
306 284
307 void MediaGalleriesEventRouter::Shutdown() { 285 void MediaGalleriesEventRouter::Shutdown() {
308 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 286 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
309 weak_ptr_factory_.InvalidateWeakPtrs(); 287 weak_ptr_factory_.InvalidateWeakPtrs();
310 288
311 EventRouter::Get(profile_)->UnregisterObserver(this); 289 EventRouter::Get(profile_)->UnregisterObserver(this);
312 290
313 gallery_watch_manager()->RemoveObserver(profile_); 291 gallery_watch_manager()->RemoveObserver(profile_);
314 media_scan_manager()->RemoveObserver(profile_);
315 media_scan_manager()->CancelScansForProfile(profile_);
316 } 292 }
317 293
318 static base::LazyInstance< 294 static base::LazyInstance<
319 BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter> > g_factory = 295 BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter> > g_factory =
320 LAZY_INSTANCE_INITIALIZER; 296 LAZY_INSTANCE_INITIALIZER;
321 297
322 // static 298 // static
323 BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>* 299 BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>*
324 MediaGalleriesEventRouter::GetFactoryInstance() { 300 MediaGalleriesEventRouter::GetFactoryInstance() {
325 return g_factory.Pointer(); 301 return g_factory.Pointer();
326 } 302 }
327 303
328 // static 304 // static
329 MediaGalleriesEventRouter* MediaGalleriesEventRouter::Get( 305 MediaGalleriesEventRouter* MediaGalleriesEventRouter::Get(
330 content::BrowserContext* context) { 306 content::BrowserContext* context) {
331 DCHECK(media_file_system_registry() 307 DCHECK(media_file_system_registry()
332 ->GetPreferences(Profile::FromBrowserContext(context)) 308 ->GetPreferences(Profile::FromBrowserContext(context))
333 ->IsInitialized()); 309 ->IsInitialized());
334 return BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>::Get(context); 310 return BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>::Get(context);
335 } 311 }
336 312
337 bool MediaGalleriesEventRouter::ExtensionHasGalleryChangeListener( 313 bool MediaGalleriesEventRouter::ExtensionHasGalleryChangeListener(
338 const std::string& extension_id) const { 314 const std::string& extension_id) const {
339 return EventRouter::Get(profile_)->ExtensionHasEventListener( 315 return EventRouter::Get(profile_)->ExtensionHasEventListener(
340 extension_id, MediaGalleries::OnGalleryChanged::kEventName); 316 extension_id, MediaGalleries::OnGalleryChanged::kEventName);
341 } 317 }
342 318
343 bool MediaGalleriesEventRouter::ExtensionHasScanProgressListener(
344 const std::string& extension_id) const {
345 return EventRouter::Get(profile_)->ExtensionHasEventListener(
346 extension_id, MediaGalleries::OnScanProgress::kEventName);
347 }
348
349 void MediaGalleriesEventRouter::OnScanStarted(const std::string& extension_id) {
350 MediaGalleries::ScanProgressDetails details;
351 details.type = MediaGalleries::SCAN_PROGRESS_TYPE_START;
352 DispatchEventToExtension(extension_id,
353 events::MEDIA_GALLERIES_ON_SCAN_PROGRESS,
354 MediaGalleries::OnScanProgress::kEventName,
355 MediaGalleries::OnScanProgress::Create(details));
356 }
357
358 void MediaGalleriesEventRouter::OnScanCancelled(
359 const std::string& extension_id) {
360 MediaGalleries::ScanProgressDetails details;
361 details.type = MediaGalleries::SCAN_PROGRESS_TYPE_CANCEL;
362 DispatchEventToExtension(extension_id,
363 events::MEDIA_GALLERIES_ON_SCAN_PROGRESS,
364 MediaGalleries::OnScanProgress::kEventName,
365 MediaGalleries::OnScanProgress::Create(details));
366 }
367
368 void MediaGalleriesEventRouter::OnScanFinished(
369 const std::string& extension_id, int gallery_count,
370 const MediaGalleryScanResult& file_counts) {
371 media_galleries::UsageCount(media_galleries::SCAN_FINISHED);
372 MediaGalleries::ScanProgressDetails details;
373 details.type = MediaGalleries::SCAN_PROGRESS_TYPE_FINISH;
374 details.gallery_count.reset(new int(gallery_count));
375 details.audio_count.reset(new int(file_counts.audio_count));
376 details.image_count.reset(new int(file_counts.image_count));
377 details.video_count.reset(new int(file_counts.video_count));
378 DispatchEventToExtension(extension_id,
379 events::MEDIA_GALLERIES_ON_SCAN_PROGRESS,
380 MediaGalleries::OnScanProgress::kEventName,
381 MediaGalleries::OnScanProgress::Create(details));
382 }
383
384 void MediaGalleriesEventRouter::OnScanError(
385 const std::string& extension_id) {
386 MediaGalleries::ScanProgressDetails details;
387 details.type = MediaGalleries::SCAN_PROGRESS_TYPE_ERROR;
388 DispatchEventToExtension(extension_id,
389 events::MEDIA_GALLERIES_ON_SCAN_PROGRESS,
390 MediaGalleries::OnScanProgress::kEventName,
391 MediaGalleries::OnScanProgress::Create(details));
392 }
393
394 void MediaGalleriesEventRouter::DispatchEventToExtension( 319 void MediaGalleriesEventRouter::DispatchEventToExtension(
395 const std::string& extension_id, 320 const std::string& extension_id,
396 events::HistogramValue histogram_value, 321 events::HistogramValue histogram_value,
397 const std::string& event_name, 322 const std::string& event_name,
398 scoped_ptr<base::ListValue> event_args) { 323 scoped_ptr<base::ListValue> event_args) {
399 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 324 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
400 325
401 EventRouter* router = EventRouter::Get(profile_); 326 EventRouter* router = EventRouter::Get(profile_);
402 if (!router->ExtensionHasEventListener(extension_id, event_name)) 327 if (!router->ExtensionHasEventListener(extension_id, event_name))
403 return; 328 return;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 bool dropped = preferences->SetGalleryPermissionForExtension( 683 bool dropped = preferences->SetGalleryPermissionForExtension(
759 *extension(), pref_id, false); 684 *extension(), pref_id, false);
760 if (dropped) 685 if (dropped)
761 SetResult(new base::StringValue(base::Uint64ToString(pref_id))); 686 SetResult(new base::StringValue(base::Uint64ToString(pref_id)));
762 else 687 else
763 error_ = kFailedToSetGalleryPermission; 688 error_ = kFailedToSetGalleryPermission;
764 SendResponse(dropped); 689 SendResponse(dropped);
765 } 690 }
766 691
767 /////////////////////////////////////////////////////////////////////////////// 692 ///////////////////////////////////////////////////////////////////////////////
768 // MediaGalleriesStartMediaScanFunction //
769 ///////////////////////////////////////////////////////////////////////////////
770 MediaGalleriesStartMediaScanFunction::~MediaGalleriesStartMediaScanFunction() {}
771
772 bool MediaGalleriesStartMediaScanFunction::RunAsync() {
773 media_galleries::UsageCount(media_galleries::START_MEDIA_SCAN);
774 if (!CheckScanPermission(extension(), &error_)) {
775 MediaGalleriesEventRouter::Get(GetProfile())
776 ->OnScanError(extension()->id());
777 return false;
778 }
779 return Setup(GetProfile(), &error_, base::Bind(
780 &MediaGalleriesStartMediaScanFunction::OnPreferencesInit, this));
781 }
782
783 void MediaGalleriesStartMediaScanFunction::OnPreferencesInit() {
784 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
785 MediaGalleriesEventRouter* api = MediaGalleriesEventRouter::Get(GetProfile());
786 if (!api->ExtensionHasScanProgressListener(extension()->id())) {
787 error_ = kMissingEventListener;
788 SendResponse(false);
789 return;
790 }
791
792 media_scan_manager()->StartScan(GetProfile(), extension(), user_gesture());
793 SendResponse(true);
794 }
795
796 ///////////////////////////////////////////////////////////////////////////////
797 // MediaGalleriesCancelMediaScanFunction //
798 ///////////////////////////////////////////////////////////////////////////////
799 MediaGalleriesCancelMediaScanFunction::
800 ~MediaGalleriesCancelMediaScanFunction() {
801 }
802
803 bool MediaGalleriesCancelMediaScanFunction::RunAsync() {
804 media_galleries::UsageCount(media_galleries::CANCEL_MEDIA_SCAN);
805 if (!CheckScanPermission(extension(), &error_)) {
806 MediaGalleriesEventRouter::Get(GetProfile())
807 ->OnScanError(extension()->id());
808 return false;
809 }
810 return Setup(GetProfile(), &error_, base::Bind(
811 &MediaGalleriesCancelMediaScanFunction::OnPreferencesInit, this));
812 }
813
814 void MediaGalleriesCancelMediaScanFunction::OnPreferencesInit() {
815 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
816 media_scan_manager()->CancelScan(GetProfile(), extension());
817 SendResponse(true);
818 }
819
820 ///////////////////////////////////////////////////////////////////////////////
821 // MediaGalleriesAddScanResultsFunction //
822 ///////////////////////////////////////////////////////////////////////////////
823 MediaGalleriesAddScanResultsFunction::~MediaGalleriesAddScanResultsFunction() {}
824
825 bool MediaGalleriesAddScanResultsFunction::RunAsync() {
826 media_galleries::UsageCount(media_galleries::ADD_SCAN_RESULTS);
827 if (!CheckScanPermission(extension(), &error_)) {
828 // We don't fire a scan progress error here, as it would be unintuitive.
829 return false;
830 }
831 if (!user_gesture())
832 return false;
833
834 return Setup(GetProfile(), &error_, base::Bind(
835 &MediaGalleriesAddScanResultsFunction::OnPreferencesInit, this));
836 }
837
838 MediaGalleriesScanResultController*
839 MediaGalleriesAddScanResultsFunction::MakeDialog(
840 content::WebContents* web_contents,
841 const extensions::Extension& extension,
842 const base::Closure& on_finish) {
843 // Controller will delete itself.
844 return new MediaGalleriesScanResultController(web_contents, extension,
845 on_finish);
846 }
847
848 void MediaGalleriesAddScanResultsFunction::OnPreferencesInit() {
849 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
850 MediaGalleriesPreferences* preferences =
851 media_file_system_registry()->GetPreferences(GetProfile());
852 if (MediaGalleriesScanResultController::ScanResultCountForExtension(
853 preferences, extension()) == 0) {
854 GetAndReturnGalleries();
855 return;
856 }
857
858 WebContents* contents =
859 ChromeExtensionFunctionDetails(this).GetOriginWebContents();
860 if (!contents) {
861 SendResponse(false);
862 return;
863 }
864
865 base::Closure cb = base::Bind(
866 &MediaGalleriesAddScanResultsFunction::GetAndReturnGalleries, this);
867 MakeDialog(contents, *extension(), cb);
868 }
869
870 void MediaGalleriesAddScanResultsFunction::GetAndReturnGalleries() {
871 if (!render_frame_host()) {
872 ReturnGalleries(std::vector<MediaFileSystemInfo>());
873 return;
874 }
875 MediaFileSystemRegistry* registry = media_file_system_registry();
876 DCHECK(registry->GetPreferences(GetProfile())->IsInitialized());
877 registry->GetMediaFileSystemsForExtension(
878 GetSenderWebContents(), extension(),
879 base::Bind(&MediaGalleriesAddScanResultsFunction::ReturnGalleries, this));
880 }
881
882 void MediaGalleriesAddScanResultsFunction::ReturnGalleries(
883 const std::vector<MediaFileSystemInfo>& filesystems) {
884 scoped_ptr<base::ListValue> list(
885 ConstructFileSystemList(render_frame_host(), extension(), filesystems));
886 if (!list.get()) {
887 SendResponse(false);
888 return;
889 }
890
891 // The custom JS binding will use this list to create DOMFileSystem objects.
892 SetResult(list.release());
893 SendResponse(true);
894 }
895
896 ///////////////////////////////////////////////////////////////////////////////
897 // MediaGalleriesGetMetadataFunction // 693 // MediaGalleriesGetMetadataFunction //
898 /////////////////////////////////////////////////////////////////////////////// 694 ///////////////////////////////////////////////////////////////////////////////
899 MediaGalleriesGetMetadataFunction::~MediaGalleriesGetMetadataFunction() {} 695 MediaGalleriesGetMetadataFunction::~MediaGalleriesGetMetadataFunction() {}
900 696
901 bool MediaGalleriesGetMetadataFunction::RunAsync() { 697 bool MediaGalleriesGetMetadataFunction::RunAsync() {
902 media_galleries::UsageCount(media_galleries::GET_METADATA); 698 media_galleries::UsageCount(media_galleries::GET_METADATA);
903 std::string blob_uuid; 699 std::string blob_uuid;
904 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &blob_uuid)); 700 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &blob_uuid));
905 701
906 const base::Value* options_value = NULL; 702 const base::Value* options_value = NULL;
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); 1047 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this));
1252 return true; 1048 return true;
1253 } 1049 }
1254 1050
1255 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { 1051 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() {
1256 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); 1052 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id());
1257 SendResponse(true); 1053 SendResponse(true);
1258 } 1054 }
1259 1055
1260 } // namespace extensions 1056 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698