| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 #ifndef SANDBOX_MAC_SANDBOX_COMPILER_H_ |
| 6 #define SANDBOX_MAC_SANDBOX_COMPILER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "sandbox/mac/seatbelt_export.h" |
| 13 |
| 14 namespace sandbox { |
| 15 |
| 16 // This class wraps the C-style sandbox APIs in a class to ensure proper |
| 17 // initialization and cleanup. |
| 18 class SEATBELT_EXPORT SandboxCompiler { |
| 19 public: |
| 20 explicit SandboxCompiler(const std::string& profile_str); |
| 21 |
| 22 ~SandboxCompiler(); |
| 23 |
| 24 // Inserts a boolean into the parameters key/value map. A duplicate key is not |
| 25 // allowed, and will cause the function to return false. The value is not |
| 26 // inserted in this case. |
| 27 bool InsertBooleanParam(const std::string& key, bool value); |
| 28 |
| 29 // Inserts a string into the parameters key/value map. A duplicate key is not |
| 30 // allowed, and will cause the function to return false. The value is not |
| 31 // inserted in this case. |
| 32 bool InsertStringParam(const std::string& key, const std::string& value); |
| 33 |
| 34 // Compiles and applies the profile; returns true on success. |
| 35 bool CompileAndApplyProfile(std::string* error); |
| 36 |
| 37 private: |
| 38 // Storage of the key/value pairs of strings that are used in the sandbox |
| 39 // profile. |
| 40 std::map<std::string, std::string> params_map_; |
| 41 |
| 42 // The sandbox profile source code. |
| 43 const std::string profile_str_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(SandboxCompiler); |
| 46 }; |
| 47 |
| 48 } // namespace sandbox |
| 49 |
| 50 #endif // SANDBOX_MAC_SANDBOX_COMPILER_H_ |
| OLD | NEW |