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

Unified Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc

Issue 12091054: Media Galleries: Always call MediaFileSystemRegistry::GetMediaFileSystemsForExtension() before show… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
===================================================================
--- chrome/browser/extensions/api/media_galleries/media_galleries_api.cc (revision 179445)
+++ chrome/browser/extensions/api/media_galleries/media_galleries_api.cc (working copy)
@@ -38,6 +38,7 @@
using chrome::MediaFileSystemInfo;
using chrome::MediaFileSystemRegistry;
+using chrome::MediaFileSystemsCallback;
using content::ChildProcessSecurityPolicy;
using content::WebContents;
@@ -87,17 +88,23 @@
}
switch (interactive) {
- case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES:
- ShowDialog();
+ case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES: {
+ MediaFileSystemsCallback cb = base::Bind(
+ &MediaGalleriesGetMediaFileSystemsFunction::AlwaysShowDialog, this);
+ MediaFileSystemRegistry* registry =
+ g_browser_process->media_file_system_registry();
+ registry->GetMediaFileSystemsForExtension(
vandebo (ex-Chrome) 2013/01/30 17:47:30 Since this isn't strictly required, add a comment
Lei Zhang 2013/01/30 21:00:47 Done.
+ render_view_host(), GetExtension(), cb);
return true;
+ }
case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_IF_NEEDED: {
+ MediaFileSystemsCallback cb = base::Bind(
+ &MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries,
vandebo (ex-Chrome) 2013/01/30 17:47:30 Can you rearrange this code to eliminate the code
Lei Zhang 2013/01/30 21:00:47 Done.
+ this);
MediaFileSystemRegistry* registry =
g_browser_process->media_file_system_registry();
registry->GetMediaFileSystemsForExtension(
- render_view_host(), GetExtension(), base::Bind(
- &MediaGalleriesGetMediaFileSystemsFunction::
- ShowDialogIfNoGalleries,
- this));
+ render_view_host(), GetExtension(), cb);
return true;
}
case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO:
@@ -110,6 +117,11 @@
return false;
}
+void MediaGalleriesGetMediaFileSystemsFunction::AlwaysShowDialog(
+ const std::vector<MediaFileSystemInfo>& /*filesystems*/) {
+ ShowDialog();
vandebo (ex-Chrome) 2013/01/30 17:47:30 Or maybe the comment should go here.
+}
+
void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries(
const std::vector<MediaFileSystemInfo>& filesystems) {
if (filesystems.empty())

Powered by Google App Engine
This is Rietveld 408576698