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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "apps/shell_window.h" | 13 #include "apps/app_window.h" |
14 #include "apps/shell_window_registry.h" | 14 #include "apps/app_window_registry.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "base/values.h" | 20 #include "base/values.h" |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 22 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
23 #include "chrome/browser/extensions/blob_reader.h" | 23 #include "chrome/browser/extensions/blob_reader.h" |
24 #include "chrome/browser/extensions/extension_tab_util.h" | 24 #include "chrome/browser/extensions/extension_tab_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 WebContents* GetWebContents(content::RenderViewHost* rvh, | 103 WebContents* GetWebContents(content::RenderViewHost* rvh, |
104 Profile* profile, | 104 Profile* profile, |
105 const std::string& app_id) { | 105 const std::string& app_id) { |
106 WebContents* contents = WebContents::FromRenderViewHost(rvh); | 106 WebContents* contents = WebContents::FromRenderViewHost(rvh); |
107 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 107 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
108 WebContentsModalDialogManager::FromWebContents(contents); | 108 WebContentsModalDialogManager::FromWebContents(contents); |
109 if (!web_contents_modal_dialog_manager) { | 109 if (!web_contents_modal_dialog_manager) { |
110 // If there is no WebContentsModalDialogManager, then this contents is | 110 // If there is no WebContentsModalDialogManager, then this contents is |
111 // probably the background page for an app. Try to find a shell window to | 111 // probably the background page for an app. Try to find a app window to |
112 // host the dialog. | 112 // host the dialog. |
113 apps::ShellWindow* window = apps::ShellWindowRegistry::Get( | 113 apps::AppWindow* window = apps::AppWindowRegistry::Get(profile) |
114 profile)->GetCurrentShellWindowForApp(app_id); | 114 ->GetCurrentAppWindowForApp(app_id); |
115 contents = window ? window->web_contents() : NULL; | 115 contents = window ? window->web_contents() : NULL; |
116 } | 116 } |
117 return contents; | 117 return contents; |
118 } | 118 } |
119 | 119 |
120 base::ListValue* ConstructFileSystemList( | 120 base::ListValue* ConstructFileSystemList( |
121 content::RenderViewHost* rvh, | 121 content::RenderViewHost* rvh, |
122 const Extension* extension, | 122 const Extension* extension, |
123 const std::vector<MediaFileSystemInfo>& filesystems) { | 123 const std::vector<MediaFileSystemInfo>& filesystems) { |
124 if (!rvh) | 124 if (!rvh) |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 if (mime_type_sniffed) | 798 if (mime_type_sniffed) |
799 metadata.mime_type = mime_type; | 799 metadata.mime_type = mime_type; |
800 | 800 |
801 // TODO(tommycli): Kick off SafeMediaMetadataParser if |mime_type_only| false. | 801 // TODO(tommycli): Kick off SafeMediaMetadataParser if |mime_type_only| false. |
802 | 802 |
803 SetResult(metadata.ToValue().release()); | 803 SetResult(metadata.ToValue().release()); |
804 SendResponse(true); | 804 SendResponse(true); |
805 } | 805 } |
806 | 806 |
807 } // namespace extensions | 807 } // namespace extensions |
OLD | NEW |