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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 process_->GetHost()->AddFilter(filter_.get()); | 135 process_->GetHost()->AddFilter(filter_.get()); |
136 process_->GetHost()->AddFilter(file_filter_.get()); | 136 process_->GetHost()->AddFilter(file_filter_.get()); |
137 process_->GetHost()->AddFilter(host_impl_.get()); | 137 process_->GetHost()->AddFilter(host_impl_.get()); |
138 } | 138 } |
139 | 139 |
140 PpapiPluginProcessHost::PpapiPluginProcessHost() | 140 PpapiPluginProcessHost::PpapiPluginProcessHost() |
141 : is_broker_(true) { | 141 : is_broker_(true) { |
142 process_.reset(new BrowserChildProcessHostImpl( | 142 process_.reset(new BrowserChildProcessHostImpl( |
143 content::PROCESS_TYPE_PPAPI_BROKER, this)); | 143 content::PROCESS_TYPE_PPAPI_BROKER, this)); |
| 144 |
| 145 ppapi::PpapiPermissions permissions; // No permissions. |
| 146 host_impl_ = new content::BrowserPpapiHostImpl(this, permissions); |
144 } | 147 } |
145 | 148 |
146 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { | 149 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { |
147 plugin_path_ = info.path; | 150 plugin_path_ = info.path; |
148 if (info.name.empty()) { | 151 if (info.name.empty()) { |
149 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 152 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
150 } else { | 153 } else { |
151 process_->SetName(UTF8ToUTF16(info.name)); | 154 process_->SetName(UTF8ToUTF16(info.name)); |
152 } | 155 } |
153 | 156 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 renderer_id, client->OffTheRecord()); | 239 renderer_id, client->OffTheRecord()); |
237 msg->set_unblock(true); | 240 msg->set_unblock(true); |
238 if (Send(msg)) { | 241 if (Send(msg)) { |
239 sent_requests_.push(client); | 242 sent_requests_.push(client); |
240 } else { | 243 } else { |
241 client->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); | 244 client->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); |
242 } | 245 } |
243 } | 246 } |
244 | 247 |
245 void PpapiPluginProcessHost::OnProcessLaunched() { | 248 void PpapiPluginProcessHost::OnProcessLaunched() { |
| 249 host_impl_->set_plugin_process_handle(process_->GetHandle()); |
246 } | 250 } |
247 | 251 |
248 bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 252 bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
249 bool handled = true; | 253 bool handled = true; |
250 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) | 254 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) |
251 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, | 255 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, |
252 OnRendererPluginChannelCreated) | 256 OnRendererPluginChannelCreated) |
253 IPC_MESSAGE_UNHANDLED(handled = false) | 257 IPC_MESSAGE_UNHANDLED(handled = false) |
254 IPC_END_MESSAGE_MAP() | 258 IPC_END_MESSAGE_MAP() |
255 DCHECK(handled); | 259 DCHECK(handled); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 if (sent_requests_.empty()) | 305 if (sent_requests_.empty()) |
302 return; | 306 return; |
303 | 307 |
304 // All requests should be processed FIFO, so the next item in the | 308 // All requests should be processed FIFO, so the next item in the |
305 // sent_requests_ queue should be the one that the plugin just created. | 309 // sent_requests_ queue should be the one that the plugin just created. |
306 Client* client = sent_requests_.front(); | 310 Client* client = sent_requests_.front(); |
307 sent_requests_.pop(); | 311 sent_requests_.pop(); |
308 | 312 |
309 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); | 313 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); |
310 } | 314 } |
OLD | NEW |