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 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/common/chrome_utility_messages.h" | 15 #include "chrome/common/chrome_utility_messages.h" |
16 #include "chrome/common/safe_browsing/zip_analyzer.h" | 16 #include "chrome/common/safe_browsing/zip_analyzer.h" |
17 #include "chrome/common/safe_browsing/zip_analyzer_results.h" | 17 #include "chrome/common/safe_browsing/zip_analyzer_results.h" |
18 #include "chrome/utility/chrome_content_utility_ipc_whitelist.h" | 18 #include "chrome/utility/chrome_content_utility_ipc_whitelist.h" |
19 #include "chrome/utility/image_decoder_impl.h" | 19 #include "chrome/utility/image_decoder_impl.h" |
| 20 #include "chrome/utility/safe_json_parser_handler.h" |
20 #include "chrome/utility/utility_message_handler.h" | 21 #include "chrome/utility/utility_message_handler.h" |
21 #include "components/safe_json/utility/safe_json_parser_mojo_impl.h" | |
22 #include "content/public/child/image_decoder_utils.h" | 22 #include "content/public/child/image_decoder_utils.h" |
23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
24 #include "content/public/common/service_registry.h" | 24 #include "content/public/common/service_registry.h" |
25 #include "content/public/utility/utility_thread.h" | 25 #include "content/public/utility/utility_thread.h" |
26 #include "courgette/courgette.h" | 26 #include "courgette/courgette.h" |
27 #include "courgette/third_party/bsdiff.h" | 27 #include "courgette/third_party/bsdiff.h" |
28 #include "ipc/ipc_channel.h" | 28 #include "ipc/ipc_channel.h" |
29 #include "third_party/zlib/google/zip.h" | 29 #include "third_party/zlib/google/zip.h" |
30 #include "ui/gfx/geometry/size.h" | 30 #include "ui/gfx/geometry/size.h" |
31 | 31 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 handlers_.push_back(new image_writer::ImageWriterHandler()); | 121 handlers_.push_back(new image_writer::ImageWriterHandler()); |
122 #endif | 122 #endif |
123 | 123 |
124 #if defined(ENABLE_PRINT_PREVIEW) || defined(OS_WIN) | 124 #if defined(ENABLE_PRINT_PREVIEW) || defined(OS_WIN) |
125 handlers_.push_back(new printing::PrintingHandler()); | 125 handlers_.push_back(new printing::PrintingHandler()); |
126 #endif | 126 #endif |
127 | 127 |
128 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
129 handlers_.push_back(new ShellHandler()); | 129 handlers_.push_back(new ShellHandler()); |
130 #endif | 130 #endif |
| 131 |
| 132 handlers_.push_back(new SafeJsonParserHandler()); |
131 } | 133 } |
132 | 134 |
133 ChromeContentUtilityClient::~ChromeContentUtilityClient() { | 135 ChromeContentUtilityClient::~ChromeContentUtilityClient() { |
134 } | 136 } |
135 | 137 |
136 void ChromeContentUtilityClient::UtilityThreadStarted() { | 138 void ChromeContentUtilityClient::UtilityThreadStarted() { |
137 #if defined(ENABLE_EXTENSIONS) | 139 #if defined(ENABLE_EXTENSIONS) |
138 extensions::UtilityHandler::UtilityThreadStarted(); | 140 extensions::UtilityHandler::UtilityThreadStarted(); |
139 #endif | 141 #endif |
140 | 142 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // converted to Mojo. | 193 // converted to Mojo. |
192 if (filter_messages_) | 194 if (filter_messages_) |
193 return; | 195 return; |
194 | 196 |
195 #if !defined(OS_ANDROID) | 197 #if !defined(OS_ANDROID) |
196 registry->AddService<net::interfaces::ProxyResolverFactory>( | 198 registry->AddService<net::interfaces::ProxyResolverFactory>( |
197 base::Bind(CreateProxyResolverFactory)); | 199 base::Bind(CreateProxyResolverFactory)); |
198 registry->AddService(base::Bind(CreateResourceUsageReporter)); | 200 registry->AddService(base::Bind(CreateResourceUsageReporter)); |
199 #endif | 201 #endif |
200 registry->AddService(base::Bind(&CreateImageDecoder)); | 202 registry->AddService(base::Bind(&CreateImageDecoder)); |
201 registry->AddService(base::Bind(&safe_json::SafeJsonParserMojoImpl::Create)); | |
202 } | 203 } |
203 | 204 |
204 void ChromeContentUtilityClient::AddHandler( | 205 void ChromeContentUtilityClient::AddHandler( |
205 std::unique_ptr<UtilityMessageHandler> handler) { | 206 std::unique_ptr<UtilityMessageHandler> handler) { |
206 handlers_.push_back(std::move(handler)); | 207 handlers_.push_back(std::move(handler)); |
207 } | 208 } |
208 | 209 |
209 // static | 210 // static |
210 void ChromeContentUtilityClient::PreSandboxStartup() { | 211 void ChromeContentUtilityClient::PreSandboxStartup() { |
211 #if defined(ENABLE_EXTENSIONS) | 212 #if defined(ENABLE_EXTENSIONS) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 safe_browsing::zip_analyzer::Results results; | 296 safe_browsing::zip_analyzer::Results results; |
296 safe_browsing::dmg::AnalyzeDMGFile( | 297 safe_browsing::dmg::AnalyzeDMGFile( |
297 IPC::PlatformFileForTransitToFile(dmg_file), &results); | 298 IPC::PlatformFileForTransitToFile(dmg_file), &results); |
298 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( | 299 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( |
299 results)); | 300 results)); |
300 ReleaseProcessIfNeeded(); | 301 ReleaseProcessIfNeeded(); |
301 } | 302 } |
302 #endif // defined(OS_MACOSX) | 303 #endif // defined(OS_MACOSX) |
303 | 304 |
304 #endif // defined(FULL_SAFE_BROWSING) | 305 #endif // defined(FULL_SAFE_BROWSING) |
OLD | NEW |