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 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/common/file_patcher.mojom.h" | 16 #include "chrome/common/file_patcher.mojom.h" |
17 #include "chrome/utility/utility_message_handler.h" | 17 #include "chrome/utility/utility_message_handler.h" |
18 #include "components/safe_json/utility/safe_json_parser_mojo_impl.h" | 18 #include "components/safe_json/utility/safe_json_parser_mojo_impl.h" |
19 #include "content/public/child/image_decoder_utils.h" | |
20 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
21 #include "content/public/common/service_info.h" | 20 #include "content/public/common/service_info.h" |
22 #include "content/public/utility/utility_thread.h" | 21 #include "content/public/utility/utility_thread.h" |
23 #include "courgette/courgette.h" | 22 #include "courgette/courgette.h" |
24 #include "courgette/third_party/bsdiff/bsdiff.h" | 23 #include "courgette/third_party/bsdiff/bsdiff.h" |
25 #include "extensions/features/features.h" | 24 #include "extensions/features/features.h" |
26 #include "mojo/public/cpp/bindings/strong_binding.h" | 25 #include "mojo/public/cpp/bindings/strong_binding.h" |
27 #include "printing/features/features.h" | 26 #include "printing/features/features.h" |
28 #include "services/image_decoder/image_decoder_service.h" | |
29 #include "services/image_decoder/public/interfaces/constants.mojom.h" | |
30 #include "services/service_manager/public/cpp/interface_registry.h" | 27 #include "services/service_manager/public/cpp/interface_registry.h" |
31 #include "third_party/zlib/google/zip.h" | 28 #include "third_party/zlib/google/zip.h" |
32 | 29 |
33 #if !defined(OS_ANDROID) | 30 #if !defined(OS_ANDROID) |
34 #include "chrome/common/resource_usage_reporter.mojom.h" | 31 #include "chrome/common/resource_usage_reporter.mojom.h" |
35 #include "chrome/utility/profile_import_handler.h" | 32 #include "chrome/utility/profile_import_handler.h" |
36 #include "mojo/public/cpp/bindings/strong_binding.h" | 33 #include "mojo/public/cpp/bindings/strong_binding.h" |
37 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" | 34 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" |
38 #include "net/proxy/proxy_resolver_v8.h" | 35 #include "net/proxy/proxy_resolver_v8.h" |
39 #else | 36 #else |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 DISALLOW_COPY_AND_ASSIGN(ResourceUsageReporterImpl); | 210 DISALLOW_COPY_AND_ASSIGN(ResourceUsageReporterImpl); |
214 }; | 211 }; |
215 | 212 |
216 void CreateResourceUsageReporter( | 213 void CreateResourceUsageReporter( |
217 mojo::InterfaceRequest<chrome::mojom::ResourceUsageReporter> request) { | 214 mojo::InterfaceRequest<chrome::mojom::ResourceUsageReporter> request) { |
218 mojo::MakeStrongBinding(base::MakeUnique<ResourceUsageReporterImpl>(), | 215 mojo::MakeStrongBinding(base::MakeUnique<ResourceUsageReporterImpl>(), |
219 std::move(request)); | 216 std::move(request)); |
220 } | 217 } |
221 #endif // !defined(OS_ANDROID) | 218 #endif // !defined(OS_ANDROID) |
222 | 219 |
223 std::unique_ptr<service_manager::Service> CreateImageDecoderService() { | |
224 content::UtilityThread::Get()->EnsureBlinkInitialized(); | |
225 return image_decoder::ImageDecoderService::Create(); | |
226 } | |
227 | |
228 } // namespace | 220 } // namespace |
229 | 221 |
230 ChromeContentUtilityClient::ChromeContentUtilityClient() | 222 ChromeContentUtilityClient::ChromeContentUtilityClient() |
231 : utility_process_running_elevated_(false) { | 223 : utility_process_running_elevated_(false) { |
232 #if BUILDFLAG(ENABLE_EXTENSIONS) | 224 #if BUILDFLAG(ENABLE_EXTENSIONS) |
233 handlers_.push_back(new extensions::ExtensionsHandler()); | 225 handlers_.push_back(new extensions::ExtensionsHandler()); |
234 #endif | 226 #endif |
235 | 227 |
236 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ | 228 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ |
237 (BUILDFLAG(ENABLE_BASIC_PRINTING) && defined(OS_WIN)) | 229 (BUILDFLAG(ENABLE_BASIC_PRINTING) && defined(OS_WIN)) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 registry->AddInterface(base::Bind(&ShellHandlerImpl::Create)); | 288 registry->AddInterface(base::Bind(&ShellHandlerImpl::Create)); |
297 #endif | 289 #endif |
298 #if defined(OS_CHROMEOS) | 290 #if defined(OS_CHROMEOS) |
299 registry->AddInterface(base::Bind(&ZipFileCreatorImpl::Create)); | 291 registry->AddInterface(base::Bind(&ZipFileCreatorImpl::Create)); |
300 #endif | 292 #endif |
301 #if defined(FULL_SAFE_BROWSING) | 293 #if defined(FULL_SAFE_BROWSING) |
302 registry->AddInterface(base::Bind(&SafeArchiveAnalyzerImpl::Create)); | 294 registry->AddInterface(base::Bind(&SafeArchiveAnalyzerImpl::Create)); |
303 #endif | 295 #endif |
304 } | 296 } |
305 | 297 |
306 void ChromeContentUtilityClient::RegisterServices(StaticServiceMap* services) { | |
307 content::ServiceInfo image_decoder_info; | |
308 image_decoder_info.factory = base::Bind(&CreateImageDecoderService); | |
309 services->insert( | |
310 std::make_pair(image_decoder::mojom::kServiceName, image_decoder_info)); | |
311 } | |
312 | |
313 // static | 298 // static |
314 void ChromeContentUtilityClient::PreSandboxStartup() { | 299 void ChromeContentUtilityClient::PreSandboxStartup() { |
315 #if BUILDFLAG(ENABLE_EXTENSIONS) | 300 #if BUILDFLAG(ENABLE_EXTENSIONS) |
316 extensions::ExtensionsHandler::PreSandboxStartup(); | 301 extensions::ExtensionsHandler::PreSandboxStartup(); |
317 #endif | 302 #endif |
318 } | 303 } |
OLD | NEW |