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

Unified Diff: content/browser/plugin_process_host.cc

Issue 177863002: Refactor configuration of sandboxes - first steps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining nits and rebase Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/plugin_process_host.cc
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc
index 38ca6d196a42495df8b809aa7078f784ea4c8e42..8f39c463109f3805e7916498567689a25f79864d 100644
--- a/content/browser/plugin_process_host.cc
+++ b/content/browser/plugin_process_host.cc
@@ -36,6 +36,7 @@
#include "content/public/browser/resource_context.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/process_type.h"
+#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "ipc/ipc_switches.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/ui_base_switches.h"
@@ -55,7 +56,6 @@
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "content/common/plugin_constants_win.h"
-#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "ui/gfx/switches.h"
#endif
@@ -77,24 +77,39 @@ void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) {
void PluginProcessHost::AddWindow(HWND window) {
plugin_parent_windows_set_.insert(window);
}
+#endif // defined(OS_WIN)
// NOTE: changes to this class need to be reviewed by the security team.
class PluginSandboxedProcessLauncherDelegate
: public SandboxedProcessLauncherDelegate {
public:
- PluginSandboxedProcessLauncherDelegate() {}
+ explicit PluginSandboxedProcessLauncherDelegate(ChildProcessHost* host)
+#if defined(OS_POSIX)
+ : ipc_fd_(host->TakeClientFileDescriptor())
+#endif // OS_POSIX
+ {}
+
virtual ~PluginSandboxedProcessLauncherDelegate() {}
- virtual void ShouldSandbox(bool* in_sandbox) OVERRIDE {
- *in_sandbox = false;
+#if defined(OS_WIN)
+ virtual bool ShouldSandbox() OVERRIDE {
+ return false;
}
+#elif defined(OS_POSIX)
+ virtual int GetIpcFd() OVERRIDE {
+ return ipc_fd_;
+ }
+#endif // OS_WIN
+
private:
+#if defined(OS_POSIX)
+ int ipc_fd_;
+#endif // OS_POSIX
+
DISALLOW_COPY_AND_ASSIGN(PluginSandboxedProcessLauncherDelegate);
};
-#endif // defined(OS_WIN)
-
#if defined(TOOLKIT_GTK)
void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id,
gfx::PluginWindowHandle* output) {
@@ -246,13 +261,7 @@ bool PluginProcessHost::Init(const WebPluginInfo& info) {
#endif
process_->Launch(
-#if defined(OS_WIN)
- new PluginSandboxedProcessLauncherDelegate,
- false,
-#elif defined(OS_POSIX)
- false,
- env,
-#endif
+ new PluginSandboxedProcessLauncherDelegate(process_->GetHost()),
cmd_line);
// The plugin needs to be shutdown gracefully, i.e. NP_Shutdown needs to be
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698