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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 #if defined(OS_WIN) | 241 #if defined(OS_WIN) |
242 handlers_.push_back(new IPCShellHandler()); | 242 handlers_.push_back(new IPCShellHandler()); |
243 #endif | 243 #endif |
244 } | 244 } |
245 | 245 |
246 ChromeContentUtilityClient::~ChromeContentUtilityClient() = default; | 246 ChromeContentUtilityClient::~ChromeContentUtilityClient() = default; |
247 | 247 |
248 void ChromeContentUtilityClient::UtilityThreadStarted() { | 248 void ChromeContentUtilityClient::UtilityThreadStarted() { |
249 #if BUILDFLAG(ENABLE_EXTENSIONS) | 249 #if BUILDFLAG(ENABLE_EXTENSIONS) |
250 extensions::UtilityHandler::UtilityThreadStarted(); | 250 extensions::utility_handler::UtilityThreadStarted(); |
251 #endif | 251 #endif |
252 | 252 |
253 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 253 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
254 if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) | 254 if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) |
255 utility_process_running_elevated_ = true; | 255 utility_process_running_elevated_ = true; |
256 } | 256 } |
257 | 257 |
258 bool ChromeContentUtilityClient::OnMessageReceived( | 258 bool ChromeContentUtilityClient::OnMessageReceived( |
259 const IPC::Message& message) { | 259 const IPC::Message& message) { |
260 if (utility_process_running_elevated_) | 260 if (utility_process_running_elevated_) |
261 return false; | 261 return false; |
262 | 262 |
263 for (auto* handler : handlers_) { | 263 for (auto* handler : handlers_) { |
264 if (handler->OnMessageReceived(message)) | 264 if (handler->OnMessageReceived(message)) |
265 return true; | 265 return true; |
266 } | 266 } |
267 | 267 |
268 return false; | 268 return false; |
269 } | 269 } |
270 | 270 |
271 void ChromeContentUtilityClient::ExposeInterfacesToBrowser( | 271 void ChromeContentUtilityClient::ExposeInterfacesToBrowser( |
272 service_manager::InterfaceRegistry* registry) { | 272 service_manager::InterfaceRegistry* registry) { |
273 #if BUILDFLAG(ENABLE_EXTENSIONS) | 273 #if BUILDFLAG(ENABLE_EXTENSIONS) |
274 extensions::ExtensionsHandler::ExposeInterfacesToBrowser( | 274 extensions::ExtensionsHandler::ExposeInterfacesToBrowser( |
275 registry, utility_process_running_elevated_); | 275 registry, utility_process_running_elevated_); |
276 extensions::UtilityHandler::ExposeInterfacesToBrowser( | 276 extensions::utility_handler::ExposeInterfacesToBrowser( |
277 registry, utility_process_running_elevated_); | 277 registry, utility_process_running_elevated_); |
278 #endif | 278 #endif |
279 // If our process runs with elevated privileges, only add elevated Mojo | 279 // If our process runs with elevated privileges, only add elevated Mojo |
280 // interfaces to the interface registry. | 280 // interfaces to the interface registry. |
281 if (utility_process_running_elevated_) | 281 if (utility_process_running_elevated_) |
282 return; | 282 return; |
283 | 283 |
284 registry->AddInterface(base::Bind(&FilePatcherImpl::Create)); | 284 registry->AddInterface(base::Bind(&FilePatcherImpl::Create)); |
285 #if !defined(OS_ANDROID) | 285 #if !defined(OS_ANDROID) |
286 registry->AddInterface<net::interfaces::ProxyResolverFactory>( | 286 registry->AddInterface<net::interfaces::ProxyResolverFactory>( |
(...skipping 22 matching lines...) Expand all Loading... |
309 services->insert( | 309 services->insert( |
310 std::make_pair(image_decoder::mojom::kServiceName, image_decoder_info)); | 310 std::make_pair(image_decoder::mojom::kServiceName, image_decoder_info)); |
311 } | 311 } |
312 | 312 |
313 // static | 313 // static |
314 void ChromeContentUtilityClient::PreSandboxStartup() { | 314 void ChromeContentUtilityClient::PreSandboxStartup() { |
315 #if BUILDFLAG(ENABLE_EXTENSIONS) | 315 #if BUILDFLAG(ENABLE_EXTENSIONS) |
316 extensions::ExtensionsHandler::PreSandboxStartup(); | 316 extensions::ExtensionsHandler::PreSandboxStartup(); |
317 #endif | 317 #endif |
318 } | 318 } |
OLD | NEW |