xref: /aosp_15_r20/external/cronet/base/process/process_info.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
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 BASE_PROCESS_PROCESS_INFO_H_
6 #define BASE_PROCESS_PROCESS_INFO_H_
7 
8 #include "base/base_export.h"
9 #include "build/build_config.h"
10 
11 namespace base {
12 
13 #if BUILDFLAG(IS_WIN)
14 enum IntegrityLevel {
15   INTEGRITY_UNKNOWN,
16   UNTRUSTED_INTEGRITY,
17   LOW_INTEGRITY,
18   MEDIUM_INTEGRITY,
19   HIGH_INTEGRITY,
20 };
21 
22 // Returns the integrity level of the process. Returns INTEGRITY_UNKNOWN in the
23 // case of an underlying system failure.
24 BASE_EXPORT IntegrityLevel GetCurrentProcessIntegrityLevel();
25 
26 // Determines whether the current process is elevated. Note: in some
27 // configurations this may be true for processes launched without using
28 // LaunchOptions::elevated.
29 BASE_EXPORT bool IsCurrentProcessElevated();
30 
31 // Determines whether the current process is running within an App Container.
32 BASE_EXPORT bool IsCurrentProcessInAppContainer();
33 
34 #endif  // BUILDFLAG(IS_WIN)
35 
36 #if BUILDFLAG(IS_MAC)
37 // Returns whether the current process is responsible for itself. See
38 // https://bugs.chromium.org/p/chromium/issues/detail?id=945969 and
39 // https://bugs.chromium.org/p/chromium/issues/detail?id=996993.
40 //
41 // On versions of macOS that do not have the concept, this will always return
42 // true.
43 BASE_EXPORT bool IsProcessSelfResponsible();
44 #endif
45 
46 }  // namespace base
47 
48 #endif  // BASE_PROCESS_PROCESS_INFO_H_
49