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

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, 10 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 // TODO(tommycli): Remove these CHECKs after fixing https://crbug.com/467627. 326 // TODO(tommycli): Remove these CHECKs after fixing https://crbug.com/467627.
Lei Zhang 2016/02/12 02:11:25 Oh hey, what's this? :)
tommycli 2016/02/16 20:16:39 Done. I made a separate CL here: https://coderevie
402 CHECK(profile_); 327 CHECK(profile_);
403 EventRouter* router = EventRouter::Get(profile_); 328 EventRouter* router = EventRouter::Get(profile_);
404 CHECK(router); 329 CHECK(router);
405 330
406 if (!router->ExtensionHasEventListener(extension_id, event_name)) 331 if (!router->ExtensionHasEventListener(extension_id, event_name))
407 return; 332 return;
408 333
409 scoped_ptr<extensions::Event> event(new extensions::Event( 334 scoped_ptr<extensions::Event> event(new extensions::Event(
410 histogram_value, event_name, std::move(event_args))); 335 histogram_value, event_name, std::move(event_args)));
411 router->DispatchEventToExtension(extension_id, std::move(event)); 336 router->DispatchEventToExtension(extension_id, std::move(event));
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 bool dropped = preferences->SetGalleryPermissionForExtension( 687 bool dropped = preferences->SetGalleryPermissionForExtension(
763 *extension(), pref_id, false); 688 *extension(), pref_id, false);
764 if (dropped) 689 if (dropped)
765 SetResult(new base::StringValue(base::Uint64ToString(pref_id))); 690 SetResult(new base::StringValue(base::Uint64ToString(pref_id)));
766 else 691 else
767 error_ = kFailedToSetGalleryPermission; 692 error_ = kFailedToSetGalleryPermission;
768 SendResponse(dropped); 693 SendResponse(dropped);
769 } 694 }
770 695
771 /////////////////////////////////////////////////////////////////////////////// 696 ///////////////////////////////////////////////////////////////////////////////
772 // MediaGalleriesStartMediaScanFunction //
773 ///////////////////////////////////////////////////////////////////////////////
774 MediaGalleriesStartMediaScanFunction::~MediaGalleriesStartMediaScanFunction() {}
775
776 bool MediaGalleriesStartMediaScanFunction::RunAsync() {
777 media_galleries::UsageCount(media_galleries::START_MEDIA_SCAN);
778 if (!CheckScanPermission(extension(), &error_)) {
779 MediaGalleriesEventRouter::Get(GetProfile())
780 ->OnScanError(extension()->id());
781 return false;
782 }
783 return Setup(GetProfile(), &error_, base::Bind(
784 &MediaGalleriesStartMediaScanFunction::OnPreferencesInit, this));
785 }
786
787 void MediaGalleriesStartMediaScanFunction::OnPreferencesInit() {
788 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
789 MediaGalleriesEventRouter* api = MediaGalleriesEventRouter::Get(GetProfile());
790 if (!api->ExtensionHasScanProgressListener(extension()->id())) {
791 error_ = kMissingEventListener;
792 SendResponse(false);
793 return;
794 }
795
796 media_scan_manager()->StartScan(GetProfile(), extension(), user_gesture());
797 SendResponse(true);
798 }
799
800 ///////////////////////////////////////////////////////////////////////////////
801 // MediaGalleriesCancelMediaScanFunction //
802 ///////////////////////////////////////////////////////////////////////////////
803 MediaGalleriesCancelMediaScanFunction::
804 ~MediaGalleriesCancelMediaScanFunction() {
805 }
806
807 bool MediaGalleriesCancelMediaScanFunction::RunAsync() {
808 media_galleries::UsageCount(media_galleries::CANCEL_MEDIA_SCAN);
809 if (!CheckScanPermission(extension(), &error_)) {
810 MediaGalleriesEventRouter::Get(GetProfile())
811 ->OnScanError(extension()->id());
812 return false;
813 }
814 return Setup(GetProfile(), &error_, base::Bind(
815 &MediaGalleriesCancelMediaScanFunction::OnPreferencesInit, this));
816 }
817
818 void MediaGalleriesCancelMediaScanFunction::OnPreferencesInit() {
819 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
820 media_scan_manager()->CancelScan(GetProfile(), extension());
821 SendResponse(true);
822 }
823
824 ///////////////////////////////////////////////////////////////////////////////
825 // MediaGalleriesAddScanResultsFunction //
826 ///////////////////////////////////////////////////////////////////////////////
827 MediaGalleriesAddScanResultsFunction::~MediaGalleriesAddScanResultsFunction() {}
828
829 bool MediaGalleriesAddScanResultsFunction::RunAsync() {
830 media_galleries::UsageCount(media_galleries::ADD_SCAN_RESULTS);
831 if (!CheckScanPermission(extension(), &error_)) {
832 // We don't fire a scan progress error here, as it would be unintuitive.
833 return false;
834 }
835 if (!user_gesture())
836 return false;
837
838 return Setup(GetProfile(), &error_, base::Bind(
839 &MediaGalleriesAddScanResultsFunction::OnPreferencesInit, this));
840 }
841
842 MediaGalleriesScanResultController*
843 MediaGalleriesAddScanResultsFunction::MakeDialog(
844 content::WebContents* web_contents,
845 const extensions::Extension& extension,
846 const base::Closure& on_finish) {
847 // Controller will delete itself.
848 return new MediaGalleriesScanResultController(web_contents, extension,
849 on_finish);
850 }
851
852 void MediaGalleriesAddScanResultsFunction::OnPreferencesInit() {
853 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
854 MediaGalleriesPreferences* preferences =
855 media_file_system_registry()->GetPreferences(GetProfile());
856 if (MediaGalleriesScanResultController::ScanResultCountForExtension(
857 preferences, extension()) == 0) {
858 GetAndReturnGalleries();
859 return;
860 }
861
862 WebContents* contents =
863 ChromeExtensionFunctionDetails(this).GetOriginWebContents();
864 if (!contents) {
865 SendResponse(false);
866 return;
867 }
868
869 base::Closure cb = base::Bind(
870 &MediaGalleriesAddScanResultsFunction::GetAndReturnGalleries, this);
871 MakeDialog(contents, *extension(), cb);
872 }
873
874 void MediaGalleriesAddScanResultsFunction::GetAndReturnGalleries() {
875 if (!render_frame_host()) {
876 ReturnGalleries(std::vector<MediaFileSystemInfo>());
877 return;
878 }
879 MediaFileSystemRegistry* registry = media_file_system_registry();
880 DCHECK(registry->GetPreferences(GetProfile())->IsInitialized());
881 registry->GetMediaFileSystemsForExtension(
882 GetSenderWebContents(), extension(),
883 base::Bind(&MediaGalleriesAddScanResultsFunction::ReturnGalleries, this));
884 }
885
886 void MediaGalleriesAddScanResultsFunction::ReturnGalleries(
887 const std::vector<MediaFileSystemInfo>& filesystems) {
888 scoped_ptr<base::ListValue> list(
889 ConstructFileSystemList(render_frame_host(), extension(), filesystems));
890 if (!list.get()) {
891 SendResponse(false);
892 return;
893 }
894
895 // The custom JS binding will use this list to create DOMFileSystem objects.
896 SetResult(list.release());
897 SendResponse(true);
898 }
899
900 ///////////////////////////////////////////////////////////////////////////////
901 // MediaGalleriesGetMetadataFunction // 697 // MediaGalleriesGetMetadataFunction //
902 /////////////////////////////////////////////////////////////////////////////// 698 ///////////////////////////////////////////////////////////////////////////////
903 MediaGalleriesGetMetadataFunction::~MediaGalleriesGetMetadataFunction() {} 699 MediaGalleriesGetMetadataFunction::~MediaGalleriesGetMetadataFunction() {}
904 700
905 bool MediaGalleriesGetMetadataFunction::RunAsync() { 701 bool MediaGalleriesGetMetadataFunction::RunAsync() {
906 media_galleries::UsageCount(media_galleries::GET_METADATA); 702 media_galleries::UsageCount(media_galleries::GET_METADATA);
907 std::string blob_uuid; 703 std::string blob_uuid;
908 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &blob_uuid)); 704 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &blob_uuid));
909 705
910 const base::Value* options_value = NULL; 706 const base::Value* options_value = NULL;
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); 1051 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this));
1256 return true; 1052 return true;
1257 } 1053 }
1258 1054
1259 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { 1055 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() {
1260 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); 1056 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id());
1261 SendResponse(true); 1057 SendResponse(true);
1262 } 1058 }
1263 1059
1264 } // namespace extensions 1060 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698