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

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 12213066: Use base namespace for FilePath in content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/browser/ppapi_plugin_process_host.h" 5 #include "content/browser/ppapi_plugin_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 PpapiPluginProcessHost::~PpapiPluginProcessHost() { 68 PpapiPluginProcessHost::~PpapiPluginProcessHost() {
69 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") 69 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "")
70 << "~PpapiPluginProcessHost()"; 70 << "~PpapiPluginProcessHost()";
71 CancelRequests(); 71 CancelRequests();
72 } 72 }
73 73
74 // static 74 // static
75 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( 75 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
76 const PepperPluginInfo& info, 76 const PepperPluginInfo& info,
77 const FilePath& profile_data_directory, 77 const base::FilePath& profile_data_directory,
78 net::HostResolver* host_resolver) { 78 net::HostResolver* host_resolver) {
79 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost( 79 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost(
80 info, profile_data_directory, host_resolver); 80 info, profile_data_directory, host_resolver);
81 if (plugin_host->Init(info)) 81 if (plugin_host->Init(info))
82 return plugin_host; 82 return plugin_host;
83 83
84 NOTREACHED(); // Init is not expected to fail. 84 NOTREACHED(); // Init is not expected to fail.
85 return NULL; 85 return NULL;
86 } 86 }
87 87
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 pending_requests_.push_back(client); 159 pending_requests_.push_back(client);
160 return; 160 return;
161 } 161 }
162 162
163 // We already have an open channel, send a request right away to plugin. 163 // We already have an open channel, send a request right away to plugin.
164 RequestPluginChannel(client); 164 RequestPluginChannel(client);
165 } 165 }
166 166
167 PpapiPluginProcessHost::PpapiPluginProcessHost( 167 PpapiPluginProcessHost::PpapiPluginProcessHost(
168 const PepperPluginInfo& info, 168 const PepperPluginInfo& info,
169 const FilePath& profile_data_directory, 169 const base::FilePath& profile_data_directory,
170 net::HostResolver* host_resolver) 170 net::HostResolver* host_resolver)
171 : permissions_( 171 : permissions_(
172 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), 172 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)),
173 profile_data_directory_(profile_data_directory), 173 profile_data_directory_(profile_data_directory),
174 is_broker_(false) { 174 is_broker_(false) {
175 process_.reset(new BrowserChildProcessHostImpl( 175 process_.reset(new BrowserChildProcessHostImpl(
176 PROCESS_TYPE_PPAPI_PLUGIN, this)); 176 PROCESS_TYPE_PPAPI_PLUGIN, this));
177 177
178 filter_ = new PepperMessageFilter(process_->GetData().type, 178 filter_ = new PepperMessageFilter(process_->GetData().type,
179 permissions_, 179 permissions_,
(...skipping 15 matching lines...) Expand all
195 195
196 PpapiPluginProcessHost::PpapiPluginProcessHost() 196 PpapiPluginProcessHost::PpapiPluginProcessHost()
197 : is_broker_(true) { 197 : is_broker_(true) {
198 process_.reset(new BrowserChildProcessHostImpl( 198 process_.reset(new BrowserChildProcessHostImpl(
199 PROCESS_TYPE_PPAPI_BROKER, this)); 199 PROCESS_TYPE_PPAPI_BROKER, this));
200 200
201 ppapi::PpapiPermissions permissions; // No permissions. 201 ppapi::PpapiPermissions permissions; // No permissions.
202 // The plugin name and profile data directory shouldn't be needed for the 202 // The plugin name and profile data directory shouldn't be needed for the
203 // broker. 203 // broker.
204 std::string plugin_name; 204 std::string plugin_name;
205 FilePath profile_data_directory; 205 base::FilePath profile_data_directory;
206 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name, 206 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name,
207 profile_data_directory, 207 profile_data_directory,
208 process_->GetData().type)); 208 process_->GetData().type));
209 } 209 }
210 210
211 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { 211 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
212 plugin_path_ = info.path; 212 plugin_path_ = info.path;
213 if (info.name.empty()) { 213 if (info.name.empty()) {
214 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); 214 process_->SetName(plugin_path_.BaseName().LossyDisplayName());
215 } else { 215 } else {
216 process_->SetName(UTF8ToUTF16(info.name)); 216 process_->SetName(UTF8ToUTF16(info.name));
217 } 217 }
218 218
219 std::string channel_id = process_->GetHost()->CreateChannel(); 219 std::string channel_id = process_->GetHost()->CreateChannel();
220 if (channel_id.empty()) 220 if (channel_id.empty())
221 return false; 221 return false;
222 222
223 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 223 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
224 CommandLine::StringType plugin_launcher = 224 CommandLine::StringType plugin_launcher =
225 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); 225 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher);
226 226
227 #if defined(OS_LINUX) 227 #if defined(OS_LINUX)
228 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : 228 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF :
229 ChildProcessHost::CHILD_NORMAL; 229 ChildProcessHost::CHILD_NORMAL;
230 #else 230 #else
231 int flags = ChildProcessHost::CHILD_NORMAL; 231 int flags = ChildProcessHost::CHILD_NORMAL;
232 #endif 232 #endif
233 FilePath exe_path = ChildProcessHost::GetChildPath(flags); 233 base::FilePath exe_path = ChildProcessHost::GetChildPath(flags);
234 if (exe_path.empty()) 234 if (exe_path.empty())
235 return false; 235 return false;
236 236
237 CommandLine* cmd_line = new CommandLine(exe_path); 237 CommandLine* cmd_line = new CommandLine(exe_path);
238 cmd_line->AppendSwitchASCII(switches::kProcessType, 238 cmd_line->AppendSwitchASCII(switches::kProcessType,
239 is_broker_ ? switches::kPpapiBrokerProcess 239 is_broker_ ? switches::kPpapiBrokerProcess
240 : switches::kPpapiPluginProcess); 240 : switches::kPpapiPluginProcess);
241 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); 241 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
242 242
243 // These switches are forwarded to both plugin and broker pocesses. 243 // These switches are forwarded to both plugin and broker pocesses.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // the plugin is sandboxed, and we are not using a plugin launcher - having a 277 // the plugin is sandboxed, and we are not using a plugin launcher - having a
278 // plugin launcher means we need to use another process instead of just 278 // plugin launcher means we need to use another process instead of just
279 // forking the zygote. 279 // forking the zygote.
280 #if defined(OS_POSIX) 280 #if defined(OS_POSIX)
281 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; 281 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed;
282 if (!info.is_sandboxed) 282 if (!info.is_sandboxed)
283 cmd_line->AppendSwitchASCII(switches::kNoSandbox, ""); 283 cmd_line->AppendSwitchASCII(switches::kNoSandbox, "");
284 #endif // OS_POSIX 284 #endif // OS_POSIX
285 process_->Launch( 285 process_->Launch(
286 #if defined(OS_WIN) 286 #if defined(OS_WIN)
287 FilePath(), 287 base::FilePath(),
288 #elif defined(OS_POSIX) 288 #elif defined(OS_POSIX)
289 use_zygote, 289 use_zygote,
290 base::EnvironmentVector(), 290 base::EnvironmentVector(),
291 #endif 291 #endif
292 cmd_line); 292 cmd_line);
293 return true; 293 return true;
294 } 294 }
295 295
296 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { 296 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) {
297 base::ProcessHandle process_handle; 297 base::ProcessHandle process_handle;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // sent_requests_ queue should be the one that the plugin just created. 383 // sent_requests_ queue should be the one that the plugin just created.
384 Client* client = sent_requests_.front(); 384 Client* client = sent_requests_.front();
385 sent_requests_.pop(); 385 sent_requests_.pop();
386 386
387 const ChildProcessData& data = process_->GetData(); 387 const ChildProcessData& data = process_->GetData();
388 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 388 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
389 data.id); 389 data.id);
390 } 390 }
391 391
392 } // namespace content 392 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.h ('k') | content/browser/renderer_host/database_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698