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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 mojo::MakeStrongBinding(base::MakeUnique<ResourceUsageReporterImpl>(), | 214 mojo::MakeStrongBinding(base::MakeUnique<ResourceUsageReporterImpl>(), |
215 std::move(request)); | 215 std::move(request)); |
216 } | 216 } |
217 #endif // !defined(OS_ANDROID) | 217 #endif // !defined(OS_ANDROID) |
218 | 218 |
219 } // namespace | 219 } // namespace |
220 | 220 |
221 ChromeContentUtilityClient::ChromeContentUtilityClient() | 221 ChromeContentUtilityClient::ChromeContentUtilityClient() |
222 : utility_process_running_elevated_(false) { | 222 : utility_process_running_elevated_(false) { |
223 #if BUILDFLAG(ENABLE_EXTENSIONS) | 223 #if BUILDFLAG(ENABLE_EXTENSIONS) |
224 handlers_.push_back(new extensions::ExtensionsHandler()); | 224 handlers_.push_back(base::MakeUnique<extensions::ExtensionsHandler>()); |
225 #endif | 225 #endif |
226 | 226 |
227 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ | 227 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ |
228 (BUILDFLAG(ENABLE_BASIC_PRINTING) && defined(OS_WIN)) | 228 (BUILDFLAG(ENABLE_BASIC_PRINTING) && defined(OS_WIN)) |
229 handlers_.push_back(new printing::PrintingHandler()); | 229 handlers_.push_back(base::MakeUnique<printing::PrintingHandler>()); |
230 #endif | 230 #endif |
231 | 231 |
232 #if defined(OS_WIN) | 232 #if defined(OS_WIN) |
233 handlers_.push_back(new IPCShellHandler()); | 233 handlers_.push_back(base::MakeUnique<IPCShellHandler>()); |
234 #endif | 234 #endif |
235 } | 235 } |
236 | 236 |
237 ChromeContentUtilityClient::~ChromeContentUtilityClient() = default; | 237 ChromeContentUtilityClient::~ChromeContentUtilityClient() = default; |
238 | 238 |
239 void ChromeContentUtilityClient::UtilityThreadStarted() { | 239 void ChromeContentUtilityClient::UtilityThreadStarted() { |
240 #if BUILDFLAG(ENABLE_EXTENSIONS) | 240 #if BUILDFLAG(ENABLE_EXTENSIONS) |
241 extensions::utility_handler::UtilityThreadStarted(); | 241 extensions::utility_handler::UtilityThreadStarted(); |
242 #endif | 242 #endif |
243 | 243 |
244 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 244 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
245 if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) | 245 if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) |
246 utility_process_running_elevated_ = true; | 246 utility_process_running_elevated_ = true; |
247 } | 247 } |
248 | 248 |
249 bool ChromeContentUtilityClient::OnMessageReceived( | 249 bool ChromeContentUtilityClient::OnMessageReceived( |
250 const IPC::Message& message) { | 250 const IPC::Message& message) { |
251 if (utility_process_running_elevated_) | 251 if (utility_process_running_elevated_) |
252 return false; | 252 return false; |
253 | 253 |
254 for (auto* handler : handlers_) { | 254 for (const auto& handler : handlers_) { |
255 if (handler->OnMessageReceived(message)) | 255 if (handler->OnMessageReceived(message)) |
256 return true; | 256 return true; |
257 } | 257 } |
258 | 258 |
259 return false; | 259 return false; |
260 } | 260 } |
261 | 261 |
262 void ChromeContentUtilityClient::ExposeInterfacesToBrowser( | 262 void ChromeContentUtilityClient::ExposeInterfacesToBrowser( |
263 service_manager::InterfaceRegistry* registry) { | 263 service_manager::InterfaceRegistry* registry) { |
264 #if BUILDFLAG(ENABLE_EXTENSIONS) | 264 #if BUILDFLAG(ENABLE_EXTENSIONS) |
(...skipping 29 matching lines...) Expand all Loading... |
294 registry->AddInterface(base::Bind(&SafeArchiveAnalyzerImpl::Create)); | 294 registry->AddInterface(base::Bind(&SafeArchiveAnalyzerImpl::Create)); |
295 #endif | 295 #endif |
296 } | 296 } |
297 | 297 |
298 // static | 298 // static |
299 void ChromeContentUtilityClient::PreSandboxStartup() { | 299 void ChromeContentUtilityClient::PreSandboxStartup() { |
300 #if BUILDFLAG(ENABLE_EXTENSIONS) | 300 #if BUILDFLAG(ENABLE_EXTENSIONS) |
301 extensions::ExtensionsHandler::PreSandboxStartup(); | 301 extensions::ExtensionsHandler::PreSandboxStartup(); |
302 #endif | 302 #endif |
303 } | 303 } |
OLD | NEW |