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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ZygoteHandle g_ppapi_zygote; | 53 ZygoteHandle g_ppapi_zygote; |
54 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 54 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
55 | 55 |
56 // NOTE: changes to this class need to be reviewed by the security team. | 56 // NOTE: changes to this class need to be reviewed by the security team. |
57 class PpapiPluginSandboxedProcessLauncherDelegate | 57 class PpapiPluginSandboxedProcessLauncherDelegate |
58 : public content::SandboxedProcessLauncherDelegate { | 58 : public content::SandboxedProcessLauncherDelegate { |
59 public: | 59 public: |
60 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, | 60 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, |
61 const PepperPluginInfo& info, | 61 const PepperPluginInfo& info, |
62 ChildProcessHost* host) | 62 ChildProcessHost* host) |
63 : | |
64 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
65 info_(info), | 64 : info_(info), is_broker_(is_broker) { |
66 #endif // OS_WIN | 65 #elif defined(OS_MACOSX) || defined(OS_ANDROID) |
67 #if defined(OS_POSIX) | 66 : ipc_fd_(host->TakeClientFileDescriptor()) { |
68 ipc_fd_(host->TakeClientFileDescriptor()), | 67 #elif defined(OS_POSIX) |
69 #endif // OS_POSIX | 68 : ipc_fd_(host->TakeClientFileDescriptor()), is_broker_(is_broker) { |
70 is_broker_(is_broker) {} | 69 #else |
| 70 { |
| 71 #endif |
| 72 } |
71 | 73 |
72 ~PpapiPluginSandboxedProcessLauncherDelegate() override {} | 74 ~PpapiPluginSandboxedProcessLauncherDelegate() override {} |
73 | 75 |
74 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
75 bool ShouldSandbox() override { | 77 bool ShouldSandbox() override { |
76 return !is_broker_; | 78 return !is_broker_; |
77 } | 79 } |
78 | 80 |
79 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override { | 81 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override { |
80 if (is_broker_) | 82 if (is_broker_) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return SANDBOX_TYPE_PPAPI; | 135 return SANDBOX_TYPE_PPAPI; |
134 } | 136 } |
135 | 137 |
136 private: | 138 private: |
137 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
138 const PepperPluginInfo& info_; | 140 const PepperPluginInfo& info_; |
139 #endif // OS_WIN | 141 #endif // OS_WIN |
140 #if defined(OS_POSIX) | 142 #if defined(OS_POSIX) |
141 base::ScopedFD ipc_fd_; | 143 base::ScopedFD ipc_fd_; |
142 #endif // OS_POSIX | 144 #endif // OS_POSIX |
| 145 #if (defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)) || \ |
| 146 defined(OS_WIN) |
143 bool is_broker_; | 147 bool is_broker_; |
| 148 #endif |
144 | 149 |
145 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); | 150 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); |
146 }; | 151 }; |
147 | 152 |
148 class PpapiPluginProcessHost::PluginNetworkObserver | 153 class PpapiPluginProcessHost::PluginNetworkObserver |
149 : public net::NetworkChangeNotifier::IPAddressObserver, | 154 : public net::NetworkChangeNotifier::IPAddressObserver, |
150 public net::NetworkChangeNotifier::ConnectionTypeObserver { | 155 public net::NetworkChangeNotifier::ConnectionTypeObserver { |
151 public: | 156 public: |
152 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) | 157 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) |
153 : process_host_(process_host) { | 158 : process_host_(process_host) { |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 // sent_requests_ queue should be the one that the plugin just created. | 553 // sent_requests_ queue should be the one that the plugin just created. |
549 Client* client = sent_requests_.front(); | 554 Client* client = sent_requests_.front(); |
550 sent_requests_.pop(); | 555 sent_requests_.pop(); |
551 | 556 |
552 const ChildProcessData& data = process_->GetData(); | 557 const ChildProcessData& data = process_->GetData(); |
553 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 558 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
554 data.id); | 559 data.id); |
555 } | 560 } |
556 | 561 |
557 } // namespace content | 562 } // namespace content |
OLD | NEW |