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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 2663603002: Convert utility process ImageWriter IPC to mojo (Closed)
Patch Set: Use https: in bug references, minor comment fixes. Created 3 years, 10 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 8fcd114315a27d1afb5b2fbcc241732938c23e0f..7e5cd72e2a1947a4ad8fdd0afb7d452be3f4e738 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -17,7 +17,6 @@
#include "chrome/common/file_patcher.mojom.h"
#include "chrome/common/safe_browsing/zip_analyzer.h"
#include "chrome/common/safe_browsing/zip_analyzer_results.h"
-#include "chrome/utility/chrome_content_utility_ipc_whitelist.h"
#include "chrome/utility/utility_message_handler.h"
#include "components/safe_json/utility/safe_json_parser_mojo_impl.h"
#include "content/public/child/image_decoder_utils.h"
@@ -51,7 +50,6 @@
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/utility/extensions/extensions_handler.h"
-#include "chrome/utility/image_writer/image_writer_handler.h"
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
@@ -149,10 +147,9 @@ std::unique_ptr<service_manager::Service> CreateImageDecoderService() {
} // namespace
ChromeContentUtilityClient::ChromeContentUtilityClient()
- : filter_messages_(false) {
+ : utility_process_running_elevated_(false) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
handlers_.push_back(new extensions::ExtensionsHandler());
- handlers_.push_back(new image_writer::ImageWriterHandler());
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
@@ -165,30 +162,22 @@ ChromeContentUtilityClient::ChromeContentUtilityClient()
#endif
}
-ChromeContentUtilityClient::~ChromeContentUtilityClient() {
-}
+ChromeContentUtilityClient::~ChromeContentUtilityClient() = default;
void ChromeContentUtilityClient::UtilityThreadStarted() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
extensions::UtilityHandler::UtilityThreadStarted();
#endif
- if (kMessageWhitelistSize > 0) {
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) {
- message_id_whitelist_.insert(kMessageWhitelist,
- kMessageWhitelist + kMessageWhitelistSize);
- filter_messages_ = true;
- }
- }
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated))
+ utility_process_running_elevated_ = true;
}
bool ChromeContentUtilityClient::OnMessageReceived(
const IPC::Message& message) {
- if (filter_messages_ &&
- !base::ContainsKey(message_id_whitelist_, message.type())) {
+ if (utility_process_running_elevated_)
return false;
- }
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message)
@@ -224,17 +213,14 @@ bool ChromeContentUtilityClient::OnMessageReceived(
void ChromeContentUtilityClient::ExposeInterfacesToBrowser(
service_manager::InterfaceRegistry* registry) {
- 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);
+ registry, utility_client, utility_process_running_elevated_);
#endif
// If our process runs with elevated privileges, only add elevated Mojo
// services to the interface registry.
- if (running_elevated)
+ if (utility_process_running_elevated_)
return;
registry->AddInterface(base::Bind(&FilePatcherImpl::Create));
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | chrome/utility/chrome_content_utility_ipc_whitelist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698