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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 2615423002: Convert utility process ParseMediaMetadata IPC to mojo (Closed)
Patch Set: More review comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 2fea5c2f9ca90654d7990acc0bc056474a4c20e7..436ee9e50bb5161121d3d0878366361a67d6399b 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -115,7 +115,7 @@ std::unique_ptr<service_manager::Service> CreateImageDecoderService() {
ChromeContentUtilityClient::ChromeContentUtilityClient()
: filter_messages_(false) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
- handlers_.push_back(new extensions::ExtensionsHandler(this));
+ handlers_.push_back(new extensions::ExtensionsHandler());
handlers_.push_back(new image_writer::ImageWriterHandler());
#endif
@@ -192,13 +192,17 @@ bool ChromeContentUtilityClient::OnMessageReceived(
void ChromeContentUtilityClient::ExposeInterfacesToBrowser(
service_manager::InterfaceRegistry* registry) {
- // When the utility process is running with elevated privileges, we need to
- // filter messages so that only a whitelist of IPCs can run. In Mojo, there's
- // no way of filtering individual messages. Instead, we can avoid adding
- // non-whitelisted Mojo services to the service_manager::InterfaceRegistry.
- // TODO(amistry): Use a whitelist once the whistlisted IPCs have been
- // converted to Mojo.
- if (filter_messages_)
+ const bool running_elevated =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUtilityProcessRunningElevated);
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ ChromeContentUtilityClient* utility_client = this;
+ extensions::ExtensionsHandler::ExposeInterfacesToBrowser(
+ registry, utility_client, running_elevated);
+#endif
+ // If our process runs with elevated privileges, only add elevated
+ // Mojo services to the interface registry.
+ if (running_elevated)
dcheng 2017/01/11 09:09:59 Since this was changed, I wonder why we don't filt
Noel Gordon 2017/01/12 14:11:20 Great question. Looks like a potential bug to me.
Noel Gordon 2017/01/12 23:19:04 https://cs.chromium.org/search/?q=ElevatePrivilege
dcheng 2017/01/13 09:21:04 OK. I hope we can clean up the filter_messages_ th
return;
#if !defined(OS_ANDROID)

Powered by Google App Engine
This is Rietveld 408576698