Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1382383002: Revert of Provide the DeviceManager service to the renderer directly, no app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_permission
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
86 #include "chrome/common/channel_info.h" 85 #include "chrome/common/channel_info.h"
87 #include "chrome/common/chrome_constants.h" 86 #include "chrome/common/chrome_constants.h"
88 #include "chrome/common/chrome_paths.h" 87 #include "chrome/common/chrome_paths.h"
89 #include "chrome/common/chrome_switches.h" 88 #include "chrome/common/chrome_switches.h"
90 #include "chrome/common/env_vars.h" 89 #include "chrome/common/env_vars.h"
91 #include "chrome/common/logging_chrome.h" 90 #include "chrome/common/logging_chrome.h"
92 #include "chrome/common/pepper_permission_util.h" 91 #include "chrome/common/pepper_permission_util.h"
93 #include "chrome/common/pref_names.h" 92 #include "chrome/common/pref_names.h"
94 #include "chrome/common/render_messages.h" 93 #include "chrome/common/render_messages.h"
95 #include "chrome/common/url_constants.h" 94 #include "chrome/common/url_constants.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 #include "content/public/browser/render_view_host.h" 126 #include "content/public/browser/render_view_host.h"
128 #include "content/public/browser/resource_context.h" 127 #include "content/public/browser/resource_context.h"
129 #include "content/public/browser/site_instance.h" 128 #include "content/public/browser/site_instance.h"
130 #include "content/public/browser/web_contents.h" 129 #include "content/public/browser/web_contents.h"
131 #include "content/public/common/child_process_host.h" 130 #include "content/public/common/child_process_host.h"
132 #include "content/public/common/content_descriptors.h" 131 #include "content/public/common/content_descriptors.h"
133 #include "content/public/common/sandbox_type.h" 132 #include "content/public/common/sandbox_type.h"
134 #include "content/public/common/service_registry.h" 133 #include "content/public/common/service_registry.h"
135 #include "content/public/common/url_utils.h" 134 #include "content/public/common/url_utils.h"
136 #include "content/public/common/web_preferences.h" 135 #include "content/public/common/web_preferences.h"
137 #include "device/devices_app/usb/device_manager_impl.h" 136 #include "device/devices_app/public/cpp/constants.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
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
264 using base::FileDescriptor; 268 using base::FileDescriptor;
265 using blink::WebWindowFeatures; 269 using blink::WebWindowFeatures;
266 using content::AccessTokenStore; 270 using content::AccessTokenStore;
267 using content::BrowserThread; 271 using content::BrowserThread;
268 using content::BrowserURLHandler; 272 using content::BrowserURLHandler;
269 using content::ChildProcessSecurityPolicy; 273 using content::ChildProcessSecurityPolicy;
270 using content::QuotaPermissionContext; 274 using content::QuotaPermissionContext;
271 using content::RenderFrameHost; 275 using content::RenderFrameHost;
272 using content::RenderViewHost; 276 using content::RenderViewHost;
273 using content::ResourceType; 277 using content::ResourceType;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 616
613 rules->script_rules.push_back( 617 rules->script_rules.push_back(
614 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), 618 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(),
615 ContentSettingsPattern::Wildcard(), 619 ContentSettingsPattern::Wildcard(),
616 CONTENT_SETTING_ALLOW, 620 CONTENT_SETTING_ALLOW,
617 std::string(), 621 std::string(),
618 incognito)); 622 incognito));
619 } 623 }
620 #endif // defined(ENABLE_EXTENSIONS) 624 #endif // defined(ENABLE_EXTENSIONS)
621 625
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
634 } // namespace 626 } // namespace
635 627
636 ChromeContentBrowserClient::ChromeContentBrowserClient() 628 ChromeContentBrowserClient::ChromeContentBrowserClient()
637 : 629 :
638 weak_factory_(this) { 630 weak_factory_(this) {
639 #if defined(ENABLE_PLUGINS) 631 #if defined(ENABLE_PLUGINS)
640 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) 632 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i)
641 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); 633 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]);
642 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) 634 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i)
643 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); 635 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]);
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 #endif 2537 #endif
2546 2538
2547 void ChromeContentBrowserClient::RegisterFrameMojoShellServices( 2539 void ChromeContentBrowserClient::RegisterFrameMojoShellServices(
2548 content::ServiceRegistry* registry, 2540 content::ServiceRegistry* registry,
2549 content::RenderFrameHost* render_frame_host) { 2541 content::RenderFrameHost* render_frame_host) {
2550 #if defined(OS_CHROMEOS) 2542 #if defined(OS_CHROMEOS)
2551 registry->AddService( 2543 registry->AddService(
2552 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create, 2544 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create,
2553 render_frame_host)); 2545 render_frame_host));
2554 #endif 2546 #endif
2547 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2548 registry->AddService(
2549 base::Bind(&WebUSBPermissionProvider::Create, render_frame_host));
2550 #endif
2555 } 2551 }
2556 2552
2557 void ChromeContentBrowserClient::RegisterRenderFrameMojoServices( 2553 void ChromeContentBrowserClient::RegisterInProcessMojoApplications(
2558 content::ServiceRegistry* registry, 2554 StaticMojoApplicationMap* apps) {
2559 content::RenderFrameHost* render_frame_host) { 2555 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2560 registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host)); 2556 apps->insert(std::make_pair(GURL(device::kDevicesMojoAppUrl),
2557 base::Bind(&device::DevicesAppFactory::CreateApp,
2558 base::ThreadTaskRunnerHandle::Get())));
2559 #endif
2561 } 2560 }
2562 2561
2563 void ChromeContentBrowserClient::OpenURL( 2562 void ChromeContentBrowserClient::OpenURL(
2564 content::BrowserContext* browser_context, 2563 content::BrowserContext* browser_context,
2565 const content::OpenURLParams& params, 2564 const content::OpenURLParams& params,
2566 const base::Callback<void(content::WebContents*)>& callback) { 2565 const base::Callback<void(content::WebContents*)>& callback) {
2567 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2566 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2568 2567
2569 #if !defined(OS_ANDROID) && !defined(OS_IOS) 2568 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2570 chrome::NavigateParams nav_params( 2569 chrome::NavigateParams nav_params(
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 if (channel <= kMaxDisableEncryptionChannel) { 2675 if (channel <= kMaxDisableEncryptionChannel) {
2677 static const char* const kWebRtcDevSwitchNames[] = { 2676 static const char* const kWebRtcDevSwitchNames[] = {
2678 switches::kDisableWebRtcEncryption, 2677 switches::kDisableWebRtcEncryption,
2679 }; 2678 };
2680 to_command_line->CopySwitchesFrom(from_command_line, 2679 to_command_line->CopySwitchesFrom(from_command_line,
2681 kWebRtcDevSwitchNames, 2680 kWebRtcDevSwitchNames,
2682 arraysize(kWebRtcDevSwitchNames)); 2681 arraysize(kWebRtcDevSwitchNames));
2683 } 2682 }
2684 } 2683 }
2685 #endif // defined(ENABLE_WEBRTC) 2684 #endif // defined(ENABLE_WEBRTC)
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698