OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
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 ASH_COMMON_SESSION_SESSION_STATE_DELEGATE_H_ | |
6 #define ASH_COMMON_SESSION_SESSION_STATE_DELEGATE_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/public/cpp/session_types.h" | |
10 #include "components/session_manager/session_manager_types.h" | |
11 | |
12 class AccountId; | |
13 | |
14 namespace gfx { | |
15 class ImageSkia; | |
16 } | |
17 | |
18 namespace user_manager { | |
19 class UserInfo; | |
20 } | |
21 | |
22 namespace ash { | |
23 | |
24 class SessionStateObserver; | |
25 class WmWindow; | |
26 | |
27 // Delegate for checking and modifying the session state. | |
28 // DEPRECATED in favor of SessionController/SessionControllerClient for mash. | |
29 // TODO(xiyuan): Remove this when SessionController etc are ready. | |
30 class ASH_EXPORT SessionStateDelegate { | |
31 public: | |
32 virtual ~SessionStateDelegate() {} | |
33 | |
34 // Returns the maximum possible number of logged in users. | |
35 virtual int GetMaximumNumberOfLoggedInUsers() const = 0; | |
36 | |
37 // Returns the number of signed in users. If 0 is returned, there is either | |
38 // no session in progress or no active user. | |
39 virtual int NumberOfLoggedInUsers() const = 0; | |
40 | |
41 // Gets the policy of adding a user session to ash. | |
42 virtual AddUserSessionPolicy GetAddUserSessionPolicy() const; | |
43 | |
44 // Returns |true| if the session has been fully started for the active user. | |
45 // When a user becomes active, the profile and browser UI are not immediately | |
46 // available. Only once this method starts returning |true| is the browser | |
47 // startup complete and both profile and UI are fully available. | |
48 virtual bool IsActiveUserSessionStarted() const = 0; | |
49 | |
50 // Returns true if the screen can be locked. | |
51 virtual bool CanLockScreen() const = 0; | |
52 | |
53 // Returns true if the screen is currently locked. | |
54 virtual bool IsScreenLocked() const = 0; | |
55 | |
56 // Returns true if the screen should be locked automatically when the screen | |
57 // is turned off or the system is suspended. | |
58 virtual bool ShouldLockScreenAutomatically() const = 0; | |
59 | |
60 // Locks the screen. The locking happens asynchronously. | |
61 virtual void LockScreen() = 0; | |
62 | |
63 // Unlocks the screen. | |
64 virtual void UnlockScreen() = 0; | |
65 | |
66 // Returns |true| if user session blocked by some overlying UI. It can be | |
67 // login screen, lock screen or screen for adding users into multi-profile | |
68 // session. | |
69 virtual bool IsUserSessionBlocked() const = 0; | |
70 | |
71 // Returns current session state. | |
72 virtual session_manager::SessionState GetSessionState() const = 0; | |
73 | |
74 // Gets the user info for the user with the given |index|. See session_types.h | |
75 // for a description of UserIndex. | |
76 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
77 virtual const user_manager::UserInfo* GetUserInfo(UserIndex index) const = 0; | |
78 | |
79 // Whether or not the window's title should show the avatar. | |
80 virtual bool ShouldShowAvatar(WmWindow* window) const = 0; | |
81 | |
82 // Returns the avatar image for the specified window. | |
83 virtual gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const = 0; | |
84 | |
85 // Switches to another active user with |account_id| | |
86 // (if that user has already signed in). | |
87 virtual void SwitchActiveUser(const AccountId& account_id) = 0; | |
88 | |
89 // Switches the active user to the next or previous user, with the same | |
90 // ordering as GetLoggedInUsers. | |
91 virtual void CycleActiveUser(CycleUserDirection direction) = 0; | |
92 | |
93 // Returns true if primary user policy does not forbid multiple signin. | |
94 virtual bool IsMultiProfileAllowedByPrimaryUserPolicy() const = 0; | |
95 | |
96 // Adds or removes sessions state observer. | |
97 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; | |
98 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; | |
99 | |
100 bool IsInSecondaryLoginScreen() const; | |
101 }; | |
102 | |
103 } // namespace ash | |
104 | |
105 #endif // ASH_COMMON_SESSION_SESSION_STATE_DELEGATE_H_ | |
OLD | NEW |