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