Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 22923014: TCPSockets are switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 PpapiPluginProcessHost::~PpapiPluginProcessHost() { 108 PpapiPluginProcessHost::~PpapiPluginProcessHost() {
109 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") 109 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "")
110 << "~PpapiPluginProcessHost()"; 110 << "~PpapiPluginProcessHost()";
111 CancelRequests(); 111 CancelRequests();
112 } 112 }
113 113
114 // static 114 // static
115 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( 115 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
116 const PepperPluginInfo& info, 116 const PepperPluginInfo& info,
117 const base::FilePath& profile_data_directory, 117 const base::FilePath& profile_data_directory) {
118 net::HostResolver* host_resolver) {
119 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost( 118 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost(
120 info, profile_data_directory, host_resolver); 119 info, profile_data_directory);
121 if (plugin_host->Init(info)) 120 if (plugin_host->Init(info))
122 return plugin_host; 121 return plugin_host;
123 122
124 NOTREACHED(); // Init is not expected to fail. 123 NOTREACHED(); // Init is not expected to fail.
125 return NULL; 124 return NULL;
126 } 125 }
127 126
128 // static 127 // static
129 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( 128 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
130 const PepperPluginInfo& info) { 129 const PepperPluginInfo& info) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 pending_requests_.push_back(client); 198 pending_requests_.push_back(client);
200 return; 199 return;
201 } 200 }
202 201
203 // We already have an open channel, send a request right away to plugin. 202 // We already have an open channel, send a request right away to plugin.
204 RequestPluginChannel(client); 203 RequestPluginChannel(client);
205 } 204 }
206 205
207 PpapiPluginProcessHost::PpapiPluginProcessHost( 206 PpapiPluginProcessHost::PpapiPluginProcessHost(
208 const PepperPluginInfo& info, 207 const PepperPluginInfo& info,
209 const base::FilePath& profile_data_directory, 208 const base::FilePath& profile_data_directory)
210 net::HostResolver* host_resolver)
211 : permissions_( 209 : permissions_(
212 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), 210 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)),
213 profile_data_directory_(profile_data_directory), 211 profile_data_directory_(profile_data_directory),
214 is_broker_(false) { 212 is_broker_(false) {
215 process_.reset(new BrowserChildProcessHostImpl( 213 process_.reset(new BrowserChildProcessHostImpl(
216 PROCESS_TYPE_PPAPI_PLUGIN, this)); 214 PROCESS_TYPE_PPAPI_PLUGIN, this));
217 215
218 filter_ = new PepperMessageFilter(permissions_, host_resolver);
219
220 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, 216 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name,
221 info.path, profile_data_directory, 217 info.path, profile_data_directory,
222 false, 218 false));
223 filter_));
224 219
220 filter_ = PepperMessageFilter::CreateForPpapiPluginProcess(permissions_);
225 process_->GetHost()->AddFilter(filter_.get()); 221 process_->GetHost()->AddFilter(filter_.get());
226 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); 222 process_->GetHost()->AddFilter(host_impl_->message_filter().get());
227 223
228 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); 224 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get());
229 225
230 // Only request network status updates if the plugin has dev permissions. 226 // Only request network status updates if the plugin has dev permissions.
231 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) 227 if (permissions_.HasPermission(ppapi::PERMISSION_DEV))
232 network_observer_.reset(new PluginNetworkObserver(this)); 228 network_observer_.reset(new PluginNetworkObserver(this));
233 } 229 }
234 230
235 PpapiPluginProcessHost::PpapiPluginProcessHost() 231 PpapiPluginProcessHost::PpapiPluginProcessHost()
236 : is_broker_(true) { 232 : is_broker_(true) {
237 process_.reset(new BrowserChildProcessHostImpl( 233 process_.reset(new BrowserChildProcessHostImpl(
238 PROCESS_TYPE_PPAPI_BROKER, this)); 234 PROCESS_TYPE_PPAPI_BROKER, this));
239 235
240 ppapi::PpapiPermissions permissions; // No permissions. 236 ppapi::PpapiPermissions permissions; // No permissions.
241 // The plugin name, path and profile data directory shouldn't be needed for 237 // The plugin name, path and profile data directory shouldn't be needed for
242 // the broker. 238 // the broker.
243 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, 239 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions,
244 std::string(), base::FilePath(), 240 std::string(), base::FilePath(),
245 base::FilePath(), 241 base::FilePath(),
246 false, 242 false));
247 NULL));
248 } 243 }
249 244
250 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { 245 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
251 plugin_path_ = info.path; 246 plugin_path_ = info.path;
252 if (info.name.empty()) { 247 if (info.name.empty()) {
253 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); 248 process_->SetName(plugin_path_.BaseName().LossyDisplayName());
254 } else { 249 } else {
255 process_->SetName(UTF8ToUTF16(info.name)); 250 process_->SetName(UTF8ToUTF16(info.name));
256 } 251 }
257 252
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // sent_requests_ queue should be the one that the plugin just created. 424 // sent_requests_ queue should be the one that the plugin just created.
430 Client* client = sent_requests_.front(); 425 Client* client = sent_requests_.front();
431 sent_requests_.pop(); 426 sent_requests_.pop();
432 427
433 const ChildProcessData& data = process_->GetData(); 428 const ChildProcessData& data = process_->GetData();
434 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 429 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
435 data.id); 430 data.id);
436 } 431 }
437 432
438 } // namespace content 433 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.h ('k') | content/browser/renderer_host/pepper/browser_ppapi_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698