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

Unified Diff: content/public/browser/utility_process_mojo_client.h

Issue 2610953003: Convert utility process WiFi Credentials IPC to mojo (Closed)
Patch Set: Add mojom test network name. 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
« no previous file with comments | « content/browser/utility_process_mojo_client_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/utility_process_mojo_client.h
diff --git a/content/public/browser/utility_process_mojo_client.h b/content/public/browser/utility_process_mojo_client.h
index 29e76fa2fcc40c05dc7a63c1dad3640bd32a29e3..cfcb93b953dd1b87f3c8dc4dba6722809db9ac8b 100644
--- a/content/public/browser/utility_process_mojo_client.h
+++ b/content/public/browser/utility_process_mojo_client.h
@@ -48,6 +48,14 @@ class UtilityProcessMojoClient {
helper_->set_disable_sandbox();
}
+#if defined(OS_WIN)
+ // Allow the utility process to run with elevated privileges.
+ void set_run_elevated() {
+ DCHECK(!start_called_);
+ helper_->set_run_elevated();
+ }
+#endif // defined(OS_WIN)
+
// Starts the utility process and connect to the remote Mojo service.
void Start() {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -96,15 +104,30 @@ class UtilityProcessMojoClient {
void set_disable_sandbox() { disable_sandbox_ = true; }
+#if defined(OS_WIN)
+ void set_run_elevated() {
+ disable_sandbox_ = true;
+ run_elevated_ = true;
+ }
+#endif // defined(OS_WIN)
+
private:
// Starts the utility process and connects to the remote Mojo service.
void StartOnIOThread(const std::string& mojo_interface_name,
mojo::ScopedMessagePipeHandle interface_pipe) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
utility_host_ = UtilityProcessHost::Create(nullptr, nullptr)->AsWeakPtr();
utility_host_->SetName(process_name_);
+
if (disable_sandbox_)
utility_host_->DisableSandbox();
+#if defined(OS_WIN)
+ if (run_elevated_) {
+ DCHECK(disable_sandbox_);
+ utility_host_->ElevatePrivileges();
+ }
+#endif // defined(OS_WIN)
utility_host_->Start();
@@ -115,6 +138,9 @@ class UtilityProcessMojoClient {
// Properties of the utility process.
base::string16 process_name_;
bool disable_sandbox_ = false;
+#if defined(OS_WIN)
+ bool run_elevated_ = false;
+#endif // defined(OS_WIN)
// Must only be accessed on the IO thread.
base::WeakPtr<UtilityProcessHost> utility_host_;
« no previous file with comments | « content/browser/utility_process_mojo_client_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698