| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/bootstrap_sandbox_mac.h" | 5 #include "content/browser/bootstrap_sandbox_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // singleton, as well as registering all associated policies with it. | 22 // singleton, as well as registering all associated policies with it. |
| 23 class BootstrapSandboxPolicy : public BrowserChildProcessObserver { | 23 class BootstrapSandboxPolicy : public BrowserChildProcessObserver { |
| 24 public: | 24 public: |
| 25 static BootstrapSandboxPolicy* GetInstance(); | 25 static BootstrapSandboxPolicy* GetInstance(); |
| 26 | 26 |
| 27 sandbox::BootstrapSandbox* sandbox() const { | 27 sandbox::BootstrapSandbox* sandbox() const { |
| 28 return sandbox_.get(); | 28 return sandbox_.get(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 // BrowserChildProcessObserver: | 31 // BrowserChildProcessObserver: |
| 32 virtual void BrowserChildProcessHostDisconnected( | 32 void BrowserChildProcessHostDisconnected( |
| 33 const ChildProcessData& data) override; | 33 const ChildProcessData& data) override; |
| 34 virtual void BrowserChildProcessCrashed( | 34 void BrowserChildProcessCrashed(const ChildProcessData& data) override; |
| 35 const ChildProcessData& data) override; | |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 friend struct DefaultSingletonTraits<BootstrapSandboxPolicy>; | 37 friend struct DefaultSingletonTraits<BootstrapSandboxPolicy>; |
| 39 BootstrapSandboxPolicy(); | 38 BootstrapSandboxPolicy(); |
| 40 virtual ~BootstrapSandboxPolicy(); | 39 ~BootstrapSandboxPolicy() override; |
| 41 | 40 |
| 42 void RegisterSandboxPolicies(); | 41 void RegisterSandboxPolicies(); |
| 43 | 42 |
| 44 scoped_ptr<sandbox::BootstrapSandbox> sandbox_; | 43 scoped_ptr<sandbox::BootstrapSandbox> sandbox_; |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 BootstrapSandboxPolicy* BootstrapSandboxPolicy::GetInstance() { | 46 BootstrapSandboxPolicy* BootstrapSandboxPolicy::GetInstance() { |
| 48 return Singleton<BootstrapSandboxPolicy>::get(); | 47 return Singleton<BootstrapSandboxPolicy>::get(); |
| 49 } | 48 } |
| 50 | 49 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 77 bool ShouldEnableBootstrapSandbox() { | 76 bool ShouldEnableBootstrapSandbox() { |
| 78 return base::mac::IsOSMountainLionOrEarlier() || | 77 return base::mac::IsOSMountainLionOrEarlier() || |
| 79 base::mac::IsOSMavericks(); | 78 base::mac::IsOSMavericks(); |
| 80 } | 79 } |
| 81 | 80 |
| 82 sandbox::BootstrapSandbox* GetBootstrapSandbox() { | 81 sandbox::BootstrapSandbox* GetBootstrapSandbox() { |
| 83 return BootstrapSandboxPolicy::GetInstance()->sandbox(); | 82 return BootstrapSandboxPolicy::GetInstance()->sandbox(); |
| 84 } | 83 } |
| 85 | 84 |
| 86 } // namespace content | 85 } // namespace content |
| OLD | NEW |