Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1948303002: Re-land: Convert the utility process JSON parser into a Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/utility/BUILD.gn ('k') | chrome/utility/safe_json_parser_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // converted to Mojo. 191 // converted to Mojo.
194 if (filter_messages_) 192 if (filter_messages_)
195 return; 193 return;
196 194
197 #if !defined(OS_ANDROID) 195 #if !defined(OS_ANDROID)
198 registry->AddService<net::interfaces::ProxyResolverFactory>( 196 registry->AddService<net::interfaces::ProxyResolverFactory>(
199 base::Bind(CreateProxyResolverFactory)); 197 base::Bind(CreateProxyResolverFactory));
200 registry->AddService(base::Bind(CreateResourceUsageReporter)); 198 registry->AddService(base::Bind(CreateResourceUsageReporter));
201 #endif 199 #endif
202 registry->AddService(base::Bind(&CreateImageDecoder)); 200 registry->AddService(base::Bind(&CreateImageDecoder));
201 registry->AddService(base::Bind(&safe_json::SafeJsonParserMojoImpl::Create));
203 } 202 }
204 203
205 void ChromeContentUtilityClient::AddHandler( 204 void ChromeContentUtilityClient::AddHandler(
206 std::unique_ptr<UtilityMessageHandler> handler) { 205 std::unique_ptr<UtilityMessageHandler> handler) {
207 handlers_.push_back(std::move(handler)); 206 handlers_.push_back(std::move(handler));
208 } 207 }
209 208
210 // static 209 // static
211 void ChromeContentUtilityClient::PreSandboxStartup() { 210 void ChromeContentUtilityClient::PreSandboxStartup() {
212 #if defined(ENABLE_EXTENSIONS) 211 #if defined(ENABLE_EXTENSIONS)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 safe_browsing::zip_analyzer::Results results; 295 safe_browsing::zip_analyzer::Results results;
297 safe_browsing::dmg::AnalyzeDMGFile( 296 safe_browsing::dmg::AnalyzeDMGFile(
298 IPC::PlatformFileForTransitToFile(dmg_file), &results); 297 IPC::PlatformFileForTransitToFile(dmg_file), &results);
299 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( 298 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished(
300 results)); 299 results));
301 ReleaseProcessIfNeeded(); 300 ReleaseProcessIfNeeded();
302 } 301 }
303 #endif // defined(OS_MACOSX) 302 #endif // defined(OS_MACOSX)
304 303
305 #endif // defined(FULL_SAFE_BROWSING) 304 #endif // defined(FULL_SAFE_BROWSING)
OLDNEW
« no previous file with comments | « chrome/utility/BUILD.gn ('k') | chrome/utility/safe_json_parser_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698