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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return; | 200 return; |
201 } | 201 } |
202 | 202 |
203 // We already have an open channel, send a request right away to plugin. | 203 // We already have an open channel, send a request right away to plugin. |
204 RequestPluginChannel(client); | 204 RequestPluginChannel(client); |
205 } | 205 } |
206 | 206 |
207 PpapiPluginProcessHost::PpapiPluginProcessHost( | 207 PpapiPluginProcessHost::PpapiPluginProcessHost( |
208 const PepperPluginInfo& info, | 208 const PepperPluginInfo& info, |
209 const base::FilePath& profile_data_directory) | 209 const base::FilePath& profile_data_directory) |
210 : permissions_( | 210 : profile_data_directory_(profile_data_directory), |
211 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), | |
212 profile_data_directory_(profile_data_directory), | |
213 is_broker_(false) { | 211 is_broker_(false) { |
| 212 uint32 base_permissions = info.permissions; |
| 213 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs()) |
| 214 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL; |
| 215 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); |
| 216 |
214 process_.reset(new BrowserChildProcessHostImpl( | 217 process_.reset(new BrowserChildProcessHostImpl( |
215 PROCESS_TYPE_PPAPI_PLUGIN, this)); | 218 PROCESS_TYPE_PPAPI_PLUGIN, this)); |
216 | 219 |
217 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, | 220 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
218 info.path, profile_data_directory, | 221 info.path, profile_data_directory, |
219 false /* in_process */, | 222 false /* in_process */, |
220 false /* external_plugin */)); | 223 false /* external_plugin */)); |
221 | 224 |
222 filter_ = new PepperMessageFilter(); | 225 filter_ = new PepperMessageFilter(); |
223 process_->AddFilter(filter_.get()); | 226 process_->AddFilter(filter_.get()); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, | 380 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, |
378 OnRendererPluginChannelCreated) | 381 OnRendererPluginChannelCreated) |
379 IPC_MESSAGE_UNHANDLED(handled = false) | 382 IPC_MESSAGE_UNHANDLED(handled = false) |
380 IPC_END_MESSAGE_MAP() | 383 IPC_END_MESSAGE_MAP() |
381 DCHECK(handled); | 384 DCHECK(handled); |
382 return handled; | 385 return handled; |
383 } | 386 } |
384 | 387 |
385 // Called when the browser <--> plugin channel has been established. | 388 // Called when the browser <--> plugin channel has been established. |
386 void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { | 389 void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { |
387 bool supports_dev_channel = | |
388 GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs(); | |
389 // This will actually load the plugin. Errors will actually not be reported | 390 // This will actually load the plugin. Errors will actually not be reported |
390 // back at this point. Instead, the plugin will fail to establish the | 391 // back at this point. Instead, the plugin will fail to establish the |
391 // connections when we request them on behalf of the renderer(s). | 392 // connections when we request them on behalf of the renderer(s). |
392 Send(new PpapiMsg_LoadPlugin(plugin_path_, permissions_, | 393 Send(new PpapiMsg_LoadPlugin(plugin_path_, permissions_)); |
393 supports_dev_channel)); | |
394 | 394 |
395 // Process all pending channel requests from the renderers. | 395 // Process all pending channel requests from the renderers. |
396 for (size_t i = 0; i < pending_requests_.size(); i++) | 396 for (size_t i = 0; i < pending_requests_.size(); i++) |
397 RequestPluginChannel(pending_requests_[i]); | 397 RequestPluginChannel(pending_requests_[i]); |
398 pending_requests_.clear(); | 398 pending_requests_.clear(); |
399 } | 399 } |
400 | 400 |
401 // Called when the browser <--> plugin channel has an error. This normally | 401 // Called when the browser <--> plugin channel has an error. This normally |
402 // means the plugin has crashed. | 402 // means the plugin has crashed. |
403 void PpapiPluginProcessHost::OnChannelError() { | 403 void PpapiPluginProcessHost::OnChannelError() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 // sent_requests_ queue should be the one that the plugin just created. | 436 // sent_requests_ queue should be the one that the plugin just created. |
437 Client* client = sent_requests_.front(); | 437 Client* client = sent_requests_.front(); |
438 sent_requests_.pop(); | 438 sent_requests_.pop(); |
439 | 439 |
440 const ChildProcessData& data = process_->GetData(); | 440 const ChildProcessData& data = process_->GetData(); |
441 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 441 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
442 data.id); | 442 data.id); |
443 } | 443 } |
444 | 444 |
445 } // namespace content | 445 } // namespace content |
OLD | NEW |