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 #include "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 75 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
76 #include "chrome/browser/tab_contents/tab_util.h" | 76 #include "chrome/browser/tab_contents/tab_util.h" |
77 #include "chrome/browser/tracing/chrome_tracing_delegate.h" | 77 #include "chrome/browser/tracing/chrome_tracing_delegate.h" |
78 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" | 78 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" |
79 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 79 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
80 #include "chrome/browser/ui/chrome_select_file_policy.h" | 80 #include "chrome/browser/ui/chrome_select_file_policy.h" |
81 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 81 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
82 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" | 82 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
83 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 83 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
84 #include "chrome/browser/ui/webui/log_web_ui_url.h" | 84 #include "chrome/browser/ui/webui/log_web_ui_url.h" |
| 85 #include "chrome/browser/usb/web_usb_permission_provider.h" |
85 #include "chrome/common/channel_info.h" | 86 #include "chrome/common/channel_info.h" |
86 #include "chrome/common/chrome_constants.h" | 87 #include "chrome/common/chrome_constants.h" |
87 #include "chrome/common/chrome_paths.h" | 88 #include "chrome/common/chrome_paths.h" |
88 #include "chrome/common/chrome_switches.h" | 89 #include "chrome/common/chrome_switches.h" |
89 #include "chrome/common/env_vars.h" | 90 #include "chrome/common/env_vars.h" |
90 #include "chrome/common/logging_chrome.h" | 91 #include "chrome/common/logging_chrome.h" |
91 #include "chrome/common/pepper_permission_util.h" | 92 #include "chrome/common/pepper_permission_util.h" |
92 #include "chrome/common/pref_names.h" | 93 #include "chrome/common/pref_names.h" |
93 #include "chrome/common/render_messages.h" | 94 #include "chrome/common/render_messages.h" |
94 #include "chrome/common/url_constants.h" | 95 #include "chrome/common/url_constants.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 #include "content/public/browser/render_view_host.h" | 127 #include "content/public/browser/render_view_host.h" |
127 #include "content/public/browser/resource_context.h" | 128 #include "content/public/browser/resource_context.h" |
128 #include "content/public/browser/site_instance.h" | 129 #include "content/public/browser/site_instance.h" |
129 #include "content/public/browser/web_contents.h" | 130 #include "content/public/browser/web_contents.h" |
130 #include "content/public/common/child_process_host.h" | 131 #include "content/public/common/child_process_host.h" |
131 #include "content/public/common/content_descriptors.h" | 132 #include "content/public/common/content_descriptors.h" |
132 #include "content/public/common/sandbox_type.h" | 133 #include "content/public/common/sandbox_type.h" |
133 #include "content/public/common/service_registry.h" | 134 #include "content/public/common/service_registry.h" |
134 #include "content/public/common/url_utils.h" | 135 #include "content/public/common/url_utils.h" |
135 #include "content/public/common/web_preferences.h" | 136 #include "content/public/common/web_preferences.h" |
136 #include "device/devices_app/public/cpp/constants.h" | 137 #include "device/devices_app/usb/device_manager_impl.h" |
137 #include "device/devices_app/public/cpp/devices_app_factory.h" | |
138 #include "gin/v8_initializer.h" | 138 #include "gin/v8_initializer.h" |
139 #include "mojo/application/public/cpp/application_delegate.h" | 139 #include "mojo/application/public/cpp/application_delegate.h" |
140 #include "net/base/mime_util.h" | 140 #include "net/base/mime_util.h" |
141 #include "net/cookies/canonical_cookie.h" | 141 #include "net/cookies/canonical_cookie.h" |
142 #include "net/cookies/cookie_options.h" | 142 #include "net/cookies/cookie_options.h" |
143 #include "net/ssl/ssl_cert_request_info.h" | 143 #include "net/ssl/ssl_cert_request_info.h" |
144 #include "ppapi/host/ppapi_host.h" | 144 #include "ppapi/host/ppapi_host.h" |
145 #include "storage/browser/fileapi/external_mount_points.h" | 145 #include "storage/browser/fileapi/external_mount_points.h" |
146 #include "ui/base/l10n/l10n_util.h" | 146 #include "ui/base/l10n/l10n_util.h" |
147 #include "ui/base/resource/resource_bundle.h" | 147 #include "ui/base/resource/resource_bundle.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 #endif | 254 #endif |
255 | 255 |
256 #if defined(ENABLE_WEBRTC) | 256 #if defined(ENABLE_WEBRTC) |
257 #include "chrome/browser/media/webrtc_logging_handler_host.h" | 257 #include "chrome/browser/media/webrtc_logging_handler_host.h" |
258 #endif | 258 #endif |
259 | 259 |
260 #if defined(ENABLE_MEDIA_ROUTER) | 260 #if defined(ENABLE_MEDIA_ROUTER) |
261 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" | 261 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" |
262 #endif | 262 #endif |
263 | 263 |
264 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
265 #include "chrome/browser/usb/web_usb_permission_provider.h" | |
266 #endif | |
267 | |
268 using base::FileDescriptor; | 264 using base::FileDescriptor; |
269 using blink::WebWindowFeatures; | 265 using blink::WebWindowFeatures; |
270 using content::AccessTokenStore; | 266 using content::AccessTokenStore; |
271 using content::BrowserThread; | 267 using content::BrowserThread; |
272 using content::BrowserURLHandler; | 268 using content::BrowserURLHandler; |
273 using content::ChildProcessSecurityPolicy; | 269 using content::ChildProcessSecurityPolicy; |
274 using content::QuotaPermissionContext; | 270 using content::QuotaPermissionContext; |
275 using content::RenderFrameHost; | 271 using content::RenderFrameHost; |
276 using content::RenderViewHost; | 272 using content::RenderViewHost; |
277 using content::ResourceType; | 273 using content::ResourceType; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 612 |
617 rules->script_rules.push_back( | 613 rules->script_rules.push_back( |
618 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 614 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
619 ContentSettingsPattern::Wildcard(), | 615 ContentSettingsPattern::Wildcard(), |
620 CONTENT_SETTING_ALLOW, | 616 CONTENT_SETTING_ALLOW, |
621 std::string(), | 617 std::string(), |
622 incognito)); | 618 incognito)); |
623 } | 619 } |
624 #endif // defined(ENABLE_EXTENSIONS) | 620 #endif // defined(ENABLE_EXTENSIONS) |
625 | 621 |
| 622 void CreateUsbDeviceManager( |
| 623 RenderFrameHost* render_frame_host, |
| 624 mojo::InterfaceRequest<device::usb::DeviceManager> request) { |
| 625 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 626 device::usb::PermissionProviderPtr permission_provider; |
| 627 WebUSBPermissionProvider::Create(render_frame_host, |
| 628 mojo::GetProxy(&permission_provider)); |
| 629 device::usb::DeviceManagerImpl::Create(permission_provider.Pass(), |
| 630 request.Pass()); |
| 631 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 632 } |
| 633 |
626 } // namespace | 634 } // namespace |
627 | 635 |
628 ChromeContentBrowserClient::ChromeContentBrowserClient() | 636 ChromeContentBrowserClient::ChromeContentBrowserClient() |
629 : | 637 : |
630 weak_factory_(this) { | 638 weak_factory_(this) { |
631 #if defined(ENABLE_PLUGINS) | 639 #if defined(ENABLE_PLUGINS) |
632 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 640 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
633 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 641 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
634 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 642 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
635 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 643 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 #endif | 2545 #endif |
2538 | 2546 |
2539 void ChromeContentBrowserClient::RegisterFrameMojoShellServices( | 2547 void ChromeContentBrowserClient::RegisterFrameMojoShellServices( |
2540 content::ServiceRegistry* registry, | 2548 content::ServiceRegistry* registry, |
2541 content::RenderFrameHost* render_frame_host) { | 2549 content::RenderFrameHost* render_frame_host) { |
2542 #if defined(OS_CHROMEOS) | 2550 #if defined(OS_CHROMEOS) |
2543 registry->AddService( | 2551 registry->AddService( |
2544 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create, | 2552 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create, |
2545 render_frame_host)); | 2553 render_frame_host)); |
2546 #endif | 2554 #endif |
2547 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
2548 registry->AddService( | |
2549 base::Bind(&WebUSBPermissionProvider::Create, render_frame_host)); | |
2550 #endif | |
2551 } | 2555 } |
2552 | 2556 |
2553 void ChromeContentBrowserClient::RegisterInProcessMojoApplications( | 2557 void ChromeContentBrowserClient::RegisterRenderFrameMojoServices( |
2554 StaticMojoApplicationMap* apps) { | 2558 content::ServiceRegistry* registry, |
2555 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 2559 content::RenderFrameHost* render_frame_host) { |
2556 apps->insert(std::make_pair(GURL(device::kDevicesMojoAppUrl), | 2560 registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host)); |
2557 base::Bind(&device::DevicesAppFactory::CreateApp, | |
2558 base::ThreadTaskRunnerHandle::Get()))); | |
2559 #endif | |
2560 } | 2561 } |
2561 | 2562 |
2562 void ChromeContentBrowserClient::OpenURL( | 2563 void ChromeContentBrowserClient::OpenURL( |
2563 content::BrowserContext* browser_context, | 2564 content::BrowserContext* browser_context, |
2564 const content::OpenURLParams& params, | 2565 const content::OpenURLParams& params, |
2565 const base::Callback<void(content::WebContents*)>& callback) { | 2566 const base::Callback<void(content::WebContents*)>& callback) { |
2566 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2567 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2567 | 2568 |
2568 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 2569 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
2569 chrome::NavigateParams nav_params( | 2570 chrome::NavigateParams nav_params( |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 if (channel <= kMaxDisableEncryptionChannel) { | 2676 if (channel <= kMaxDisableEncryptionChannel) { |
2676 static const char* const kWebRtcDevSwitchNames[] = { | 2677 static const char* const kWebRtcDevSwitchNames[] = { |
2677 switches::kDisableWebRtcEncryption, | 2678 switches::kDisableWebRtcEncryption, |
2678 }; | 2679 }; |
2679 to_command_line->CopySwitchesFrom(from_command_line, | 2680 to_command_line->CopySwitchesFrom(from_command_line, |
2680 kWebRtcDevSwitchNames, | 2681 kWebRtcDevSwitchNames, |
2681 arraysize(kWebRtcDevSwitchNames)); | 2682 arraysize(kWebRtcDevSwitchNames)); |
2682 } | 2683 } |
2683 } | 2684 } |
2684 #endif // defined(ENABLE_WEBRTC) | 2685 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |