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" | |
21 #include "chrome/utility/utility_message_handler.h" | 20 #include "chrome/utility/utility_message_handler.h" |
| 21 #include "components/safe_json/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()); | |
133 } | 131 } |
134 | 132 |
135 ChromeContentUtilityClient::~ChromeContentUtilityClient() { | 133 ChromeContentUtilityClient::~ChromeContentUtilityClient() { |
136 } | 134 } |
137 | 135 |
138 void ChromeContentUtilityClient::UtilityThreadStarted() { | 136 void ChromeContentUtilityClient::UtilityThreadStarted() { |
139 #if defined(ENABLE_EXTENSIONS) | 137 #if defined(ENABLE_EXTENSIONS) |
140 extensions::UtilityHandler::UtilityThreadStarted(); | 138 extensions::UtilityHandler::UtilityThreadStarted(); |
141 #endif | 139 #endif |
142 | 140 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // converted to Mojo. | 192 // converted to Mojo. |
195 if (filter_messages_) | 193 if (filter_messages_) |
196 return; | 194 return; |
197 | 195 |
198 #if !defined(OS_ANDROID) | 196 #if !defined(OS_ANDROID) |
199 registry->AddService<net::interfaces::ProxyResolverFactory>( | 197 registry->AddService<net::interfaces::ProxyResolverFactory>( |
200 base::Bind(CreateProxyResolverFactory)); | 198 base::Bind(CreateProxyResolverFactory)); |
201 registry->AddService(base::Bind(CreateResourceUsageReporter)); | 199 registry->AddService(base::Bind(CreateResourceUsageReporter)); |
202 #endif | 200 #endif |
203 registry->AddService(base::Bind(&CreateImageDecoder)); | 201 registry->AddService(base::Bind(&CreateImageDecoder)); |
| 202 registry->AddService(base::Bind(&safe_json::SafeJsonParserMojoImpl::Create)); |
204 } | 203 } |
205 | 204 |
206 void ChromeContentUtilityClient::AddHandler( | 205 void ChromeContentUtilityClient::AddHandler( |
207 scoped_ptr<UtilityMessageHandler> handler) { | 206 scoped_ptr<UtilityMessageHandler> handler) { |
208 handlers_.push_back(std::move(handler)); | 207 handlers_.push_back(std::move(handler)); |
209 } | 208 } |
210 | 209 |
211 // static | 210 // static |
212 void ChromeContentUtilityClient::PreSandboxStartup() { | 211 void ChromeContentUtilityClient::PreSandboxStartup() { |
213 #if defined(ENABLE_EXTENSIONS) | 212 #if defined(ENABLE_EXTENSIONS) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 safe_browsing::zip_analyzer::Results results; | 301 safe_browsing::zip_analyzer::Results results; |
303 safe_browsing::dmg::AnalyzeDMGFile( | 302 safe_browsing::dmg::AnalyzeDMGFile( |
304 IPC::PlatformFileForTransitToFile(dmg_file), &results); | 303 IPC::PlatformFileForTransitToFile(dmg_file), &results); |
305 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( | 304 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( |
306 results)); | 305 results)); |
307 ReleaseProcessIfNeeded(); | 306 ReleaseProcessIfNeeded(); |
308 } | 307 } |
309 #endif // defined(OS_MACOSX) | 308 #endif // defined(OS_MACOSX) |
310 | 309 |
311 #endif // defined(FULL_SAFE_BROWSING) | 310 #endif // defined(FULL_SAFE_BROWSING) |
OLD | NEW |