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

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

Issue 2611283002: [mojo talk demo] Convert utility process CheckMediaFile IPC to mojo (Closed)
Patch Set: Created 3 years, 11 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
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"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // for loop was using iterators explicitly, as originally done). 185 // for loop was using iterators explicitly, as originally done).
186 if (handler->OnMessageReceived(message)) 186 if (handler->OnMessageReceived(message))
187 return true; 187 return true;
188 } 188 }
189 189
190 return false; 190 return false;
191 } 191 }
192 192
193 void ChromeContentUtilityClient::ExposeInterfacesToBrowser( 193 void ChromeContentUtilityClient::ExposeInterfacesToBrowser(
194 service_manager::InterfaceRegistry* registry) { 194 service_manager::InterfaceRegistry* registry) {
195 // When the utility process is running with elevated privileges, we need to 195 const bool running_elevated =
196 // filter messages so that only a whitelist of IPCs can run. In Mojo, there's 196 base::CommandLine::ForCurrentProcess()->HasSwitch(
197 // no way of filtering individual messages. Instead, we can avoid adding 197 switches::kUtilityProcessRunningElevated);
198 // non-whitelisted Mojo services to the service_manager::InterfaceRegistry. 198 #if BUILDFLAG(ENABLE_EXTENSIONS)
199 // TODO(amistry): Use a whitelist once the whistlisted IPCs have been 199 extensions::ExtensionsHandler::ExposeInterfacesToBrowser(registry,
200 // converted to Mojo. 200 running_elevated);
201 if (filter_messages_) 201 #endif
202 // If our process runs with elevated privileges, only add elevated
203 // Mojo services to the service_manager::InterfaceRegistry.
204 if (running_elevated)
202 return; 205 return;
203 206
204 #if !defined(OS_ANDROID) 207 #if !defined(OS_ANDROID)
205 registry->AddInterface<net::interfaces::ProxyResolverFactory>( 208 registry->AddInterface<net::interfaces::ProxyResolverFactory>(
206 base::Bind(CreateProxyResolverFactory)); 209 base::Bind(CreateProxyResolverFactory));
207 registry->AddInterface(base::Bind(CreateResourceUsageReporter)); 210 registry->AddInterface(base::Bind(CreateResourceUsageReporter));
208 registry->AddInterface(base::Bind(&ProfileImportHandler::Create)); 211 registry->AddInterface(base::Bind(&ProfileImportHandler::Create));
209 #endif 212 #endif
210 registry->AddInterface( 213 registry->AddInterface(
211 base::Bind(&safe_json::SafeJsonParserMojoImpl::Create)); 214 base::Bind(&safe_json::SafeJsonParserMojoImpl::Create));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 safe_browsing::zip_analyzer::Results results; 311 safe_browsing::zip_analyzer::Results results;
309 safe_browsing::dmg::AnalyzeDMGFile( 312 safe_browsing::dmg::AnalyzeDMGFile(
310 IPC::PlatformFileForTransitToFile(dmg_file), &results); 313 IPC::PlatformFileForTransitToFile(dmg_file), &results);
311 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( 314 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished(
312 results)); 315 results));
313 ReleaseProcessIfNeeded(); 316 ReleaseProcessIfNeeded();
314 } 317 }
315 #endif // defined(OS_MACOSX) 318 #endif // defined(OS_MACOSX)
316 319
317 #endif // defined(FULL_SAFE_BROWSING) 320 #endif // defined(FULL_SAFE_BROWSING)
OLDNEW
« no previous file with comments | « chrome/common/extensions/media_parser.mojom ('k') | chrome/utility/extensions/extensions_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698