| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/media_gallery/media_file_system_registry.h" | 14 #include "chrome/browser/media_gallery/media_file_system_registry.h" |
| 15 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 16 #include "chrome/common/extensions/api/experimental_media_galleries.h" | 17 #include "chrome/common/extensions/api/experimental_media_galleries.h" |
| 17 #include "content/public/browser/child_process_security_policy.h" | 18 #include "content/public/browser/child_process_security_policy.h" |
| 18 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 19 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 | 22 |
| 22 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 23 #include "base/sys_string_conversions.h" | 24 #include "base/sys_string_conversions.h" |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 #if !defined(OS_MACOSX) | |
| 27 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" | |
| 28 #endif | |
| 29 | |
| 30 using content::WebContents; | 27 using content::WebContents; |
| 31 | 28 |
| 32 namespace extensions { | 29 namespace extensions { |
| 33 | 30 |
| 34 namespace { | 31 namespace { |
| 35 | 32 |
| 36 const char kInvalidInteractive[] = "Unknown value for interactive."; | 33 const char kInvalidInteractive[] = "Unknown value for interactive."; |
| 37 | 34 |
| 38 } // namespace | 35 } // namespace |
| 39 | 36 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 WebContents* contents = WebContents::FromRenderViewHost(render_view_host()); | 102 WebContents* contents = WebContents::FromRenderViewHost(render_view_host()); |
| 106 TabContents* tab_contents = | 103 TabContents* tab_contents = |
| 107 contents ? TabContents::FromWebContents(contents) : NULL; | 104 contents ? TabContents::FromWebContents(contents) : NULL; |
| 108 if (!tab_contents) { | 105 if (!tab_contents) { |
| 109 // TODO(estade): for now it just gives up, but it might be nice to first | 106 // TODO(estade): for now it just gives up, but it might be nice to first |
| 110 // attempt to find the active window for this extension. | 107 // attempt to find the active window for this extension. |
| 111 ReturnGalleries(); | 108 ReturnGalleries(); |
| 112 return; | 109 return; |
| 113 } | 110 } |
| 114 | 111 |
| 115 #if !defined(OS_MACOSX) | |
| 116 // Controller will delete itself. | 112 // Controller will delete itself. |
| 117 new chrome::MediaGalleriesDialogController( | 113 new chrome::MediaGalleriesDialogController( |
| 118 tab_contents, *GetExtension(), | 114 tab_contents, *GetExtension(), |
| 119 base::Bind(&MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries, | 115 base::Bind(&MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries, |
| 120 this)); | 116 this)); |
| 121 #else | |
| 122 // TODO(estade): implement dialog on Views and Cocoa. | |
| 123 ReturnGalleries(); | |
| 124 #endif | |
| 125 } | 117 } |
| 126 | 118 |
| 127 // MediaGalleriesAssembleMediaFileFunction ------------------------------------- | 119 // MediaGalleriesAssembleMediaFileFunction ------------------------------------- |
| 128 | 120 |
| 129 MediaGalleriesAssembleMediaFileFunction:: | 121 MediaGalleriesAssembleMediaFileFunction:: |
| 130 ~MediaGalleriesAssembleMediaFileFunction() {} | 122 ~MediaGalleriesAssembleMediaFileFunction() {} |
| 131 | 123 |
| 132 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { | 124 bool MediaGalleriesAssembleMediaFileFunction::RunImpl() { |
| 133 // TODO(vandebo) Update the metadata and return the new file. | 125 // TODO(vandebo) Update the metadata and return the new file. |
| 134 SetResult(Value::CreateNullValue()); | 126 SetResult(Value::CreateNullValue()); |
| 135 return true; | 127 return true; |
| 136 } | 128 } |
| 137 | 129 |
| 138 } // namespace extensions | 130 } // namespace extensions |
| OLD | NEW |