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