| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // NOTE: changes to this class need to be reviewed by the security team. | 58 // NOTE: changes to this class need to be reviewed by the security team. |
| 59 class PpapiPluginSandboxedProcessLauncherDelegate | 59 class PpapiPluginSandboxedProcessLauncherDelegate |
| 60 : public content::SandboxedProcessLauncherDelegate { | 60 : public content::SandboxedProcessLauncherDelegate { |
| 61 public: | 61 public: |
| 62 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, | 62 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, |
| 63 const PepperPluginInfo& info, | 63 const PepperPluginInfo& info, |
| 64 ChildProcessHost* host) | 64 ChildProcessHost* host) |
| 65 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
| 66 : info_(info), is_broker_(is_broker) { | 66 : info_(info), is_broker_(is_broker) { |
| 67 #elif defined(OS_MACOSX) || defined(OS_ANDROID) | 67 #elif defined(OS_MACOSX) || defined(OS_ANDROID) |
| 68 : ipc_fd_(host->TakeClientFileDescriptor()) { | 68 : { |
| 69 #elif defined(OS_POSIX) | 69 #elif defined(OS_POSIX) |
| 70 : ipc_fd_(host->TakeClientFileDescriptor()), is_broker_(is_broker) { | 70 : is_broker_(is_broker) { |
| 71 #else | 71 #else |
| 72 { | 72 { |
| 73 #endif | 73 #endif |
| 74 } | 74 } |
| 75 | 75 |
| 76 ~PpapiPluginSandboxedProcessLauncherDelegate() override {} | 76 ~PpapiPluginSandboxedProcessLauncherDelegate() override {} |
| 77 | 77 |
| 78 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
| 79 bool ShouldSandbox() override { | 79 bool ShouldSandbox() override { |
| 80 return !is_broker_; | 80 return !is_broker_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const base::CommandLine& browser_command_line = | 123 const base::CommandLine& browser_command_line = |
| 124 *base::CommandLine::ForCurrentProcess(); | 124 *base::CommandLine::ForCurrentProcess(); |
| 125 base::CommandLine::StringType plugin_launcher = browser_command_line | 125 base::CommandLine::StringType plugin_launcher = browser_command_line |
| 126 .GetSwitchValueNative(switches::kPpapiPluginLauncher); | 126 .GetSwitchValueNative(switches::kPpapiPluginLauncher); |
| 127 if (is_broker_ || !plugin_launcher.empty()) | 127 if (is_broker_ || !plugin_launcher.empty()) |
| 128 return nullptr; | 128 return nullptr; |
| 129 return GetGenericZygote(); | 129 return GetGenericZygote(); |
| 130 } | 130 } |
| 131 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) | 131 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 132 | 132 |
| 133 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } | |
| 134 #endif // OS_WIN | 133 #endif // OS_WIN |
| 135 | 134 |
| 136 SandboxType GetSandboxType() override { | 135 SandboxType GetSandboxType() override { |
| 137 return SANDBOX_TYPE_PPAPI; | 136 return SANDBOX_TYPE_PPAPI; |
| 138 } | 137 } |
| 139 | 138 |
| 140 private: | 139 private: |
| 141 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
| 142 const PepperPluginInfo& info_; | 141 const PepperPluginInfo& info_; |
| 143 #endif // OS_WIN | 142 #endif // OS_WIN |
| 144 #if defined(OS_POSIX) | 143 #if defined(OS_POSIX) |
| 145 base::ScopedFD ipc_fd_; | |
| 146 #endif // OS_POSIX | 144 #endif // OS_POSIX |
| 147 #if (defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)) || \ | 145 #if (defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)) || \ |
| 148 defined(OS_WIN) | 146 defined(OS_WIN) |
| 149 bool is_broker_; | 147 bool is_broker_; |
| 150 #endif | 148 #endif |
| 151 | 149 |
| 152 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); | 150 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); |
| 153 }; | 151 }; |
| 154 | 152 |
| 155 class PpapiPluginProcessHost::PluginNetworkObserver | 153 class PpapiPluginProcessHost::PluginNetworkObserver |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 // sent_requests_ queue should be the one that the plugin just created. | 558 // sent_requests_ queue should be the one that the plugin just created. |
| 561 Client* client = sent_requests_.front(); | 559 Client* client = sent_requests_.front(); |
| 562 sent_requests_.pop(); | 560 sent_requests_.pop(); |
| 563 | 561 |
| 564 const ChildProcessData& data = process_->GetData(); | 562 const ChildProcessData& data = process_->GetData(); |
| 565 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 563 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
| 566 data.id); | 564 data.id); |
| 567 } | 565 } |
| 568 | 566 |
| 569 } // namespace content | 567 } // namespace content |
| OLD | NEW |