OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/bootstrap_sandbox_mac.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/singleton.h" |
| 10 #include "sandbox/mac/bootstrap_sandbox.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 namespace { |
| 15 |
| 16 // This class is responsible for creating the BootstrapSandbox global |
| 17 // singleton, as well as registering all associated policies with it. |
| 18 class BootstrapSandboxPolicy { |
| 19 public: |
| 20 static BootstrapSandboxPolicy* GetInstance(); |
| 21 |
| 22 sandbox::BootstrapSandbox* sandbox() const { |
| 23 return sandbox_.get(); |
| 24 } |
| 25 |
| 26 private: |
| 27 friend struct DefaultSingletonTraits<BootstrapSandboxPolicy>; |
| 28 BootstrapSandboxPolicy(); |
| 29 ~BootstrapSandboxPolicy(); |
| 30 |
| 31 void RegisterSandboxPolicies(); |
| 32 |
| 33 scoped_ptr<sandbox::BootstrapSandbox> sandbox_; |
| 34 }; |
| 35 |
| 36 BootstrapSandboxPolicy* BootstrapSandboxPolicy::GetInstance() { |
| 37 return Singleton<BootstrapSandboxPolicy>::get(); |
| 38 } |
| 39 |
| 40 BootstrapSandboxPolicy::BootstrapSandboxPolicy() |
| 41 : sandbox_(sandbox::BootstrapSandbox::Create()) { |
| 42 CHECK(sandbox_.get()); |
| 43 RegisterSandboxPolicies(); |
| 44 } |
| 45 |
| 46 BootstrapSandboxPolicy::~BootstrapSandboxPolicy() { |
| 47 } |
| 48 |
| 49 void BootstrapSandboxPolicy::RegisterSandboxPolicies() { |
| 50 // TODO(rsesek): Implement me. |
| 51 } |
| 52 |
| 53 } // namespace |
| 54 |
| 55 sandbox::BootstrapSandbox* GetBootstrapSandbox() { |
| 56 return BootstrapSandboxPolicy::GetInstance()->sandbox(); |
| 57 } |
| 58 |
| 59 } // namespace content |
OLD | NEW |