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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const PepperPluginInfo& info, | 158 const PepperPluginInfo& info, |
159 const FilePath& profile_data_directory, | 159 const FilePath& profile_data_directory, |
160 net::HostResolver* host_resolver) | 160 net::HostResolver* host_resolver) |
161 : permissions_( | 161 : permissions_( |
162 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), | 162 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), |
163 profile_data_directory_(profile_data_directory), | 163 profile_data_directory_(profile_data_directory), |
164 is_broker_(false) { | 164 is_broker_(false) { |
165 process_.reset(new BrowserChildProcessHostImpl( | 165 process_.reset(new BrowserChildProcessHostImpl( |
166 PROCESS_TYPE_PPAPI_PLUGIN, this)); | 166 PROCESS_TYPE_PPAPI_PLUGIN, this)); |
167 | 167 |
168 filter_ = new PepperMessageFilter(PepperMessageFilter::PLUGIN, | 168 filter_ = new PepperMessageFilter(process_->GetData().type, |
169 permissions_, | 169 permissions_, |
170 host_resolver); | 170 host_resolver); |
171 | 171 |
172 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, | 172 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
173 profile_data_directory)); | 173 profile_data_directory, |
| 174 process_->GetData().type)); |
174 | 175 |
175 process_->GetHost()->AddFilter(filter_.get()); | 176 process_->GetHost()->AddFilter(filter_.get()); |
176 process_->GetHost()->AddFilter(host_impl_->message_filter()); | 177 process_->GetHost()->AddFilter(host_impl_->message_filter()); |
177 | 178 |
178 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); | 179 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
179 | 180 |
180 // Only request network status updates if the plugin has dev permissions. | 181 // Only request network status updates if the plugin has dev permissions. |
181 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) | 182 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) |
182 network_observer_.reset(new PluginNetworkObserver(this)); | 183 network_observer_.reset(new PluginNetworkObserver(this)); |
183 } | 184 } |
184 | 185 |
185 PpapiPluginProcessHost::PpapiPluginProcessHost() | 186 PpapiPluginProcessHost::PpapiPluginProcessHost() |
186 : is_broker_(true) { | 187 : is_broker_(true) { |
187 process_.reset(new BrowserChildProcessHostImpl( | 188 process_.reset(new BrowserChildProcessHostImpl( |
188 PROCESS_TYPE_PPAPI_BROKER, this)); | 189 PROCESS_TYPE_PPAPI_BROKER, this)); |
189 | 190 |
190 ppapi::PpapiPermissions permissions; // No permissions. | 191 ppapi::PpapiPermissions permissions; // No permissions. |
191 // 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 |
192 // broker. | 193 // broker. |
193 std::string plugin_name; | 194 std::string plugin_name; |
194 FilePath profile_data_directory; | 195 FilePath profile_data_directory; |
195 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name, | 196 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name, |
196 profile_data_directory)); | 197 profile_data_directory, |
| 198 process_->GetData().type)); |
197 } | 199 } |
198 | 200 |
199 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { | 201 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
200 plugin_path_ = info.path; | 202 plugin_path_ = info.path; |
201 if (info.name.empty()) { | 203 if (info.name.empty()) { |
202 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 204 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
203 } else { | 205 } else { |
204 process_->SetName(UTF8ToUTF16(info.name)); | 206 process_->SetName(UTF8ToUTF16(info.name)); |
205 } | 207 } |
206 | 208 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // sent_requests_ queue should be the one that the plugin just created. | 371 // sent_requests_ queue should be the one that the plugin just created. |
370 Client* client = sent_requests_.front(); | 372 Client* client = sent_requests_.front(); |
371 sent_requests_.pop(); | 373 sent_requests_.pop(); |
372 | 374 |
373 const ChildProcessData& data = process_->GetData(); | 375 const ChildProcessData& data = process_->GetData(); |
374 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 376 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
375 data.id); | 377 data.id); |
376 } | 378 } |
377 | 379 |
378 } // namespace content | 380 } // namespace content |
OLD | NEW |