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

Side by Side Diff: sandbox/mac/sandbox_compiler.h

Issue 2686433002: Move SandboxCompiler class into the sandbox library. (Closed)
Patch Set: Try getting rid of sysctl-read Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « sandbox/mac/BUILD.gn ('k') | sandbox/mac/sandbox_compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « sandbox/mac/BUILD.gn ('k') | sandbox/mac/sandbox_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698