| OLD | NEW | 
|    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 <set> |    9 #include <set> | 
|   10 #include <string> |   10 #include <string> | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   69     ~MediaGalleriesGetMediaFileSystemsFunction() {} |   69     ~MediaGalleriesGetMediaFileSystemsFunction() {} | 
|   70  |   70  | 
|   71 bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() { |   71 bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() { | 
|   72   if (!ApiIsAccessible(&error_)) |   72   if (!ApiIsAccessible(&error_)) | 
|   73     return false; |   73     return false; | 
|   74  |   74  | 
|   75   scoped_ptr<GetMediaFileSystems::Params> params( |   75   scoped_ptr<GetMediaFileSystems::Params> params( | 
|   76       GetMediaFileSystems::Params::Create(*args_)); |   76       GetMediaFileSystems::Params::Create(*args_)); | 
|   77   EXTENSION_FUNCTION_VALIDATE(params.get()); |   77   EXTENSION_FUNCTION_VALIDATE(params.get()); | 
|   78   MediaGalleries::GetMediaFileSystemsInteractivity interactive = |   78   MediaGalleries::GetMediaFileSystemsInteractivity interactive = | 
|   79       MediaGalleries::MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO; |   79       MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO; | 
|   80   if (params->details.get() && params->details->interactive != MediaGalleries:: |   80   if (params->details.get() && params->details->interactive != MediaGalleries:: | 
|   81          MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE) { |   81          GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE) { | 
|   82     interactive = params->details->interactive; |   82     interactive = params->details->interactive; | 
|   83   } |   83   } | 
|   84  |   84  | 
|   85   switch (interactive) { |   85   switch (interactive) { | 
|   86     case MediaGalleries:: |   86     case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES: | 
|   87         MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_YES: |  | 
|   88       ShowDialog(); |   87       ShowDialog(); | 
|   89       return true; |   88       return true; | 
|   90     case MediaGalleries:: |   89     case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_IF_NEEDED: { | 
|   91         MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_IF_NEEDED: { |  | 
|   92       MediaFileSystemRegistry* registry = |   90       MediaFileSystemRegistry* registry = | 
|   93           g_browser_process->media_file_system_registry(); |   91           g_browser_process->media_file_system_registry(); | 
|   94       registry->GetMediaFileSystemsForExtension( |   92       registry->GetMediaFileSystemsForExtension( | 
|   95           render_view_host(), GetExtension(), base::Bind( |   93           render_view_host(), GetExtension(), base::Bind( | 
|   96               &MediaGalleriesGetMediaFileSystemsFunction:: |   94               &MediaGalleriesGetMediaFileSystemsFunction:: | 
|   97                   ShowDialogIfNoGalleries, |   95                   ShowDialogIfNoGalleries, | 
|   98               this)); |   96               this)); | 
|   99       return true; |   97       return true; | 
|  100     } |   98     } | 
|  101     case MediaGalleries:: |   99     case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO: | 
|  102         MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NO: |  | 
|  103       GetAndReturnGalleries(); |  100       GetAndReturnGalleries(); | 
|  104       return true; |  101       return true; | 
|  105     case MediaGalleries:: |  102     case MediaGalleries::GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE: | 
|  106         MEDIA_GALLERIES_GET_MEDIA_FILE_SYSTEMS_INTERACTIVITY_NONE: |  | 
|  107       NOTREACHED(); |  103       NOTREACHED(); | 
|  108   } |  104   } | 
|  109   error_ = kInvalidInteractive; |  105   error_ = kInvalidInteractive; | 
|  110   return false; |  106   return false; | 
|  111 } |  107 } | 
|  112  |  108  | 
|  113 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries( |  109 void MediaGalleriesGetMediaFileSystemsFunction::ShowDialogIfNoGalleries( | 
|  114     const std::vector<MediaFileSystemInfo>& filesystems) { |  110     const std::vector<MediaFileSystemInfo>& filesystems) { | 
|  115   if (filesystems.empty()) |  111   if (filesystems.empty()) | 
|  116     ShowDialog(); |  112     ShowDialog(); | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  204 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { |  200 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { | 
|  205   if (!ApiIsAccessible(&error_)) |  201   if (!ApiIsAccessible(&error_)) | 
|  206     return false; |  202     return false; | 
|  207  |  203  | 
|  208   // TODO(vandebo) Update the metadata and return the new file. |  204   // TODO(vandebo) Update the metadata and return the new file. | 
|  209   SetResult(Value::CreateNullValue()); |  205   SetResult(Value::CreateNullValue()); | 
|  210   return true; |  206   return true; | 
|  211 } |  207 } | 
|  212  |  208  | 
|  213 }  // namespace extensions |  209 }  // namespace extensions | 
| OLD | NEW |