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

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

Issue 2914693002: Add IsSandboxed() function to seatbelt wrapper. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « sandbox/mac/sandbox_mac_compiler_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_SEATBELT_H_ 5 #ifndef SANDBOX_MAC_SEATBELT_H_
6 #define SANDBOX_MAC_SEATBELT_H_ 6 #define SANDBOX_MAC_SEATBELT_H_
7 7
8 #include <sys/types.h>
8 #include <cstdint> 9 #include <cstdint>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "sandbox/mac/seatbelt_export.h" 12 #include "sandbox/mac/seatbelt_export.h"
12 13
14 extern "C" {
15
16 enum sandbox_filter_type {
Robert Sesek 2017/05/31 17:31:08 Why is this extern C? I don't see this in /usr/inc
17 SANDBOX_FILTER_NONE,
18 SANDBOX_FILTER_PATH,
19 SANDBOX_FILTER_GLOBAL_NAME,
20 SANDBOX_FILTER_LOCAL_NAME,
21 SANDBOX_FILTER_APPLEEVENT_DESTINATION,
22 SANDBOX_FILTER_RIGHT_NAME,
23 SANDBOX_FILTER_PREFERENCE_DOMAIN,
24 SANDBOX_FILTER_KEXT_BUNDLE_ID,
25 SANDBOX_FILTER_INFO_TYPE,
26 SANDBOX_FILTER_NOTIFICATION
27 };
28
29 extern const enum sandbox_filter_type SANDBOX_CHECK_NO_REPORT;
30 extern const enum sandbox_filter_type SANDBOX_CHECK_CANONICAL;
31
32 // Not deprecated. The canonical usage to test if sandboxed is
33 // sandbox_check(getpid(), NULL, SANDBOX_FILTER_NONE), which returns
34 // 1 if sandboxed.
35 int sandbox_check(pid_t pid,
Robert Sesek 2017/05/31 17:31:08 Rather than exposing this as a C function, let's w
Greg K 2017/05/31 17:36:25 I wanted to do this, but I'm not sure how to pass
Robert Sesek 2017/05/31 18:09:58 Argh yeah the varargs is frustrating. Unless there
Greg K 2017/05/31 18:14:37 Right now I only plan to use it to check if it's s
Robert Sesek 2017/05/31 18:19:08 That sounds good. Keeping APIs minimal is always t
Greg K 2017/06/01 18:42:08 Done.
36 const char* operation,
37 sandbox_filter_type type,
38 ...);
39
40 }; // extern "C"
41
13 namespace sandbox { 42 namespace sandbox {
14 43
15 // This class exists because OS X deprecated the sandbox functions, 44 // This class exists because OS X deprecated the sandbox functions,
16 // and did not supply replacements that are suitable for Chrome. 45 // and did not supply replacements that are suitable for Chrome.
17 // This class wraps the functions in deprecation warning supressions. 46 // This class wraps the functions in deprecation warning supressions.
18 class SEATBELT_EXPORT Seatbelt { 47 class SEATBELT_EXPORT Seatbelt {
19 public: 48 public:
20 static int Init(const char* profile, uint64_t flags, char** errorbuf); 49 static int Init(const char* profile, uint64_t flags, char** errorbuf);
21 50
22 static int InitWithParams(const char* profile, 51 static int InitWithParams(const char* profile,
(...skipping 14 matching lines...) Expand all
37 static const char* kProfilePureComputation; 66 static const char* kProfilePureComputation;
38 67
39 private: 68 private:
40 Seatbelt(); 69 Seatbelt();
41 DISALLOW_COPY_AND_ASSIGN(Seatbelt); 70 DISALLOW_COPY_AND_ASSIGN(Seatbelt);
42 }; 71 };
43 72
44 } // sandbox 73 } // sandbox
45 74
46 #endif // SANDBOX_MAC_SEATBELT_H_ 75 #endif // SANDBOX_MAC_SEATBELT_H_
OLDNEW
« no previous file with comments | « sandbox/mac/sandbox_mac_compiler_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698