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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(PepperMessageFilter::PLUGIN, |
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_)); |
176 profile_data_directory, process_->GetData().id)); | 176 |
| 177 file_filter_ = new PepperTrustedFileMessageFilter( |
| 178 process_->GetData().id, info.name, profile_data_directory); |
177 | 179 |
178 process_->GetHost()->AddFilter(filter_.get()); | 180 process_->GetHost()->AddFilter(filter_.get()); |
| 181 process_->GetHost()->AddFilter(file_filter_.get()); |
179 process_->GetHost()->AddFilter(host_impl_->message_filter()); | 182 process_->GetHost()->AddFilter(host_impl_->message_filter()); |
180 | 183 |
181 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); | 184 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
182 } | 185 } |
183 | 186 |
184 PpapiPluginProcessHost::PpapiPluginProcessHost() | 187 PpapiPluginProcessHost::PpapiPluginProcessHost() |
185 : is_broker_(true) { | 188 : is_broker_(true) { |
186 process_.reset(new BrowserChildProcessHostImpl( | 189 process_.reset(new BrowserChildProcessHostImpl( |
187 PROCESS_TYPE_PPAPI_BROKER, this)); | 190 PROCESS_TYPE_PPAPI_BROKER, this)); |
188 | 191 |
189 ppapi::PpapiPermissions permissions; // No permissions. | 192 ppapi::PpapiPermissions permissions; // No permissions. |
190 // The plugin name and profile data directory shouldn't be needed for the | 193 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions)); |
191 // broker. | |
192 std::string plugin_name; | |
193 FilePath profile_data_directory; | |
194 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name, | |
195 profile_data_directory, process_->GetData().id)); | |
196 } | 194 } |
197 | 195 |
198 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { | 196 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
199 plugin_path_ = info.path; | 197 plugin_path_ = info.path; |
200 if (info.name.empty()) { | 198 if (info.name.empty()) { |
201 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 199 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
202 } else { | 200 } else { |
203 process_->SetName(UTF8ToUTF16(info.name)); | 201 process_->SetName(UTF8ToUTF16(info.name)); |
204 } | 202 } |
205 | 203 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 362 |
365 // All requests should be processed FIFO, so the next item in the | 363 // 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. | 364 // sent_requests_ queue should be the one that the plugin just created. |
367 Client* client = sent_requests_.front(); | 365 Client* client = sent_requests_.front(); |
368 sent_requests_.pop(); | 366 sent_requests_.pop(); |
369 | 367 |
370 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); | 368 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); |
371 } | 369 } |
372 | 370 |
373 } // namespace content | 371 } // namespace content |
OLD | NEW |