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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 : | 44 : |
45 #if defined(OS_POSIX) | 45 #if defined(OS_POSIX) |
46 info_(info), | 46 info_(info), |
47 ipc_fd_(host->TakeClientFileDescriptor()), | 47 ipc_fd_(host->TakeClientFileDescriptor()), |
48 #endif // OS_POSIX | 48 #endif // OS_POSIX |
49 is_broker_(is_broker) {} | 49 is_broker_(is_broker) {} |
50 | 50 |
51 virtual ~PpapiPluginSandboxedProcessLauncherDelegate() {} | 51 virtual ~PpapiPluginSandboxedProcessLauncherDelegate() {} |
52 | 52 |
53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
54 virtual bool ShouldSandbox() OVERRIDE { | 54 virtual bool ShouldSandbox() override { |
55 return !is_broker_; | 55 return !is_broker_; |
56 } | 56 } |
57 | 57 |
58 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, | 58 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, |
59 bool* success) { | 59 bool* success) { |
60 if (is_broker_) | 60 if (is_broker_) |
61 return; | 61 return; |
62 // The Pepper process as locked-down as a renderer execpt that it can | 62 // The Pepper process as locked-down as a renderer execpt that it can |
63 // create the server side of chrome pipes. | 63 // create the server side of chrome pipes. |
64 sandbox::ResultCode result; | 64 sandbox::ResultCode result; |
65 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, | 65 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, |
66 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, | 66 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
67 L"\\\\.\\pipe\\chrome.*"); | 67 L"\\\\.\\pipe\\chrome.*"); |
68 *success = (result == sandbox::SBOX_ALL_OK); | 68 *success = (result == sandbox::SBOX_ALL_OK); |
69 } | 69 } |
70 | 70 |
71 #elif defined(OS_POSIX) | 71 #elif defined(OS_POSIX) |
72 virtual bool ShouldUseZygote() OVERRIDE { | 72 virtual bool ShouldUseZygote() override { |
73 const base::CommandLine& browser_command_line = | 73 const base::CommandLine& browser_command_line = |
74 *base::CommandLine::ForCurrentProcess(); | 74 *base::CommandLine::ForCurrentProcess(); |
75 base::CommandLine::StringType plugin_launcher = browser_command_line | 75 base::CommandLine::StringType plugin_launcher = browser_command_line |
76 .GetSwitchValueNative(switches::kPpapiPluginLauncher); | 76 .GetSwitchValueNative(switches::kPpapiPluginLauncher); |
77 return !is_broker_ && plugin_launcher.empty() && info_.is_sandboxed; | 77 return !is_broker_ && plugin_launcher.empty() && info_.is_sandboxed; |
78 } | 78 } |
79 virtual int GetIpcFd() OVERRIDE { | 79 virtual int GetIpcFd() override { |
80 return ipc_fd_; | 80 return ipc_fd_; |
81 } | 81 } |
82 #endif // OS_WIN | 82 #endif // OS_WIN |
83 | 83 |
84 private: | 84 private: |
85 #if defined(OS_POSIX) | 85 #if defined(OS_POSIX) |
86 const PepperPluginInfo& info_; | 86 const PepperPluginInfo& info_; |
87 int ipc_fd_; | 87 int ipc_fd_; |
88 #endif // OS_POSIX | 88 #endif // OS_POSIX |
89 bool is_broker_; | 89 bool is_broker_; |
(...skipping 10 matching lines...) Expand all Loading... |
100 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 100 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
101 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 101 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
102 } | 102 } |
103 | 103 |
104 virtual ~PluginNetworkObserver() { | 104 virtual ~PluginNetworkObserver() { |
105 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 105 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
106 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 106 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
107 } | 107 } |
108 | 108 |
109 // IPAddressObserver implementation. | 109 // IPAddressObserver implementation. |
110 virtual void OnIPAddressChanged() OVERRIDE { | 110 virtual void OnIPAddressChanged() override { |
111 // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline | 111 // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline |
112 // notification seems like it should be sufficient, but I don't see that | 112 // notification seems like it should be sufficient, but I don't see that |
113 // when I unplug and replug my network cable. Sending this notification when | 113 // when I unplug and replug my network cable. Sending this notification when |
114 // "something" changes seems to make Flash reasonably happy, but seems | 114 // "something" changes seems to make Flash reasonably happy, but seems |
115 // wrong. We should really be able to provide the real online state in | 115 // wrong. We should really be able to provide the real online state in |
116 // OnConnectionTypeChanged(). | 116 // OnConnectionTypeChanged(). |
117 process_host_->Send(new PpapiMsg_SetNetworkState(true)); | 117 process_host_->Send(new PpapiMsg_SetNetworkState(true)); |
118 } | 118 } |
119 | 119 |
120 // ConnectionTypeObserver implementation. | 120 // ConnectionTypeObserver implementation. |
121 virtual void OnConnectionTypeChanged( | 121 virtual void OnConnectionTypeChanged( |
122 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { | 122 net::NetworkChangeNotifier::ConnectionType type) override { |
123 process_host_->Send(new PpapiMsg_SetNetworkState( | 123 process_host_->Send(new PpapiMsg_SetNetworkState( |
124 type != net::NetworkChangeNotifier::CONNECTION_NONE)); | 124 type != net::NetworkChangeNotifier::CONNECTION_NONE)); |
125 } | 125 } |
126 | 126 |
127 private: | 127 private: |
128 PpapiPluginProcessHost* const process_host_; | 128 PpapiPluginProcessHost* const process_host_; |
129 }; | 129 }; |
130 | 130 |
131 PpapiPluginProcessHost::~PpapiPluginProcessHost() { | 131 PpapiPluginProcessHost::~PpapiPluginProcessHost() { |
132 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") | 132 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // sent_requests_ queue should be the one that the plugin just created. | 464 // sent_requests_ queue should be the one that the plugin just created. |
465 Client* client = sent_requests_.front(); | 465 Client* client = sent_requests_.front(); |
466 sent_requests_.pop(); | 466 sent_requests_.pop(); |
467 | 467 |
468 const ChildProcessData& data = process_->GetData(); | 468 const ChildProcessData& data = process_->GetData(); |
469 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 469 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
470 data.id); | 470 data.id); |
471 } | 471 } |
472 | 472 |
473 } // namespace content | 473 } // namespace content |
OLD | NEW |