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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 uint32_t base_permissions = info.permissions; | 323 uint32_t base_permissions = info.permissions; |
324 | 324 |
325 // We don't have to do any whitelisting for APIs in this process host, so | 325 // We don't have to do any whitelisting for APIs in this process host, so |
326 // don't bother passing a browser context or document url here. | 326 // don't bother passing a browser context or document url here. |
327 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( | 327 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( |
328 NULL, GURL())) | 328 NULL, GURL())) |
329 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL; | 329 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL; |
330 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); | 330 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); |
331 | 331 |
332 process_.reset(new BrowserChildProcessHostImpl( | 332 process_.reset(new BrowserChildProcessHostImpl( |
333 PROCESS_TYPE_PPAPI_PLUGIN, this, mojo_child_token_)); | 333 PROCESS_TYPE_PPAPI_PLUGIN, this, mojo_child_token_, 0, nullptr)); |
334 | 334 |
335 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, | 335 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
336 info.path, profile_data_directory, | 336 info.path, profile_data_directory, |
337 false /* in_process */, | 337 false /* in_process */, |
338 false /* external_plugin */)); | 338 false /* external_plugin */)); |
339 | 339 |
340 filter_ = new PepperMessageFilter(); | 340 filter_ = new PepperMessageFilter(); |
341 process_->AddFilter(filter_.get()); | 341 process_->AddFilter(filter_.get()); |
342 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); | 342 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); |
343 #if defined(OS_WIN) | 343 #if defined(OS_WIN) |
344 process_->AddFilter(new DWriteFontProxyMessageFilter()); | 344 process_->AddFilter(new DWriteFontProxyMessageFilter()); |
345 #endif | 345 #endif |
346 | 346 |
347 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); | 347 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
348 | 348 |
349 // Only request network status updates if the plugin has dev permissions. | 349 // Only request network status updates if the plugin has dev permissions. |
350 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) | 350 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) |
351 network_observer_.reset(new PluginNetworkObserver(this)); | 351 network_observer_.reset(new PluginNetworkObserver(this)); |
352 } | 352 } |
353 | 353 |
354 PpapiPluginProcessHost::PpapiPluginProcessHost() | 354 PpapiPluginProcessHost::PpapiPluginProcessHost() |
355 : is_broker_(true), | 355 : is_broker_(true), |
356 mojo_child_token_(mojo::edk::GenerateRandomToken()) { | 356 mojo_child_token_(mojo::edk::GenerateRandomToken()) { |
357 process_.reset(new BrowserChildProcessHostImpl( | 357 process_.reset(new BrowserChildProcessHostImpl( |
358 PROCESS_TYPE_PPAPI_BROKER, this, mojo_child_token_)); | 358 PROCESS_TYPE_PPAPI_BROKER, this, mojo_child_token_, 0, nullptr)); |
359 | 359 |
360 ppapi::PpapiPermissions permissions; // No permissions. | 360 ppapi::PpapiPermissions permissions; // No permissions. |
361 // The plugin name, path and profile data directory shouldn't be needed for | 361 // The plugin name, path and profile data directory shouldn't be needed for |
362 // the broker. | 362 // the broker. |
363 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, | 363 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, |
364 std::string(), base::FilePath(), | 364 std::string(), base::FilePath(), |
365 base::FilePath(), | 365 base::FilePath(), |
366 false /* in_process */, | 366 false /* in_process */, |
367 false /* external_plugin */)); | 367 false /* external_plugin */)); |
368 } | 368 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // sent_requests_ queue should be the one that the plugin just created. | 560 // sent_requests_ queue should be the one that the plugin just created. |
561 Client* client = sent_requests_.front(); | 561 Client* client = sent_requests_.front(); |
562 sent_requests_.pop(); | 562 sent_requests_.pop(); |
563 | 563 |
564 const ChildProcessData& data = process_->GetData(); | 564 const ChildProcessData& data = process_->GetData(); |
565 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 565 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
566 data.id); | 566 data.id); |
567 } | 567 } |
568 | 568 |
569 } // namespace content | 569 } // namespace content |
OLD | NEW |