xref: /aosp_15_r20/external/cronet/base/mac/login_util.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2024 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_MAC_LOGIN_UTIL_H_
6 #define BASE_MAC_LOGIN_UTIL_H_
7 
8 #include <MacTypes.h>
9 
10 #include <optional>
11 
12 #include "base/base_export.h"
13 
14 namespace base::mac {
15 
16 // Various useful functions from the private login.framework. Because these are
17 // SPI, all return values are optional; `std::nullopt` is returned if the SPI is
18 // not available.
19 
20 // Returns whether the screen lock on this Mac is enabled for the user.
21 BASE_EXPORT std::optional<bool> IsScreenLockEnabled();
22 
23 // Moves the current user session to the background and goes to the
24 // fast-user-switching screen.
25 BASE_EXPORT std::optional<OSStatus> SwitchToLoginWindow();
26 
27 }  // namespace base::mac
28 
29 #endif  // BASE_MAC_LOGIN_UTIL_H_
30