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

Side by Side Diff: content/public/browser/utility_process_mojo_client.h

Issue 2766263009: Convert content ConnectionFilter to OnBindInterface (Closed)
Patch Set: . Created 3 years, 8 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
« no previous file with comments | « content/public/browser/utility_process_host.h ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_
6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ 6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void set_disable_sandbox() { disable_sandbox_ = true; } 117 void set_disable_sandbox() { disable_sandbox_ = true; }
118 118
119 #if defined(OS_WIN) 119 #if defined(OS_WIN)
120 void set_run_elevated() { 120 void set_run_elevated() {
121 disable_sandbox_ = true; 121 disable_sandbox_ = true;
122 run_elevated_ = true; 122 run_elevated_ = true;
123 } 123 }
124 #endif // defined(OS_WIN) 124 #endif // defined(OS_WIN)
125 125
126 private: 126 private:
127 // Starts the utility process and connects to the remote Mojo service. 127 // Starts the utility process and binds the specified interface.
128 void StartOnIOThread(const std::string& mojo_interface_name, 128 void StartOnIOThread(const std::string& interface_name,
129 mojo::ScopedMessagePipeHandle interface_pipe) { 129 mojo::ScopedMessagePipeHandle interface_pipe) {
130 DCHECK_CURRENTLY_ON(BrowserThread::IO); 130 DCHECK_CURRENTLY_ON(BrowserThread::IO);
131 131
132 utility_host_ = UtilityProcessHost::Create(nullptr, nullptr)->AsWeakPtr(); 132 utility_host_ = UtilityProcessHost::Create(nullptr, nullptr)->AsWeakPtr();
133 utility_host_->SetName(process_name_); 133 utility_host_->SetName(process_name_);
134 134
135 if (!exposed_directory_.empty()) 135 if (!exposed_directory_.empty())
136 utility_host_->SetExposedDir(exposed_directory_); 136 utility_host_->SetExposedDir(exposed_directory_);
137 137
138 if (disable_sandbox_) 138 if (disable_sandbox_)
139 utility_host_->DisableSandbox(); 139 utility_host_->DisableSandbox();
140 #if defined(OS_WIN) 140 #if defined(OS_WIN)
141 if (run_elevated_) { 141 if (run_elevated_) {
142 DCHECK(disable_sandbox_); 142 DCHECK(disable_sandbox_);
143 utility_host_->ElevatePrivileges(); 143 utility_host_->ElevatePrivileges();
144 } 144 }
145 #endif // defined(OS_WIN) 145 #endif // defined(OS_WIN)
146 146
147 utility_host_->Start(); 147 utility_host_->Start();
148 148
149 utility_host_->GetRemoteInterfaces()->GetInterface( 149 utility_host_->BindInterface(interface_name, std::move(interface_pipe));
150 mojo_interface_name, std::move(interface_pipe));
151 } 150 }
152 151
153 // Properties of the utility process. 152 // Properties of the utility process.
154 base::string16 process_name_; 153 base::string16 process_name_;
155 base::FilePath exposed_directory_; 154 base::FilePath exposed_directory_;
156 bool disable_sandbox_ = false; 155 bool disable_sandbox_ = false;
157 #if defined(OS_WIN) 156 #if defined(OS_WIN)
158 bool run_elevated_ = false; 157 bool run_elevated_ = false;
159 #endif // defined(OS_WIN) 158 #endif // defined(OS_WIN)
160 159
(...skipping 15 matching lines...) Expand all
176 175
177 // Checks that this class is always accessed from the same thread. 176 // Checks that this class is always accessed from the same thread.
178 base::ThreadChecker thread_checker_; 177 base::ThreadChecker thread_checker_;
179 178
180 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoClient); 179 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoClient);
181 }; 180 };
182 181
183 } // namespace content 182 } // namespace content
184 183
185 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ 184 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_
OLDNEW
« no previous file with comments | « content/public/browser/utility_process_host.h ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698