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