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

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: Fix header inclusion in chrome_content_browser_client.cc. 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "content/public/browser/render_view_host.h" 125 #include "content/public/browser/render_view_host.h"
126 #include "content/public/browser/resource_context.h" 126 #include "content/public/browser/resource_context.h"
127 #include "content/public/browser/site_instance.h" 127 #include "content/public/browser/site_instance.h"
128 #include "content/public/browser/web_contents.h" 128 #include "content/public/browser/web_contents.h"
129 #include "content/public/common/child_process_host.h" 129 #include "content/public/common/child_process_host.h"
130 #include "content/public/common/content_descriptors.h" 130 #include "content/public/common/content_descriptors.h"
131 #include "content/public/common/sandbox_type.h" 131 #include "content/public/common/sandbox_type.h"
132 #include "content/public/common/service_registry.h" 132 #include "content/public/common/service_registry.h"
133 #include "content/public/common/url_utils.h" 133 #include "content/public/common/url_utils.h"
134 #include "content/public/common/web_preferences.h" 134 #include "content/public/common/web_preferences.h"
135 #include "device/devices_app/public/cpp/constants.h"
136 #include "device/devices_app/public/cpp/devices_app_factory.h"
137 #include "gin/v8_initializer.h" 135 #include "gin/v8_initializer.h"
138 #include "mojo/application/public/cpp/application_delegate.h" 136 #include "mojo/application/public/cpp/application_delegate.h"
139 #include "net/base/mime_util.h" 137 #include "net/base/mime_util.h"
140 #include "net/cookies/canonical_cookie.h" 138 #include "net/cookies/canonical_cookie.h"
141 #include "net/cookies/cookie_options.h" 139 #include "net/cookies/cookie_options.h"
142 #include "net/ssl/ssl_cert_request_info.h" 140 #include "net/ssl/ssl_cert_request_info.h"
143 #include "ppapi/host/ppapi_host.h" 141 #include "ppapi/host/ppapi_host.h"
144 #include "storage/browser/fileapi/external_mount_points.h" 142 #include "storage/browser/fileapi/external_mount_points.h"
145 #include "ui/base/l10n/l10n_util.h" 143 #include "ui/base/l10n/l10n_util.h"
146 #include "ui/base/resource/resource_bundle.h" 144 #include "ui/base/resource/resource_bundle.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #if defined(ENABLE_WEBRTC) 253 #if defined(ENABLE_WEBRTC)
256 #include "chrome/browser/media/webrtc_logging_handler_host.h" 254 #include "chrome/browser/media/webrtc_logging_handler_host.h"
257 #endif 255 #endif
258 256
259 #if defined(ENABLE_MEDIA_ROUTER) 257 #if defined(ENABLE_MEDIA_ROUTER)
260 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" 258 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
261 #endif 259 #endif
262 260
263 #if !defined(OS_ANDROID) && !defined(OS_IOS) 261 #if !defined(OS_ANDROID) && !defined(OS_IOS)
264 #include "chrome/browser/usb/web_usb_permission_provider.h" 262 #include "chrome/browser/usb/web_usb_permission_provider.h"
263 #include "device/devices_app/usb/device_manager_impl.h"
265 #endif 264 #endif
266 265
267 using base::FileDescriptor; 266 using base::FileDescriptor;
268 using blink::WebWindowFeatures; 267 using blink::WebWindowFeatures;
269 using content::AccessTokenStore; 268 using content::AccessTokenStore;
270 using content::BrowserThread; 269 using content::BrowserThread;
271 using content::BrowserURLHandler; 270 using content::BrowserURLHandler;
272 using content::ChildProcessSecurityPolicy; 271 using content::ChildProcessSecurityPolicy;
273 using content::QuotaPermissionContext; 272 using content::QuotaPermissionContext;
274 using content::RenderFrameHost; 273 using content::RenderFrameHost;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 614
616 rules->script_rules.push_back( 615 rules->script_rules.push_back(
617 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), 616 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(),
618 ContentSettingsPattern::Wildcard(), 617 ContentSettingsPattern::Wildcard(),
619 CONTENT_SETTING_ALLOW, 618 CONTENT_SETTING_ALLOW,
620 std::string(), 619 std::string(),
621 incognito)); 620 incognito));
622 } 621 }
623 #endif // defined(ENABLE_EXTENSIONS) 622 #endif // defined(ENABLE_EXTENSIONS)
624 623
624 #if !defined(OS_ANDROID) && !defined(OS_IOS)
Ken Rockot(use gerrit already) 2015/09/28 22:23:14 nit: you could simplify slightly by removing the p
Reilly Grant (use Gerrit) 2015/09/28 23:32:00 Done.
625 void CreateUsbDeviceManager(
626 RenderFrameHost* render_frame_host,
627 mojo::InterfaceRequest<device::usb::DeviceManager> request) {
628 device::usb::PermissionProviderPtr permission_provider;
629 WebUSBPermissionProvider::Create(render_frame_host,
630 mojo::GetProxy(&permission_provider));
631 device::usb::DeviceManagerImpl::Create(permission_provider.Pass(),
632 request.Pass());
633 }
634 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
635
625 } // namespace 636 } // namespace
626 637
627 ChromeContentBrowserClient::ChromeContentBrowserClient() 638 ChromeContentBrowserClient::ChromeContentBrowserClient()
628 : 639 :
629 weak_factory_(this) { 640 weak_factory_(this) {
630 #if defined(ENABLE_PLUGINS) 641 #if defined(ENABLE_PLUGINS)
631 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) 642 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i)
632 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); 643 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]);
633 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) 644 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i)
634 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); 645 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]);
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 #endif 2543 #endif
2533 2544
2534 void ChromeContentBrowserClient::RegisterFrameMojoShellServices( 2545 void ChromeContentBrowserClient::RegisterFrameMojoShellServices(
2535 content::ServiceRegistry* registry, 2546 content::ServiceRegistry* registry,
2536 content::RenderFrameHost* render_frame_host) { 2547 content::RenderFrameHost* render_frame_host) {
2537 #if defined(OS_CHROMEOS) 2548 #if defined(OS_CHROMEOS)
2538 registry->AddService( 2549 registry->AddService(
2539 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create, 2550 base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create,
2540 render_frame_host)); 2551 render_frame_host));
2541 #endif 2552 #endif
2553 }
2554
2555 void ChromeContentBrowserClient::RegisterRenderFrameMojoServices(
2556 content::ServiceRegistry* registry,
2557 content::RenderFrameHost* render_frame_host) {
2542 #if !defined(OS_ANDROID) && !defined(OS_IOS) 2558 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2543 registry->AddService( 2559 registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host));
2544 base::Bind(&WebUSBPermissionProvider::Create, render_frame_host));
2545 #endif 2560 #endif
2546 } 2561 }
2547 2562
2548 void ChromeContentBrowserClient::RegisterInProcessMojoApplications(
2549 StaticMojoApplicationMap* apps) {
2550 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2551 apps->insert(std::make_pair(GURL(device::kDevicesMojoAppUrl),
2552 base::Bind(&device::DevicesAppFactory::CreateApp,
2553 base::ThreadTaskRunnerHandle::Get())));
2554 #endif
2555 }
2556
2557 void ChromeContentBrowserClient::OpenURL( 2563 void ChromeContentBrowserClient::OpenURL(
2558 content::BrowserContext* browser_context, 2564 content::BrowserContext* browser_context,
2559 const content::OpenURLParams& params, 2565 const content::OpenURLParams& params,
2560 const base::Callback<void(content::WebContents*)>& callback) { 2566 const base::Callback<void(content::WebContents*)>& callback) {
2561 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2567 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2562 2568
2563 #if !defined(OS_ANDROID) && !defined(OS_IOS) 2569 #if !defined(OS_ANDROID) && !defined(OS_IOS)
2564 chrome::NavigateParams nav_params( 2570 chrome::NavigateParams nav_params(
2565 Profile::FromBrowserContext(browser_context), 2571 Profile::FromBrowserContext(browser_context),
2566 params.url, 2572 params.url,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 if (channel <= kMaxDisableEncryptionChannel) { 2676 if (channel <= kMaxDisableEncryptionChannel) {
2671 static const char* const kWebRtcDevSwitchNames[] = { 2677 static const char* const kWebRtcDevSwitchNames[] = {
2672 switches::kDisableWebRtcEncryption, 2678 switches::kDisableWebRtcEncryption,
2673 }; 2679 };
2674 to_command_line->CopySwitchesFrom(from_command_line, 2680 to_command_line->CopySwitchesFrom(from_command_line,
2675 kWebRtcDevSwitchNames, 2681 kWebRtcDevSwitchNames,
2676 arraysize(kWebRtcDevSwitchNames)); 2682 arraysize(kWebRtcDevSwitchNames));
2677 } 2683 }
2678 } 2684 }
2679 #endif // defined(ENABLE_WEBRTC) 2685 #endif // defined(ENABLE_WEBRTC)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698