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

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

Issue 10387195: Open pepper files directly in browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 PpapiPluginProcessHost::~PpapiPluginProcessHost() { 67 PpapiPluginProcessHost::~PpapiPluginProcessHost() {
68 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") 68 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "")
69 << "~PpapiPluginProcessHost()"; 69 << "~PpapiPluginProcessHost()";
70 CancelRequests(); 70 CancelRequests();
71 } 71 }
72 72
73 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( 73 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
74 const content::PepperPluginInfo& info, 74 const content::PepperPluginInfo& info,
75 const FilePath& profile_data_directory, 75 const FilePath& profile_data_directory,
76 net::HostResolver* host_resolver) { 76 net::HostResolver* host_resolver) {
77 PpapiPluginProcessHost* plugin_host = 77 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost(
78 new PpapiPluginProcessHost(profile_data_directory, host_resolver); 78 info.name, profile_data_directory, host_resolver);
79 if (plugin_host->Init(info)) 79 if (plugin_host->Init(info))
80 return plugin_host; 80 return plugin_host;
81 81
82 NOTREACHED(); // Init is not expected to fail. 82 NOTREACHED(); // Init is not expected to fail.
83 return NULL; 83 return NULL;
84 } 84 }
85 85
86 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( 86 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
87 const content::PepperPluginInfo& info) { 87 const content::PepperPluginInfo& info) {
88 PpapiPluginProcessHost* plugin_host = 88 PpapiPluginProcessHost* plugin_host =
(...skipping 16 matching lines...) Expand all
105 // be run once the channel is open. 105 // be run once the channel is open.
106 pending_requests_.push_back(client); 106 pending_requests_.push_back(client);
107 return; 107 return;
108 } 108 }
109 109
110 // We already have an open channel, send a request right away to plugin. 110 // We already have an open channel, send a request right away to plugin.
111 RequestPluginChannel(client); 111 RequestPluginChannel(client);
112 } 112 }
113 113
114 PpapiPluginProcessHost::PpapiPluginProcessHost( 114 PpapiPluginProcessHost::PpapiPluginProcessHost(
115 const std::string& plugin_name,
115 const FilePath& profile_data_directory, 116 const FilePath& profile_data_directory,
116 net::HostResolver* host_resolver) 117 net::HostResolver* host_resolver)
117 : filter_(new PepperMessageFilter(PepperMessageFilter::PLUGIN, 118 : network_observer_(new PluginNetworkObserver(this)),
118 host_resolver)),
119 network_observer_(new PluginNetworkObserver(this)),
120 profile_data_directory_(profile_data_directory), 119 profile_data_directory_(profile_data_directory),
121 is_broker_(false) { 120 is_broker_(false) {
122 process_.reset(new BrowserChildProcessHostImpl( 121 process_.reset(new BrowserChildProcessHostImpl(
123 content::PROCESS_TYPE_PPAPI_PLUGIN, this)); 122 content::PROCESS_TYPE_PPAPI_PLUGIN, this));
123
124 filter_ = new PepperMessageFilter(
125 PepperMessageFilter::PLUGIN, host_resolver);
126
127 file_filter_ = new PepperTrustedFileMessageFilter(
128 process_->GetData().id, plugin_name, profile_data_directory);
129
124 process_->GetHost()->AddFilter(filter_.get()); 130 process_->GetHost()->AddFilter(filter_.get());
131 process_->GetHost()->AddFilter(file_filter_.get());
125 } 132 }
126 133
127 PpapiPluginProcessHost::PpapiPluginProcessHost() 134 PpapiPluginProcessHost::PpapiPluginProcessHost()
128 : is_broker_(true) { 135 : is_broker_(true) {
129 process_.reset(new BrowserChildProcessHostImpl( 136 process_.reset(new BrowserChildProcessHostImpl(
130 content::PROCESS_TYPE_PPAPI_BROKER, this)); 137 content::PROCESS_TYPE_PPAPI_BROKER, this));
131 } 138 }
132 139
133 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { 140 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) {
134 plugin_path_ = info.path; 141 plugin_path_ = info.path;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (sent_requests_.empty()) 288 if (sent_requests_.empty())
282 return; 289 return;
283 290
284 // All requests should be processed FIFO, so the next item in the 291 // All requests should be processed FIFO, so the next item in the
285 // sent_requests_ queue should be the one that the plugin just created. 292 // sent_requests_ queue should be the one that the plugin just created.
286 Client* client = sent_requests_.front(); 293 Client* client = sent_requests_.front();
287 sent_requests_.pop(); 294 sent_requests_.pop();
288 295
289 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); 296 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id);
290 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698