Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/ppapi_plugin_process_host.h ('k') | content/browser/profiler_controller_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, 41 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker,
42 const PepperPluginInfo& info, 42 const PepperPluginInfo& info,
43 ChildProcessHost* host) 43 ChildProcessHost* host)
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 ~PpapiPluginSandboxedProcessLauncherDelegate() override {}
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 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 base::ScopedFD TakeIpcFd() override { 79 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); }
80 return ipc_fd_.Pass();
81 }
82 #endif // OS_WIN 80 #endif // OS_WIN
83 81
84 private: 82 private:
85 #if defined(OS_POSIX) 83 #if defined(OS_POSIX)
86 const PepperPluginInfo& info_; 84 const PepperPluginInfo& info_;
87 base::ScopedFD ipc_fd_; 85 base::ScopedFD ipc_fd_;
88 #endif // OS_POSIX 86 #endif // OS_POSIX
89 bool is_broker_; 87 bool is_broker_;
90 88
91 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate); 89 DISALLOW_COPY_AND_ASSIGN(PpapiPluginSandboxedProcessLauncherDelegate);
92 }; 90 };
93 91
94 class PpapiPluginProcessHost::PluginNetworkObserver 92 class PpapiPluginProcessHost::PluginNetworkObserver
95 : public net::NetworkChangeNotifier::IPAddressObserver, 93 : public net::NetworkChangeNotifier::IPAddressObserver,
96 public net::NetworkChangeNotifier::ConnectionTypeObserver { 94 public net::NetworkChangeNotifier::ConnectionTypeObserver {
97 public: 95 public:
98 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) 96 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host)
99 : process_host_(process_host) { 97 : process_host_(process_host) {
100 net::NetworkChangeNotifier::AddIPAddressObserver(this); 98 net::NetworkChangeNotifier::AddIPAddressObserver(this);
101 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 99 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
102 } 100 }
103 101
104 virtual ~PluginNetworkObserver() { 102 ~PluginNetworkObserver() override {
105 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 103 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
106 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 104 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
107 } 105 }
108 106
109 // IPAddressObserver implementation. 107 // IPAddressObserver implementation.
110 virtual void OnIPAddressChanged() override { 108 void OnIPAddressChanged() override {
111 // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline 109 // 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 110 // 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 111 // when I unplug and replug my network cable. Sending this notification when
114 // "something" changes seems to make Flash reasonably happy, but seems 112 // "something" changes seems to make Flash reasonably happy, but seems
115 // wrong. We should really be able to provide the real online state in 113 // wrong. We should really be able to provide the real online state in
116 // OnConnectionTypeChanged(). 114 // OnConnectionTypeChanged().
117 process_host_->Send(new PpapiMsg_SetNetworkState(true)); 115 process_host_->Send(new PpapiMsg_SetNetworkState(true));
118 } 116 }
119 117
120 // ConnectionTypeObserver implementation. 118 // ConnectionTypeObserver implementation.
121 virtual void OnConnectionTypeChanged( 119 void OnConnectionTypeChanged(
122 net::NetworkChangeNotifier::ConnectionType type) override { 120 net::NetworkChangeNotifier::ConnectionType type) override {
123 process_host_->Send(new PpapiMsg_SetNetworkState( 121 process_host_->Send(new PpapiMsg_SetNetworkState(
124 type != net::NetworkChangeNotifier::CONNECTION_NONE)); 122 type != net::NetworkChangeNotifier::CONNECTION_NONE));
125 } 123 }
126 124
127 private: 125 private:
128 PpapiPluginProcessHost* const process_host_; 126 PpapiPluginProcessHost* const process_host_;
129 }; 127 };
130 128
131 PpapiPluginProcessHost::~PpapiPluginProcessHost() { 129 PpapiPluginProcessHost::~PpapiPluginProcessHost() {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // sent_requests_ queue should be the one that the plugin just created. 462 // sent_requests_ queue should be the one that the plugin just created.
465 Client* client = sent_requests_.front(); 463 Client* client = sent_requests_.front();
466 sent_requests_.pop(); 464 sent_requests_.pop();
467 465
468 const ChildProcessData& data = process_->GetData(); 466 const ChildProcessData& data = process_->GetData();
469 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 467 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
470 data.id); 468 data.id);
471 } 469 }
472 470
473 } // namespace content 471 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.h ('k') | content/browser/profiler_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698