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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), | 164 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), |
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 host_resolver); | 172 host_resolver); |
173 | 173 |
174 host_impl_ = new BrowserPpapiHostImpl(this, permissions_); | 174 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_)); |
175 | 175 |
176 file_filter_ = new PepperTrustedFileMessageFilter( | 176 file_filter_ = new PepperTrustedFileMessageFilter( |
177 process_->GetData().id, info.name, profile_data_directory); | 177 process_->GetData().id, info.name, profile_data_directory); |
178 | 178 |
179 process_->GetHost()->AddFilter(filter_.get()); | 179 process_->GetHost()->AddFilter(filter_.get()); |
180 process_->GetHost()->AddFilter(file_filter_.get()); | 180 process_->GetHost()->AddFilter(file_filter_.get()); |
181 process_->GetHost()->AddFilter(host_impl_.get()); | 181 process_->GetHost()->AddFilter(host_impl_->message_filter()); |
182 | 182 |
183 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_); | 183 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
184 } | 184 } |
185 | 185 |
186 PpapiPluginProcessHost::PpapiPluginProcessHost() | 186 PpapiPluginProcessHost::PpapiPluginProcessHost() |
187 : is_broker_(true) { | 187 : is_broker_(true) { |
188 process_.reset(new BrowserChildProcessHostImpl( | 188 process_.reset(new BrowserChildProcessHostImpl( |
189 PROCESS_TYPE_PPAPI_BROKER, this)); | 189 PROCESS_TYPE_PPAPI_BROKER, this)); |
190 | 190 |
191 ppapi::PpapiPermissions permissions; // No permissions. | 191 ppapi::PpapiPermissions permissions; // No permissions. |
192 host_impl_ = new BrowserPpapiHostImpl(this, permissions); | 192 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions)); |
193 } | 193 } |
194 | 194 |
195 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { | 195 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
196 plugin_path_ = info.path; | 196 plugin_path_ = info.path; |
197 if (info.name.empty()) { | 197 if (info.name.empty()) { |
198 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 198 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
199 } else { | 199 } else { |
200 process_->SetName(UTF8ToUTF16(info.name)); | 200 process_->SetName(UTF8ToUTF16(info.name)); |
201 } | 201 } |
202 | 202 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 // All requests should be processed FIFO, so the next item in the | 360 // All requests should be processed FIFO, so the next item in the |
361 // sent_requests_ queue should be the one that the plugin just created. | 361 // sent_requests_ queue should be the one that the plugin just created. |
362 Client* client = sent_requests_.front(); | 362 Client* client = sent_requests_.front(); |
363 sent_requests_.pop(); | 363 sent_requests_.pop(); |
364 | 364 |
365 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); | 365 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); |
366 } | 366 } |
367 | 367 |
368 } // namespace content | 368 } // namespace content |
OLD | NEW |