| 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" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 for (Handlers::iterator it = handlers_.begin(); | 190 for (Handlers::iterator it = handlers_.begin(); |
| 191 !handled && it != handlers_.end(); ++it) { | 191 !handled && it != handlers_.end(); ++it) { |
| 192 handled = (*it)->OnMessageReceived(message); | 192 handled = (*it)->OnMessageReceived(message); |
| 193 } | 193 } |
| 194 | 194 |
| 195 return handled; | 195 return handled; |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ChromeContentUtilityClient::RegisterMojoServices( | 198 void ChromeContentUtilityClient::RegisterMojoServices( |
| 199 content::ServiceRegistry* registry) { | 199 content::ServiceRegistry* registry) { |
| 200 // When the utility process is running with elevated privileges, we need to |
| 201 // filter messages so that only a whitelist of IPCs can run. In Mojo, there's |
| 202 // no way of filtering individual messages. Instead, we can avoid adding |
| 203 // non-whitelisted Mojo services to the ServiceRegistry. |
| 204 // TODO(amistry): Use a whitelist once the whistlisted IPCs have been |
| 205 // converted to Mojo. |
| 206 if (filter_messages_) |
| 207 return; |
| 208 |
| 200 #if !defined(OS_ANDROID) | 209 #if !defined(OS_ANDROID) |
| 201 registry->AddService<net::interfaces::ProxyResolverFactory>( | 210 registry->AddService<net::interfaces::ProxyResolverFactory>( |
| 202 base::Bind(CreateProxyResolverFactory)); | 211 base::Bind(CreateProxyResolverFactory)); |
| 203 registry->AddService<ResourceUsageReporter>( | 212 registry->AddService<ResourceUsageReporter>( |
| 204 base::Bind(CreateResourceUsageReporter)); | 213 base::Bind(CreateResourceUsageReporter)); |
| 205 #endif | 214 #endif |
| 206 } | 215 } |
| 207 | 216 |
| 208 void ChromeContentUtilityClient::AddHandler( | 217 void ChromeContentUtilityClient::AddHandler( |
| 209 scoped_ptr<UtilityMessageHandler> handler) { | 218 scoped_ptr<UtilityMessageHandler> handler) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 safe_browsing::zip_analyzer::Results results; | 414 safe_browsing::zip_analyzer::Results results; |
| 406 safe_browsing::dmg::AnalyzeDMGFile( | 415 safe_browsing::dmg::AnalyzeDMGFile( |
| 407 IPC::PlatformFileForTransitToFile(dmg_file), &results); | 416 IPC::PlatformFileForTransitToFile(dmg_file), &results); |
| 408 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( | 417 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( |
| 409 results)); | 418 results)); |
| 410 ReleaseProcessIfNeeded(); | 419 ReleaseProcessIfNeeded(); |
| 411 } | 420 } |
| 412 #endif // defined(OS_MACOSX) | 421 #endif // defined(OS_MACOSX) |
| 413 | 422 |
| 414 #endif // defined(FULL_SAFE_BROWSING) | 423 #endif // defined(FULL_SAFE_BROWSING) |
| OLD | NEW |