Chromium Code Reviews| 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()) |