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

Unified Diff: content/browser/bootstrap_sandbox_mac.cc

Issue 303293002: Initialize the bootstrap sandbox in the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SandboxType Created 6 years, 7 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/browser/bootstrap_sandbox_mac.cc
diff --git a/content/browser/bootstrap_sandbox_mac.cc b/content/browser/bootstrap_sandbox_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..52fa2a5ad61165f68c7aee4094a5273a798e4021
--- /dev/null
+++ b/content/browser/bootstrap_sandbox_mac.cc
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/bootstrap_sandbox_mac.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
+#include "sandbox/mac/bootstrap_sandbox.h"
+
+namespace content {
+
+namespace {
+
+// This class is responsible for creating the BootstrapSandbox global
+// singleton, as well as registering all associated policies with it.
+class BootstrapSandboxPolicy {
+ public:
+ static BootstrapSandboxPolicy* GetInstance();
+
+ sandbox::BootstrapSandbox* sandbox() const {
+ return sandbox_.get();
+ }
+
+ private:
+ friend struct DefaultSingletonTraits<BootstrapSandboxPolicy>;
+ BootstrapSandboxPolicy();
+ ~BootstrapSandboxPolicy();
+
+ void RegisterSandboxPolicies();
+
+ scoped_ptr<sandbox::BootstrapSandbox> sandbox_;
+};
+
+BootstrapSandboxPolicy* BootstrapSandboxPolicy::GetInstance() {
+ return Singleton<BootstrapSandboxPolicy>::get();
+}
+
+BootstrapSandboxPolicy::BootstrapSandboxPolicy()
+ : sandbox_(sandbox::BootstrapSandbox::Create()) {
+ CHECK(sandbox_.get());
+ RegisterSandboxPolicies();
+}
+
+BootstrapSandboxPolicy::~BootstrapSandboxPolicy() {
+}
+
+void BootstrapSandboxPolicy::RegisterSandboxPolicies() {
+ // TODO(rsesek): Implement me.
+}
+
+} // namespace
+
+sandbox::BootstrapSandbox* GetBootstrapSandbox() {
+ return BootstrapSandboxPolicy::GetInstance()->sandbox();
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698