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

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

Issue 2914693002: Add IsSandboxed() function to seatbelt wrapper. (Closed)
Patch Set: Improve function documentation 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') | sandbox/mac/seatbelt.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 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 <cstdint> 8 #include <cstdint>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "sandbox/mac/seatbelt_export.h" 11 #include "sandbox/mac/seatbelt_export.h"
12 12
13 namespace sandbox { 13 namespace sandbox {
14 14
15 // This class exists because OS X deprecated the sandbox functions, 15 // This class exists because OS X deprecated the sandbox functions,
16 // and did not supply replacements that are suitable for Chrome. 16 // and did not supply replacements that are suitable for Chrome.
17 // This class wraps the functions in deprecation warning supressions. 17 // This class wraps the functions in deprecation warning supressions.
18 class SEATBELT_EXPORT Seatbelt { 18 class SEATBELT_EXPORT Seatbelt {
19 public: 19 public:
20 // Initializes the specified sandbox profile. Returns 0 on success, else -1
21 // and |errorbuf| is populated. |errorbuf| is allocated by the API and must be
22 // freed with FreeError().
20 static int Init(const char* profile, uint64_t flags, char** errorbuf); 23 static int Init(const char* profile, uint64_t flags, char** errorbuf);
21 24
25 // Initializes the specified sandbox profile and passes the parameters to the
26 // |profile|. |parameters| is a null terminated list containing key,value
27 // pairs in sequence. [key1,val1,key2,val2,nullptr]. |errorbuf| is allocated
28 // by the API and is set to a string description of the error. |errorbuf| must
29 // be freed with FreeError(). This function eturns 0 on success, else -1 and
30 // |errorbuf| is populated.
22 static int InitWithParams(const char* profile, 31 static int InitWithParams(const char* profile,
23 uint64_t flags, 32 uint64_t flags,
24 const char* const parameters[], 33 const char* const parameters[],
25 char** errorbuf); 34 char** errorbuf);
26 35
36 // Frees the |errorbuf| allocated and set by InitWithParams.
27 static void FreeError(char* errorbuf); 37 static void FreeError(char* errorbuf);
28 38
39 // Returns whether or not the process is currently sandboxed.
40 static bool IsSandboxed();
41
29 static const char* kProfileNoInternet; 42 static const char* kProfileNoInternet;
30 43
31 static const char* kProfileNoNetwork; 44 static const char* kProfileNoNetwork;
32 45
33 static const char* kProfileNoWrite; 46 static const char* kProfileNoWrite;
34 47
35 static const char* kProfileNoWriteExceptTemporary; 48 static const char* kProfileNoWriteExceptTemporary;
36 49
37 static const char* kProfilePureComputation; 50 static const char* kProfilePureComputation;
38 51
39 private: 52 private:
40 Seatbelt(); 53 Seatbelt();
41 DISALLOW_COPY_AND_ASSIGN(Seatbelt); 54 DISALLOW_COPY_AND_ASSIGN(Seatbelt);
42 }; 55 };
43 56
44 } // sandbox 57 } // sandbox
45 58
46 #endif // SANDBOX_MAC_SEATBELT_H_ 59 #endif // SANDBOX_MAC_SEATBELT_H_
OLDNEW
« no previous file with comments | « sandbox/mac/sandbox_mac_compiler_unittest.mm ('k') | sandbox/mac/seatbelt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698