| 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" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "content/browser/browser_child_process_host_impl.h" | 14 #include "content/browser/browser_child_process_host_impl.h" |
| 15 #include "content/browser/plugin_service_impl.h" | 15 #include "content/browser/plugin_service_impl.h" |
| 16 #include "content/browser/renderer_host/render_message_filter.h" | 16 #include "content/browser/renderer_host/render_message_filter.h" |
| 17 #include "content/common/child_process_host_impl.h" | 17 #include "content/common/child_process_host_impl.h" |
| 18 #include "content/common/child_process_messages.h" | 18 #include "content/common/child_process_messages.h" |
| 19 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
| 20 #include "content/public/common/content_constants.h" | 20 #include "content/public/common/content_constants.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/common/pepper_plugin_info.h" | 22 #include "content/public/common/pepper_plugin_info.h" |
| 23 #include "content/public/common/process_type.h" | 23 #include "content/public/common/process_type.h" |
| 24 #include "content/public/common/sandbox_type.h" |
| 24 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 25 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 25 #include "ipc/ipc_switches.h" | 26 #include "ipc/ipc_switches.h" |
| 26 #include "net/base/network_change_notifier.h" | 27 #include "net/base/network_change_notifier.h" |
| 27 #include "ppapi/proxy/ppapi_messages.h" | 28 #include "ppapi/proxy/ppapi_messages.h" |
| 28 #include "ui/base/ui_base_switches.h" | 29 #include "ui/base/ui_base_switches.h" |
| 29 | 30 |
| 30 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 31 #include "content/common/sandbox_win.h" | 32 #include "content/common/sandbox_win.h" |
| 32 #include "sandbox/win/src/sandbox_policy.h" | 33 #include "sandbox/win/src/sandbox_policy.h" |
| 33 #endif | 34 #endif |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 bool ShouldUseZygote() override { | 72 bool ShouldUseZygote() override { |
| 72 const base::CommandLine& browser_command_line = | 73 const base::CommandLine& browser_command_line = |
| 73 *base::CommandLine::ForCurrentProcess(); | 74 *base::CommandLine::ForCurrentProcess(); |
| 74 base::CommandLine::StringType plugin_launcher = browser_command_line | 75 base::CommandLine::StringType plugin_launcher = browser_command_line |
| 75 .GetSwitchValueNative(switches::kPpapiPluginLauncher); | 76 .GetSwitchValueNative(switches::kPpapiPluginLauncher); |
| 76 return !is_broker_ && plugin_launcher.empty(); | 77 return !is_broker_ && plugin_launcher.empty(); |
| 77 } | 78 } |
| 78 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } | 79 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
| 79 #endif // OS_WIN | 80 #endif // OS_WIN |
| 80 | 81 |
| 82 SandboxType GetSandboxType() override { |
| 83 return SANDBOX_TYPE_PPAPI; |
| 84 } |
| 85 |
| 81 private: | 86 private: |
| 82 #if defined(OS_POSIX) | 87 #if defined(OS_POSIX) |
| 83 const PepperPluginInfo& info_; | 88 const PepperPluginInfo& info_; |
| 84 base::ScopedFD ipc_fd_; | 89 base::ScopedFD ipc_fd_; |
| 85 #endif // OS_POSIX | 90 #endif // OS_POSIX |
| 86 bool is_broker_; | 91 bool is_broker_; |
| 87 | 92 |
| 88 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); | 93 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); |
| 89 }; | 94 }; |
| 90 | 95 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // sent_requests_ queue should be the one that the plugin just created. | 484 // sent_requests_ queue should be the one that the plugin just created. |
| 480 Client* client = sent_requests_.front(); | 485 Client* client = sent_requests_.front(); |
| 481 sent_requests_.pop(); | 486 sent_requests_.pop(); |
| 482 | 487 |
| 483 const ChildProcessData& data = process_->GetData(); | 488 const ChildProcessData& data = process_->GetData(); |
| 484 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 489 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
| 485 data.id); | 490 data.id); |
| 486 } | 491 } |
| 487 | 492 |
| 488 } // namespace content | 493 } // namespace content |
| OLD | NEW |