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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 const FilePath& profile_data_directory, | 161 const FilePath& profile_data_directory, |
162 net::HostResolver* host_resolver) | 162 net::HostResolver* host_resolver) |
163 : permissions_( | 163 : permissions_( |
164 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), | 164 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), |
165 network_observer_(new PluginNetworkObserver(this)), | 165 network_observer_(new PluginNetworkObserver(this)), |
166 profile_data_directory_(profile_data_directory), | 166 profile_data_directory_(profile_data_directory), |
167 is_broker_(false) { | 167 is_broker_(false) { |
168 process_.reset(new BrowserChildProcessHostImpl( | 168 process_.reset(new BrowserChildProcessHostImpl( |
169 PROCESS_TYPE_PPAPI_PLUGIN, this)); | 169 PROCESS_TYPE_PPAPI_PLUGIN, this)); |
170 | 170 |
171 filter_ = new PepperMessageFilter(PepperMessageFilter::PLUGIN, | 171 filter_ = new PepperMessageFilter(process_->GetData().type, |
172 permissions_, | 172 permissions_, |
173 host_resolver); | 173 host_resolver); |
174 | 174 |
175 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, | 175 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
176 profile_data_directory, process_->GetData().id)); | 176 profile_data_directory, |
| 177 process_->GetData().id, |
| 178 process_->GetData().type)); |
177 | 179 |
178 process_->GetHost()->AddFilter(filter_.get()); | 180 process_->GetHost()->AddFilter(filter_.get()); |
179 process_->GetHost()->AddFilter(host_impl_->message_filter()); | 181 process_->GetHost()->AddFilter(host_impl_->message_filter()); |
180 | 182 |
181 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); | 183 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
182 } | 184 } |
183 | 185 |
184 PpapiPluginProcessHost::PpapiPluginProcessHost() | 186 PpapiPluginProcessHost::PpapiPluginProcessHost() |
185 : is_broker_(true) { | 187 : is_broker_(true) { |
186 process_.reset(new BrowserChildProcessHostImpl( | 188 process_.reset(new BrowserChildProcessHostImpl( |
187 PROCESS_TYPE_PPAPI_BROKER, this)); | 189 PROCESS_TYPE_PPAPI_BROKER, this)); |
188 | 190 |
189 ppapi::PpapiPermissions permissions; // No permissions. | 191 ppapi::PpapiPermissions permissions; // No permissions. |
190 // The plugin name and profile data directory shouldn't be needed for the | 192 // The plugin name and profile data directory shouldn't be needed for the |
191 // broker. | 193 // broker. |
192 std::string plugin_name; | 194 std::string plugin_name; |
193 FilePath profile_data_directory; | 195 FilePath profile_data_directory; |
194 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name, | 196 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name, |
195 profile_data_directory, process_->GetData().id)); | 197 profile_data_directory, |
| 198 process_->GetData().id, |
| 199 process_->GetData().type)); |
196 } | 200 } |
197 | 201 |
198 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { | 202 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
199 plugin_path_ = info.path; | 203 plugin_path_ = info.path; |
200 if (info.name.empty()) { | 204 if (info.name.empty()) { |
201 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 205 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
202 } else { | 206 } else { |
203 process_->SetName(UTF8ToUTF16(info.name)); | 207 process_->SetName(UTF8ToUTF16(info.name)); |
204 } | 208 } |
205 | 209 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 368 |
365 // All requests should be processed FIFO, so the next item in the | 369 // All requests should be processed FIFO, so the next item in the |
366 // sent_requests_ queue should be the one that the plugin just created. | 370 // sent_requests_ queue should be the one that the plugin just created. |
367 Client* client = sent_requests_.front(); | 371 Client* client = sent_requests_.front(); |
368 sent_requests_.pop(); | 372 sent_requests_.pop(); |
369 | 373 |
370 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); | 374 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); |
371 } | 375 } |
372 | 376 |
373 } // namespace content | 377 } // namespace content |
OLD | NEW |