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 "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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), | 212 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), |
213 profile_data_directory_(profile_data_directory), | 213 profile_data_directory_(profile_data_directory), |
214 is_broker_(false) { | 214 is_broker_(false) { |
215 process_.reset(new BrowserChildProcessHostImpl( | 215 process_.reset(new BrowserChildProcessHostImpl( |
216 PROCESS_TYPE_PPAPI_PLUGIN, this)); | 216 PROCESS_TYPE_PPAPI_PLUGIN, this)); |
217 | 217 |
218 filter_ = new PepperMessageFilter(permissions_, host_resolver); | 218 filter_ = new PepperMessageFilter(permissions_, host_resolver); |
219 | 219 |
220 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, | 220 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
221 info.path, profile_data_directory, | 221 info.path, profile_data_directory, |
222 false)); | 222 false, |
| 223 filter_)); |
223 | 224 |
224 process_->GetHost()->AddFilter(filter_.get()); | 225 process_->GetHost()->AddFilter(filter_.get()); |
225 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); | 226 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); |
226 | 227 |
227 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); | 228 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
228 | 229 |
229 // Only request network status updates if the plugin has dev permissions. | 230 // Only request network status updates if the plugin has dev permissions. |
230 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) | 231 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) |
231 network_observer_.reset(new PluginNetworkObserver(this)); | 232 network_observer_.reset(new PluginNetworkObserver(this)); |
232 } | 233 } |
233 | 234 |
234 PpapiPluginProcessHost::PpapiPluginProcessHost() | 235 PpapiPluginProcessHost::PpapiPluginProcessHost() |
235 : is_broker_(true) { | 236 : is_broker_(true) { |
236 process_.reset(new BrowserChildProcessHostImpl( | 237 process_.reset(new BrowserChildProcessHostImpl( |
237 PROCESS_TYPE_PPAPI_BROKER, this)); | 238 PROCESS_TYPE_PPAPI_BROKER, this)); |
238 | 239 |
239 ppapi::PpapiPermissions permissions; // No permissions. | 240 ppapi::PpapiPermissions permissions; // No permissions. |
240 // The plugin name, path and profile data directory shouldn't be needed for | 241 // The plugin name, path and profile data directory shouldn't be needed for |
241 // the broker. | 242 // the broker. |
242 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, | 243 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, |
243 std::string(), base::FilePath(), | 244 std::string(), base::FilePath(), |
244 base::FilePath(), | 245 base::FilePath(), |
245 false)); | 246 false, |
| 247 NULL)); |
246 } | 248 } |
247 | 249 |
248 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { | 250 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
249 plugin_path_ = info.path; | 251 plugin_path_ = info.path; |
250 if (info.name.empty()) { | 252 if (info.name.empty()) { |
251 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 253 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
252 } else { | 254 } else { |
253 process_->SetName(UTF8ToUTF16(info.name)); | 255 process_->SetName(UTF8ToUTF16(info.name)); |
254 } | 256 } |
255 | 257 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // sent_requests_ queue should be the one that the plugin just created. | 421 // sent_requests_ queue should be the one that the plugin just created. |
420 Client* client = sent_requests_.front(); | 422 Client* client = sent_requests_.front(); |
421 sent_requests_.pop(); | 423 sent_requests_.pop(); |
422 | 424 |
423 const ChildProcessData& data = process_->GetData(); | 425 const ChildProcessData& data = process_->GetData(); |
424 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 426 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
425 data.id); | 427 data.id); |
426 } | 428 } |
427 | 429 |
428 } // namespace content | 430 } // namespace content |
OLD | NEW |