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 13 matching lines...) Expand all Loading... |
24 #include "content/common/child_process_messages.h" | 24 #include "content/common/child_process_messages.h" |
25 #include "content/common/content_switches_internal.h" | 25 #include "content/common/content_switches_internal.h" |
26 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
27 #include "content/public/common/content_constants.h" | 27 #include "content/public/common/content_constants.h" |
28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
29 #include "content/public/common/pepper_plugin_info.h" | 29 #include "content/public/common/pepper_plugin_info.h" |
30 #include "content/public/common/process_type.h" | 30 #include "content/public/common/process_type.h" |
31 #include "content/public/common/sandbox_type.h" | 31 #include "content/public/common/sandbox_type.h" |
32 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 32 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
33 #include "ipc/ipc_switches.h" | 33 #include "ipc/ipc_switches.h" |
| 34 #include "mojo/edk/embedder/embedder.h" |
34 #include "net/base/network_change_notifier.h" | 35 #include "net/base/network_change_notifier.h" |
35 #include "ppapi/proxy/ppapi_messages.h" | 36 #include "ppapi/proxy/ppapi_messages.h" |
36 #include "ui/base/ui_base_switches.h" | 37 #include "ui/base/ui_base_switches.h" |
37 | 38 |
38 #if defined(OS_POSIX) | 39 #if defined(OS_POSIX) |
39 #include "content/public/browser/zygote_handle_linux.h" | 40 #include "content/public/browser/zygote_handle_linux.h" |
40 #endif // defined(OS_POSIX) | 41 #endif // defined(OS_POSIX) |
41 | 42 |
42 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
43 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" | 44 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 uint32_t base_permissions = info.permissions; | 321 uint32_t base_permissions = info.permissions; |
321 | 322 |
322 // We don't have to do any whitelisting for APIs in this process host, so | 323 // We don't have to do any whitelisting for APIs in this process host, so |
323 // don't bother passing a browser context or document url here. | 324 // don't bother passing a browser context or document url here. |
324 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( | 325 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( |
325 NULL, GURL())) | 326 NULL, GURL())) |
326 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL; | 327 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL; |
327 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); | 328 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); |
328 | 329 |
329 process_.reset(new BrowserChildProcessHostImpl( | 330 process_.reset(new BrowserChildProcessHostImpl( |
330 PROCESS_TYPE_PPAPI_PLUGIN, this)); | 331 PROCESS_TYPE_PPAPI_PLUGIN, this, mojo::edk::GenerateRandomToken())); |
331 | 332 |
332 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, | 333 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
333 info.path, profile_data_directory, | 334 info.path, profile_data_directory, |
334 false /* in_process */, | 335 false /* in_process */, |
335 false /* external_plugin */)); | 336 false /* external_plugin */)); |
336 | 337 |
337 filter_ = new PepperMessageFilter(); | 338 filter_ = new PepperMessageFilter(); |
338 process_->AddFilter(filter_.get()); | 339 process_->AddFilter(filter_.get()); |
339 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); | 340 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); |
340 #if defined(OS_WIN) | 341 #if defined(OS_WIN) |
341 process_->AddFilter(new DWriteFontProxyMessageFilter()); | 342 process_->AddFilter(new DWriteFontProxyMessageFilter()); |
342 #endif | 343 #endif |
343 | 344 |
344 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); | 345 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); |
345 | 346 |
346 // Only request network status updates if the plugin has dev permissions. | 347 // Only request network status updates if the plugin has dev permissions. |
347 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) | 348 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) |
348 network_observer_.reset(new PluginNetworkObserver(this)); | 349 network_observer_.reset(new PluginNetworkObserver(this)); |
349 } | 350 } |
350 | 351 |
351 PpapiPluginProcessHost::PpapiPluginProcessHost() | 352 PpapiPluginProcessHost::PpapiPluginProcessHost() |
352 : is_broker_(true) { | 353 : is_broker_(true) { |
353 process_.reset(new BrowserChildProcessHostImpl( | 354 process_.reset(new BrowserChildProcessHostImpl( |
354 PROCESS_TYPE_PPAPI_BROKER, this)); | 355 PROCESS_TYPE_PPAPI_BROKER, this, mojo::edk::GenerateRandomToken())); |
355 | 356 |
356 ppapi::PpapiPermissions permissions; // No permissions. | 357 ppapi::PpapiPermissions permissions; // No permissions. |
357 // The plugin name, path and profile data directory shouldn't be needed for | 358 // The plugin name, path and profile data directory shouldn't be needed for |
358 // the broker. | 359 // the broker. |
359 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, | 360 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, |
360 std::string(), base::FilePath(), | 361 std::string(), base::FilePath(), |
361 base::FilePath(), | 362 base::FilePath(), |
362 false /* in_process */, | 363 false /* in_process */, |
363 false /* external_plugin */)); | 364 false /* external_plugin */)); |
364 } | 365 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 // sent_requests_ queue should be the one that the plugin just created. | 554 // sent_requests_ queue should be the one that the plugin just created. |
554 Client* client = sent_requests_.front(); | 555 Client* client = sent_requests_.front(); |
555 sent_requests_.pop(); | 556 sent_requests_.pop(); |
556 | 557 |
557 const ChildProcessData& data = process_->GetData(); | 558 const ChildProcessData& data = process_->GetData(); |
558 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 559 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
559 data.id); | 560 data.id); |
560 } | 561 } |
561 | 562 |
562 } // namespace content | 563 } // namespace content |
OLD | NEW |