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

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

Issue 2947413002: Restrict CM API interface request and message dispatch. (Closed)
Patch Set: Addressed comments from rockot@. Created 3 years, 5 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 #include "content/public/common/web_preferences.h" 191 #include "content/public/common/web_preferences.h"
192 #include "device/bluetooth/adapter_factory.h" 192 #include "device/bluetooth/adapter_factory.h"
193 #include "device/bluetooth/public/interfaces/adapter.mojom.h" 193 #include "device/bluetooth/public/interfaces/adapter.mojom.h"
194 #include "device/usb/public/interfaces/chooser_service.mojom.h" 194 #include "device/usb/public/interfaces/chooser_service.mojom.h"
195 #include "device/usb/public/interfaces/device_manager.mojom.h" 195 #include "device/usb/public/interfaces/device_manager.mojom.h"
196 #include "extensions/features/features.h" 196 #include "extensions/features/features.h"
197 #include "gpu/config/gpu_switches.h" 197 #include "gpu/config/gpu_switches.h"
198 #include "media/audio/audio_manager.h" 198 #include "media/audio/audio_manager.h"
199 #include "media/media_features.h" 199 #include "media/media_features.h"
200 #include "media/mojo/features.h" 200 #include "media/mojo/features.h"
201 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
201 #include "net/base/mime_util.h" 202 #include "net/base/mime_util.h"
202 #include "net/cookies/canonical_cookie.h" 203 #include "net/cookies/canonical_cookie.h"
203 #include "net/cookies/cookie_options.h" 204 #include "net/cookies/cookie_options.h"
204 #include "net/ssl/ssl_cert_request_info.h" 205 #include "net/ssl/ssl_cert_request_info.h"
205 #include "ppapi/features/features.h" 206 #include "ppapi/features/features.h"
206 #include "ppapi/host/ppapi_host.h" 207 #include "ppapi/host/ppapi_host.h"
207 #include "printing/features/features.h" 208 #include "printing/features/features.h"
208 #include "services/preferences/public/interfaces/preferences.mojom.h" 209 #include "services/preferences/public/interfaces/preferences.mojom.h"
209 #include "services/service_manager/public/cpp/binder_registry.h" 210 #include "services/service_manager/public/cpp/binder_registry.h"
210 #include "services/service_manager/public/cpp/interface_provider.h" 211 #include "services/service_manager/public/cpp/interface_provider.h"
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 if (frame_interfaces_parameterized_->CanBindInterface(interface_name)) { 2987 if (frame_interfaces_parameterized_->CanBindInterface(interface_name)) {
2987 frame_interfaces_parameterized_->BindInterface(source_info, interface_name, 2988 frame_interfaces_parameterized_->BindInterface(source_info, interface_name,
2988 std::move(interface_pipe), 2989 std::move(interface_pipe),
2989 render_frame_host); 2990 render_frame_host);
2990 } else if (frame_interfaces_->CanBindInterface(interface_name)) { 2991 } else if (frame_interfaces_->CanBindInterface(interface_name)) {
2991 frame_interfaces_->BindInterface(source_info, interface_name, 2992 frame_interfaces_->BindInterface(source_info, interface_name,
2992 std::move(interface_pipe)); 2993 std::move(interface_pipe));
2993 } 2994 }
2994 } 2995 }
2995 2996
2997 bool ChromeContentBrowserClient::BindAssociatedInterfaceRequestFromFrame(
2998 content::RenderFrameHost* render_frame_host,
2999 const std::string& interface_name,
3000 mojo::ScopedInterfaceEndpointHandle* handle) {
3001 // TODO(https://crbug.com/736357): Factor AssociatedInterfaceRegistryImpl out
3002 // into content/public/ so it can be used here instead of this abomination.
3003 if (interface_name == password_manager::mojom::CredentialManager::Name_) {
3004 ChromePasswordManagerClient::BindCredentialManager(
3005 password_manager::mojom::CredentialManagerAssociatedRequest(
3006 std::move(*handle)),
3007 render_frame_host);
3008 return true;
3009 }
3010 return false;
3011 }
3012
2996 void ChromeContentBrowserClient::BindInterfaceRequest( 3013 void ChromeContentBrowserClient::BindInterfaceRequest(
2997 const service_manager::BindSourceInfo& source_info, 3014 const service_manager::BindSourceInfo& source_info,
2998 const std::string& interface_name, 3015 const std::string& interface_name,
2999 mojo::ScopedMessagePipeHandle* interface_pipe) { 3016 mojo::ScopedMessagePipeHandle* interface_pipe) {
3000 if (source_info.identity.name() == content::mojom::kGpuServiceName && 3017 if (source_info.identity.name() == content::mojom::kGpuServiceName &&
3001 gpu_binder_registry_.CanBindInterface(interface_name)) { 3018 gpu_binder_registry_.CanBindInterface(interface_name)) {
3002 gpu_binder_registry_.BindInterface(source_info, interface_name, 3019 gpu_binder_registry_.BindInterface(source_info, interface_name,
3003 std::move(*interface_pipe)); 3020 std::move(*interface_pipe));
3004 } 3021 }
3005 } 3022 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3318 frame_interfaces_parameterized_->AddInterface( 3335 frame_interfaces_parameterized_->AddInterface(
3319 base::Bind(&CreateUsbDeviceManager)); 3336 base::Bind(&CreateUsbDeviceManager));
3320 frame_interfaces_parameterized_->AddInterface( 3337 frame_interfaces_parameterized_->AddInterface(
3321 base::Bind(&CreateWebUsbChooserService)); 3338 base::Bind(&CreateWebUsbChooserService));
3322 } 3339 }
3323 3340
3324 frame_interfaces_->AddInterface<bluetooth::mojom::AdapterFactory>( 3341 frame_interfaces_->AddInterface<bluetooth::mojom::AdapterFactory>(
3325 base::Bind(&bluetooth::AdapterFactory::Create)); 3342 base::Bind(&bluetooth::AdapterFactory::Create));
3326 3343
3327 frame_interfaces_parameterized_->AddInterface( 3344 frame_interfaces_parameterized_->AddInterface(
3328 base::Bind(&ChromePasswordManagerClient::BindCredentialManager));
3329 frame_interfaces_parameterized_->AddInterface(
3330 base::Bind(&ChromeTranslateClient::BindContentTranslateDriver)); 3345 base::Bind(&ChromeTranslateClient::BindContentTranslateDriver));
3331 3346
3332 frame_interfaces_parameterized_->AddInterface( 3347 frame_interfaces_parameterized_->AddInterface(
3333 base::Bind(&autofill::ContentAutofillDriverFactory::BindAutofillDriver)); 3348 base::Bind(&autofill::ContentAutofillDriverFactory::BindAutofillDriver));
3334 3349
3335 frame_interfaces_parameterized_->AddInterface( 3350 frame_interfaces_parameterized_->AddInterface(
3336 base::Bind(&password_manager::ContentPasswordManagerDriverFactory:: 3351 base::Bind(&password_manager::ContentPasswordManagerDriverFactory::
3337 BindPasswordManagerDriver)); 3352 BindPasswordManagerDriver));
3338 3353
3339 frame_interfaces_parameterized_->AddInterface( 3354 frame_interfaces_parameterized_->AddInterface(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3466 // displayed URL when rewriting chrome://help to chrome://settings/help. 3481 // displayed URL when rewriting chrome://help to chrome://settings/help.
3467 return url->SchemeIs(content::kChromeUIScheme) && 3482 return url->SchemeIs(content::kChromeUIScheme) &&
3468 url->host() == chrome::kChromeUISettingsHost; 3483 url->host() == chrome::kChromeUISettingsHost;
3469 } 3484 }
3470 3485
3471 // static 3486 // static
3472 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( 3487 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting(
3473 const storage::QuotaSettings* settings) { 3488 const storage::QuotaSettings* settings) {
3474 g_default_quota_settings = settings; 3489 g_default_quota_settings = settings;
3475 } 3490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698