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

Unified Diff: content/public/common/sandbox_init.h

Issue 8414020: Expose the sandbox related code through the content API. I did a bit of cleanup while I was doing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: content/public/common/sandbox_init.h
===================================================================
--- content/public/common/sandbox_init.h (revision 107639)
+++ content/public/common/sandbox_init.h (working copy)
@@ -2,71 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_SANDBOX_INIT_WRAPPER_H_
-#define CONTENT_COMMON_SANDBOX_INIT_WRAPPER_H_
+#ifndef CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_
+#define CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_
#pragma once
-// Wraps the sandbox initialization and platform variables to consolodate
-// the code and reduce the number of platform ifdefs elsewhere. The POSIX
-// version of this wrapper is basically empty.
-
#include "build/build_config.h"
-
-#include <string>
-
-#include "base/basictypes.h"
#include "content/common/content_export.h"
#if defined(OS_WIN)
-#include "sandbox/src/sandbox.h"
+namespace sandbox {
+struct SandboxInterfaceInfo;
+}
#endif
-class CommandLine;
+namespace content {
+// Initialize the sandbox for renderer, gpu, utility, worker, nacl, and plug-in
+// processes, depending on the command line flags. Although The browser process
+// is not sandboxed, this also needs to be called because it will initialize
+// the broker code.
+// Returns true if the sandbox was initialized succesfully, false if an error
+// occurred. If process_type isn't one that needs sandboxing true is always
+// returned.
#if defined(OS_WIN)
-
-class CONTENT_EXPORT SandboxInitWrapper {
- public:
- SandboxInitWrapper() : broker_services_(), target_services_() { }
- // SetServices() needs to be called before InitializeSandbox() on Win32 with
- // the info received from the chrome exe main.
- void SetServices(sandbox::SandboxInterfaceInfo* sandbox_info);
- sandbox::BrokerServices* BrokerServices() const { return broker_services_; }
- sandbox::TargetServices* TargetServices() const { return target_services_; }
-
- // Initialize the sandbox for renderer, gpu, utility, worker, nacl, and
- // plug-in processes, depending on the command line flags. The browser
- // process is not sandboxed.
- // Returns true if the sandbox was initialized succesfully, false if an error
- // occurred. If process_type isn't one that needs sandboxing true is always
- // returned.
- bool InitializeSandbox(const CommandLine& parsed_command_line,
- const std::string& process_type);
- private:
- sandbox::BrokerServices* broker_services_;
- sandbox::TargetServices* target_services_;
-
- DISALLOW_COPY_AND_ASSIGN(SandboxInitWrapper);
-};
-
-#elif defined(OS_POSIX)
-
-class SandboxInitWrapper {
- public:
- SandboxInitWrapper() { }
-
- // Initialize the sandbox for renderer and plug-in processes, depending on
- // the command line flags. The browser process is not sandboxed.
- // Returns true if the sandbox was initialized succesfully, false if an error
- // occurred. If process_type isn't one that needs sandboxing true is always
- // returned.
- bool InitializeSandbox(const CommandLine& parsed_command_line,
- const std::string& process_type);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SandboxInitWrapper);
-};
-
+CONTENT_EXPORT bool InitializeSandbox(
+ sandbox::SandboxInterfaceInfo* sandbox_info);
+#elif defined(OS_MACOSX)
+CONTENT_EXPORT bool InitializeSandbox();
#endif
-#endif // CONTENT_COMMON_SANDBOX_INIT_WRAPPER_H_
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_

Powered by Google App Engine
This is Rietveld 408576698