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 179 matching lines...) Loading... |
190 #include "media/media_features.h" | 190 #include "media/media_features.h" |
191 #include "net/base/mime_util.h" | 191 #include "net/base/mime_util.h" |
192 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 192 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
193 #include "net/cookies/canonical_cookie.h" | 193 #include "net/cookies/canonical_cookie.h" |
194 #include "net/cookies/cookie_options.h" | 194 #include "net/cookies/cookie_options.h" |
195 #include "net/ssl/ssl_cert_request_info.h" | 195 #include "net/ssl/ssl_cert_request_info.h" |
196 #include "ppapi/features/features.h" | 196 #include "ppapi/features/features.h" |
197 #include "ppapi/host/ppapi_host.h" | 197 #include "ppapi/host/ppapi_host.h" |
198 #include "printing/features/features.h" | 198 #include "printing/features/features.h" |
199 #include "services/preferences/public/interfaces/preferences.mojom.h" | 199 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 200 #include "services/service_manager/public/cpp/binder_registry.h" |
200 #include "services/service_manager/public/cpp/interface_provider.h" | 201 #include "services/service_manager/public/cpp/interface_provider.h" |
201 #include "services/service_manager/public/cpp/interface_registry.h" | 202 #include "services/service_manager/public/cpp/interface_registry.h" |
202 #include "services/service_manager/public/cpp/service.h" | 203 #include "services/service_manager/public/cpp/service.h" |
203 #include "storage/browser/fileapi/external_mount_points.h" | 204 #include "storage/browser/fileapi/external_mount_points.h" |
204 #include "third_party/WebKit/public/platform/modules/installedapp/installed_app_
provider.mojom.h" | 205 #include "third_party/WebKit/public/platform/modules/installedapp/installed_app_
provider.mojom.h" |
205 #include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h" | 206 #include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h" |
206 #include "ui/base/l10n/l10n_util.h" | 207 #include "ui/base/l10n/l10n_util.h" |
207 #include "ui/base/resource/resource_bundle.h" | 208 #include "ui/base/resource/resource_bundle.h" |
208 #include "ui/resources/grit/ui_resources.h" | 209 #include "ui/resources/grit/ui_resources.h" |
209 #include "url/gurl.h" | 210 #include "url/gurl.h" |
(...skipping 758 matching lines...) Loading... |
968 #endif | 969 #endif |
969 | 970 |
970 #if !defined(OS_ANDROID) | 971 #if !defined(OS_ANDROID) |
971 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); | 972 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); |
972 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); | 973 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); |
973 #endif | 974 #endif |
974 | 975 |
975 #if BUILDFLAG(ENABLE_EXTENSIONS) | 976 #if BUILDFLAG(ENABLE_EXTENSIONS) |
976 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); | 977 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); |
977 #endif | 978 #endif |
| 979 |
| 980 gpu_binder_registry_.AddInterface( |
| 981 base::Bind(&metrics::CallStackProfileCollector::Create, |
| 982 metrics::CallStackProfileParams::GPU_PROCESS)); |
978 } | 983 } |
979 | 984 |
980 ChromeContentBrowserClient::~ChromeContentBrowserClient() { | 985 ChromeContentBrowserClient::~ChromeContentBrowserClient() { |
981 for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) | 986 for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) |
982 delete extra_parts_[i]; | 987 delete extra_parts_[i]; |
983 extra_parts_.clear(); | 988 extra_parts_.clear(); |
984 } | 989 } |
985 | 990 |
986 // static | 991 // static |
987 void ChromeContentBrowserClient::RegisterProfilePrefs( | 992 void ChromeContentBrowserClient::RegisterProfilePrefs( |
(...skipping 2066 matching lines...) Loading... |
3054 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, | 3059 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, |
3055 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, | 3060 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
3056 L"\\\\.\\pipe\\chrome.nacl.*"); | 3061 L"\\\\.\\pipe\\chrome.nacl.*"); |
3057 if (result != sandbox::SBOX_ALL_OK) | 3062 if (result != sandbox::SBOX_ALL_OK) |
3058 return false; | 3063 return false; |
3059 return result == sandbox::SBOX_ALL_OK; | 3064 return result == sandbox::SBOX_ALL_OK; |
3060 } | 3065 } |
3061 #endif // defined(OS_WIN) | 3066 #endif // defined(OS_WIN) |
3062 | 3067 |
3063 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( | 3068 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( |
3064 service_manager::InterfaceRegistry* registry, | 3069 service_manager::BinderRegistry* registry, |
3065 content::RenderProcessHost* render_process_host) { | 3070 content::RenderProcessHost* render_process_host) { |
3066 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = | 3071 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
3067 content::BrowserThread::GetTaskRunnerForThread( | 3072 content::BrowserThread::GetTaskRunnerForThread( |
3068 content::BrowserThread::UI); | 3073 content::BrowserThread::UI); |
3069 registry->AddInterface( | 3074 registry->AddInterface( |
3070 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), | 3075 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), |
3071 ui_task_runner); | 3076 ui_task_runner); |
3072 registry->AddInterface( | 3077 registry->AddInterface( |
3073 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), | 3078 base::Bind(&BudgetServiceImpl::Create, render_process_host->GetID()), |
3074 ui_task_runner); | 3079 ui_task_runner); |
(...skipping 123 matching lines...) Loading... |
3198 } | 3203 } |
3199 #endif | 3204 #endif |
3200 | 3205 |
3201 #if defined(OS_LINUX) || defined(OS_WIN) | 3206 #if defined(OS_LINUX) || defined(OS_WIN) |
3202 if (!ChromeOriginTrialPolicy().IsFeatureDisabled("WebShare")) { | 3207 if (!ChromeOriginTrialPolicy().IsFeatureDisabled("WebShare")) { |
3203 registry->AddInterface(base::Bind(&ShareServiceImpl::Create)); | 3208 registry->AddInterface(base::Bind(&ShareServiceImpl::Create)); |
3204 } | 3209 } |
3205 #endif | 3210 #endif |
3206 } | 3211 } |
3207 | 3212 |
3208 void ChromeContentBrowserClient::ExposeInterfacesToGpuProcess( | 3213 void ChromeContentBrowserClient::BindInterfaceRequest( |
3209 service_manager::InterfaceRegistry* registry, | 3214 const service_manager::ServiceInfo& source_info, |
3210 content::GpuProcessHost* render_process_host) { | 3215 const std::string& interface_name, |
3211 registry->AddInterface( | 3216 mojo::ScopedMessagePipeHandle* interface_pipe) { |
3212 base::Bind(&metrics::CallStackProfileCollector::Create, | 3217 if (source_info.identity.name() == content::mojom::kGpuServiceName && |
3213 metrics::CallStackProfileParams::GPU_PROCESS)); | 3218 gpu_binder_registry_.CanBindInterface(interface_name)) { |
| 3219 gpu_binder_registry_.BindInterface(source_info.identity, interface_name, |
| 3220 std::move(*interface_pipe)); |
| 3221 } |
3214 } | 3222 } |
3215 | 3223 |
3216 void ChromeContentBrowserClient::RegisterInProcessServices( | 3224 void ChromeContentBrowserClient::RegisterInProcessServices( |
3217 StaticServiceMap* services) { | 3225 StaticServiceMap* services) { |
3218 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 3226 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
3219 content::ServiceInfo info; | 3227 content::ServiceInfo info; |
3220 info.factory = base::Bind(&media::CreateMediaService); | 3228 info.factory = base::Bind(&media::CreateMediaService); |
3221 services->insert(std::make_pair("media", info)); | 3229 services->insert(std::make_pair("media", info)); |
3222 #endif | 3230 #endif |
3223 #if defined(OS_CHROMEOS) | 3231 #if defined(OS_CHROMEOS) |
(...skipping 347 matching lines...) Loading... |
3571 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3579 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3572 return variations::GetVariationParamValue( | 3580 return variations::GetVariationParamValue( |
3573 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3581 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3574 } | 3582 } |
3575 | 3583 |
3576 // static | 3584 // static |
3577 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3585 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3578 const storage::QuotaSettings* settings) { | 3586 const storage::QuotaSettings* settings) { |
3579 g_default_quota_settings = settings; | 3587 g_default_quota_settings = settings; |
3580 } | 3588 } |
OLD | NEW |