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

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

Issue 310833003: Make BootstrapSandboxPolicy a struct, containing the existing rule map and a new default rule. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const auto& Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/mac/launchd_interception_server.cc ('k') | sandbox/mac/policy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SANDBOX_MAC_POLICY_H_ 5 #ifndef SANDBOX_MAC_POLICY_H_
6 #define SANDBOX_MAC_POLICY_H_ 6 #define SANDBOX_MAC_POLICY_H_
7 7
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 29 matching lines...) Expand all
40 explicit Rule(mach_port_t override_port); 40 explicit Rule(mach_port_t override_port);
41 41
42 PolicyDecision result; 42 PolicyDecision result;
43 43
44 // The Rule does not take ownership of this port, but additional send rights 44 // The Rule does not take ownership of this port, but additional send rights
45 // will be allocated to it before it is sent to a client. This name must 45 // will be allocated to it before it is sent to a client. This name must
46 // denote a send right that can duplicated with MACH_MSG_TYPE_COPY_SEND. 46 // denote a send right that can duplicated with MACH_MSG_TYPE_COPY_SEND.
47 mach_port_t substitute_port; 47 mach_port_t substitute_port;
48 }; 48 };
49 49
50 // A SandboxPolicy maps bootstrap server names to policy Rules. 50 // A policy object manages the rules enforced on a target sandboxed process.
51 typedef std::map<std::string, Rule> BootstrapSandboxPolicy; 51 struct SANDBOX_EXPORT BootstrapSandboxPolicy {
52 typedef std::map<std::string, Rule> NamedRules;
53
54 BootstrapSandboxPolicy();
55 ~BootstrapSandboxPolicy();
56
57 // The default action to take if the server name being looked up is not
58 // present in |rules|.
59 Rule default_rule;
60
61 // A map of bootstrap server names to policy Rules.
62 NamedRules rules;
63 };
52 64
53 // Checks that a policy is well-formed. 65 // Checks that a policy is well-formed.
54 SANDBOX_EXPORT bool IsPolicyValid(const BootstrapSandboxPolicy& policy); 66 SANDBOX_EXPORT bool IsPolicyValid(const BootstrapSandboxPolicy& policy);
55 67
56 } // namespace sandbox 68 } // namespace sandbox
57 69
58 #endif // SANDBOX_MAC_POLICY_H_ 70 #endif // SANDBOX_MAC_POLICY_H_
OLDNEW
« no previous file with comments | « sandbox/mac/launchd_interception_server.cc ('k') | sandbox/mac/policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698