| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_COMMON_SANDBOX_INIT_WRAPPER_H_ | 5 #ifndef CHROME_COMMON_SANDBOX_INIT_WRAPPER_H_ |
| 6 #define CHROME_COMMON_SANDBOX_INIT_WRAPPER_H_ | 6 #define CHROME_COMMON_SANDBOX_INIT_WRAPPER_H_ |
| 7 | 7 |
| 8 // Wraps the sandbox initialization and platform variables to consolodate | 8 // Wraps the sandbox initialization and platform variables to consolodate |
| 9 // the code and reduce the number of platform ifdefs elsewhere. The POSIX | 9 // the code and reduce the number of platform ifdefs elsewhere. The POSIX |
| 10 // version of this wrapper is basically empty. | 10 // version of this wrapper is basically empty. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 public: | 26 public: |
| 27 SandboxInitWrapper() : broker_services_(), target_services_() { } | 27 SandboxInitWrapper() : broker_services_(), target_services_() { } |
| 28 // SetServices() needs to be called before InitializeSandbox() on Win32 with | 28 // SetServices() needs to be called before InitializeSandbox() on Win32 with |
| 29 // the info received from the chrome exe main. | 29 // the info received from the chrome exe main. |
| 30 void SetServices(sandbox::SandboxInterfaceInfo* sandbox_info); | 30 void SetServices(sandbox::SandboxInterfaceInfo* sandbox_info); |
| 31 sandbox::BrokerServices* BrokerServices() const { return broker_services_; } | 31 sandbox::BrokerServices* BrokerServices() const { return broker_services_; } |
| 32 sandbox::TargetServices* TargetServices() const { return target_services_; } | 32 sandbox::TargetServices* TargetServices() const { return target_services_; } |
| 33 | 33 |
| 34 // Initialize the sandbox for renderer and plug-in processes, depending on | 34 // Initialize the sandbox for renderer and plug-in processes, depending on |
| 35 // the command line flags. The browser process is not sandboxed. | 35 // the command line flags. The browser process is not sandboxed. |
| 36 void InitializeSandbox(const CommandLine& parsed_command_line, | 36 // Returns true if the sandbox was initialized succesfully, false if an error |
| 37 // occurred. If process_type isn't one that needs sandboxing true is always |
| 38 // returned. |
| 39 bool InitializeSandbox(const CommandLine& parsed_command_line, |
| 37 const std::string& process_type); | 40 const std::string& process_type); |
| 38 private: | 41 private: |
| 39 sandbox::BrokerServices* broker_services_; | 42 sandbox::BrokerServices* broker_services_; |
| 40 sandbox::TargetServices* target_services_; | 43 sandbox::TargetServices* target_services_; |
| 41 | 44 |
| 42 DISALLOW_COPY_AND_ASSIGN(SandboxInitWrapper); | 45 DISALLOW_COPY_AND_ASSIGN(SandboxInitWrapper); |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 #elif defined(OS_POSIX) | 48 #elif defined(OS_POSIX) |
| 46 | 49 |
| 47 class SandboxInitWrapper { | 50 class SandboxInitWrapper { |
| 48 public: | 51 public: |
| 49 SandboxInitWrapper() { } | 52 SandboxInitWrapper() { } |
| 50 | 53 |
| 51 // Initialize the sandbox for renderer and plug-in processes, depending on | 54 // Initialize the sandbox for renderer and plug-in processes, depending on |
| 52 // the command line flags. The browser process is not sandboxed. | 55 // the command line flags. The browser process is not sandboxed. |
| 53 void InitializeSandbox(const CommandLine& parsed_command_line, | 56 // Returns true if the sandbox was initialized succesfully, false if an error |
| 57 // occurred. If process_type isn't one that needs sandboxing true is always |
| 58 // returned. |
| 59 bool InitializeSandbox(const CommandLine& parsed_command_line, |
| 54 const std::string& process_type); | 60 const std::string& process_type); |
| 55 | 61 |
| 56 #if defined(OS_MACOSX) | |
| 57 // We keep the process type so we can configure the sandbox as needed. | |
| 58 public: | |
| 59 std::string ProcessType() const { return process_type_; } | |
| 60 private: | |
| 61 std::string process_type_; | |
| 62 #endif | |
| 63 | |
| 64 private: | 62 private: |
| 65 DISALLOW_COPY_AND_ASSIGN(SandboxInitWrapper); | 63 DISALLOW_COPY_AND_ASSIGN(SandboxInitWrapper); |
| 66 }; | 64 }; |
| 67 | 65 |
| 68 #endif | 66 #endif |
| 69 | 67 |
| 70 #endif // CHROME_COMMON_SANDBOX_INIT_WRAPPER_H_ | 68 #endif // CHROME_COMMON_SANDBOX_INIT_WRAPPER_H_ |
| OLD | NEW |