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

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

Issue 1371793004: Provide the DeviceManager service to the renderer directly, no app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_permission
Patch Set: Addresses rockot@'s feedback. 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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #include "content/public/browser/render_view_host.h" 126 #include "content/public/browser/render_view_host.h"
127 #include "content/public/browser/resource_context.h" 127 #include "content/public/browser/resource_context.h"
128 #include "content/public/browser/site_instance.h" 128 #include "content/public/browser/site_instance.h"
129 #include "content/public/browser/web_contents.h" 129 #include "content/public/browser/web_contents.h"
130 #include "content/public/common/child_process_host.h" 130 #include "content/public/common/child_process_host.h"
131 #include "content/public/common/content_descriptors.h" 131 #include "content/public/common/content_descriptors.h"
132 #include "content/public/common/sandbox_type.h" 132 #include "content/public/common/sandbox_type.h"
133 #include "content/public/common/service_registry.h" 133 #include "content/public/common/service_registry.h"
134 #include "content/public/common/url_utils.h" 134 #include "content/public/common/url_utils.h"
135 #include "content/public/common/web_preferences.h" 135 #include "content/public/common/web_preferences.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" 136 #include "gin/v8_initializer.h"
139 #include "mojo/application/public/cpp/application_delegate.h" 137 #include "mojo/application/public/cpp/application_delegate.h"
140 #include "net/base/mime_util.h" 138 #include "net/base/mime_util.h"
141 #include "net/cookies/canonical_cookie.h" 139 #include "net/cookies/canonical_cookie.h"
142 #include "net/cookies/cookie_options.h" 140 #include "net/cookies/cookie_options.h"
143 #include "net/ssl/ssl_cert_request_info.h" 141 #include "net/ssl/ssl_cert_request_info.h"
144 #include "ppapi/host/ppapi_host.h" 142 #include "ppapi/host/ppapi_host.h"
145 #include "storage/browser/fileapi/external_mount_points.h" 143 #include "storage/browser/fileapi/external_mount_points.h"
146 #include "ui/base/l10n/l10n_util.h" 144 #include "ui/base/l10n/l10n_util.h"
147 #include "ui/base/resource/resource_bundle.h" 145 #include "ui/base/resource/resource_bundle.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 #if defined(ENABLE_WEBRTC) 254 #if defined(ENABLE_WEBRTC)
257 #include "chrome/browser/media/webrtc_logging_handler_host.h" 255 #include "chrome/browser/media/webrtc_logging_handler_host.h"
258 #endif 256 #endif
259 257
260 #if defined(ENABLE_MEDIA_ROUTER) 258 #if defined(ENABLE_MEDIA_ROUTER)
261 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" 259 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
262 #endif 260 #endif
263 261
264 #if !defined(OS_ANDROID) && !defined(OS_IOS) 262 #if !defined(OS_ANDROID) && !defined(OS_IOS)
265 #include "chrome/browser/usb/web_usb_permission_provider.h" 263 #include "chrome/browser/usb/web_usb_permission_provider.h"
264 #include "device/devices_app/usb/device_manager_impl.h"
266 #endif 265 #endif
267 266
268 using base::FileDescriptor; 267 using base::FileDescriptor;
269 using blink::WebWindowFeatures; 268 using blink::WebWindowFeatures;
270 using content::AccessTokenStore; 269 using content::AccessTokenStore;
271 using content::BrowserThread; 270 using content::BrowserThread;
272 using content::BrowserURLHandler; 271 using content::BrowserURLHandler;
273 using content::ChildProcessSecurityPolicy; 272 using content::ChildProcessSecurityPolicy;
274 using content::QuotaPermissionContext; 273 using content::QuotaPermissionContext;
275 using content::RenderFrameHost; 274 using content::RenderFrameHost;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 615
617 rules->script_rules.push_back( 616 rules->script_rules.push_back(
618 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), 617 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(),
619 ContentSettingsPattern::Wildcard(), 618 ContentSettingsPattern::Wildcard(),
620 CONTENT_SETTING_ALLOW, 619 CONTENT_SETTING_ALLOW,
621 std::string(), 620 std::string(),
622 incognito)); 621 incognito));
623 } 622 }
624 #endif // defined(ENABLE_EXTENSIONS) 623 #endif // defined(ENABLE_EXTENSIONS)
625 624
625 void CreateUsbDeviceManager(
626 RenderFrameHost* render_frame_host,
627 mojo::InterfaceRequest<device::usb::DeviceManager> request) {
Ken Rockot(use gerrit already) 2015/09/29 00:22:53 you should include "device/usb/public/interfaces/d
628 #if !defined(OS_ANDROID) && !defined(OS_IOS)
629 device::usb::PermissionProviderPtr permission_provider;
630 WebUSBPermissionProvider::Create(render_frame_host,
631 mojo::GetProxy(&permission_provider));
632 device::usb::DeviceManagerImpl::Create(permission_provider.Pass(),
633 request.Pass());
634 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
635 }
636
626 } // namespace 637 } // namespace
627 638
628 ChromeContentBrowserClient::ChromeContentBrowserClient() 639 ChromeContentBrowserClient::ChromeContentBrowserClient()
629 : 640 :
630 weak_factory_(this) { 641 weak_factory_(this) {
631 #if defined(ENABLE_PLUGINS) 642 #if defined(ENABLE_PLUGINS)
632 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) 643 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i)
633 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); 644 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]);
634 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) 645 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i)
635 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); 646 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]);
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 #endif 2548 #endif
2538 2549
2539 void ChromeContentBrowserClient::RegisterFrameMojoShellServices( 2550 void ChromeContentBrowserClient::RegisterFrameMojoShellServices(
2540 content::ServiceRegistry* registry, 2551 content::ServiceRegistry* registry,
2541 content::RenderFrameHost* render_frame_host) { 2552 content::RenderFrameHost* render_frame_host) {
2542 #if defined(OS_CHROMEOS) 2553 #if defined(OS_CHROMEOS)
2543 registry->AddService( 2554 registry->AddService(
2544 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create, 2555 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create,
2545 render_frame_host)); 2556 render_frame_host));
2546 #endif 2557 #endif
2547 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2548 registry->AddService(
2549 base::Bind(&WebUSBPermissionProvider::Create, render_frame_host));
2550 #endif
2551 } 2558 }
2552 2559
2553 void ChromeContentBrowserClient::RegisterInProcessMojoApplications( 2560 void ChromeContentBrowserClient::RegisterRenderFrameMojoServices(
2554 StaticMojoApplicationMap* apps) { 2561 content::ServiceRegistry* registry,
2555 #if !defined(OS_ANDROID) && !defined(OS_IOS) 2562 content::RenderFrameHost* render_frame_host) {
2556 apps->insert(std::make_pair(GURL(device::kDevicesMojoAppUrl), 2563 registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host));
2557 base::Bind(&device::DevicesAppFactory::CreateApp,
2558 base::ThreadTaskRunnerHandle::Get())));
2559 #endif
2560 } 2564 }
2561 2565
2562 void ChromeContentBrowserClient::OpenURL( 2566 void ChromeContentBrowserClient::OpenURL(
2563 content::BrowserContext* browser_context, 2567 content::BrowserContext* browser_context,
2564 const content::OpenURLParams& params, 2568 const content::OpenURLParams& params,
2565 const base::Callback<void(content::WebContents*)>& callback) { 2569 const base::Callback<void(content::WebContents*)>& callback) {
2566 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2570 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2567 2571
2568 #if !defined(OS_ANDROID) && !defined(OS_IOS) 2572 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2569 chrome::NavigateParams nav_params( 2573 chrome::NavigateParams nav_params(
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 if (channel <= kMaxDisableEncryptionChannel) { 2679 if (channel <= kMaxDisableEncryptionChannel) {
2676 static const char* const kWebRtcDevSwitchNames[] = { 2680 static const char* const kWebRtcDevSwitchNames[] = {
2677 switches::kDisableWebRtcEncryption, 2681 switches::kDisableWebRtcEncryption,
2678 }; 2682 };
2679 to_command_line->CopySwitchesFrom(from_command_line, 2683 to_command_line->CopySwitchesFrom(from_command_line,
2680 kWebRtcDevSwitchNames, 2684 kWebRtcDevSwitchNames,
2681 arraysize(kWebRtcDevSwitchNames)); 2685 arraysize(kWebRtcDevSwitchNames));
2682 } 2686 }
2683 } 2687 }
2684 #endif // defined(ENABLE_WEBRTC) 2688 #endif // defined(ENABLE_WEBRTC)
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698