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

Side by Side Diff: ash/session/session_state_delegate.h

Issue 2041233004: mash: Move //ash/session to //ash/common/session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 | « ash/root_window_controller_unittest.cc ('k') | ash/session/session_state_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_SESSION_SESSION_STATE_DELEGATE_H_
6 #define ASH_SESSION_SESSION_STATE_DELEGATE_H_
7
8 #include <string>
9
10 #include "ash/ash_export.h"
11 #include "ash/session/session_types.h"
12
13 class AccountId;
14
15 namespace gfx {
16 class ImageSkia;
17 }
18
19 namespace user_manager {
20 class UserInfo;
21 }
22
23 namespace ash {
24
25 class SessionStateObserver;
26 class WmWindow;
27
28 // Delegate for checking and modifying the session state.
29 class ASH_EXPORT SessionStateDelegate {
30 public:
31 // Defines the cycle direction for |CycleActiveUser|.
32 enum CycleUser {
33 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user.
34 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user.
35 };
36
37 enum AddUserError {
38 ADD_USER_ERROR_NOT_ALLOWED_PRIMARY_USER = 0,
39 ADD_USER_ERROR_OUT_OF_USERS,
40 ADD_USER_ERROR_MAXIMUM_USERS_REACHED,
41 };
42
43 // Defines session state i.e. whether session is running or not and
44 // whether user session is blocked by things like multi-profile login.
45 enum SessionState {
46 // When primary user login UI is shown i.e. after boot or sign out,
47 // no active user session exists yet.
48 SESSION_STATE_LOGIN_PRIMARY = 0,
49
50 // Inside user session (including lock screen),
51 // no login UI (primary or multi-profiles) is shown.
52 SESSION_STATE_ACTIVE,
53
54 // When secondary user login UI is shown i.e. other users are
55 // already logged in and is currently adding another user to the session.
56 SESSION_STATE_LOGIN_SECONDARY,
57 };
58
59 virtual ~SessionStateDelegate() {}
60
61 // Returns the maximum possible number of logged in users.
62 virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
63
64 // Returns the number of signed in users. If 0 is returned, there is either
65 // no session in progress or no active user.
66 virtual int NumberOfLoggedInUsers() const = 0;
67
68 // Returns true if there is possible to add more users to multiprofile
69 // session. Error is stored in |error| if it is not NULL and function
70 // returned false.
71 virtual bool CanAddUserToMultiProfile(AddUserError* error) const;
72
73 // Returns |true| if the session has been fully started for the active user.
74 // When a user becomes active, the profile and browser UI are not immediately
75 // available. Only once this method starts returning |true| is the browser
76 // startup complete and both profile and UI are fully available.
77 virtual bool IsActiveUserSessionStarted() const = 0;
78
79 // Returns true if the screen can be locked.
80 virtual bool CanLockScreen() const = 0;
81
82 // Returns true if the screen is currently locked.
83 virtual bool IsScreenLocked() const = 0;
84
85 // Returns true if the screen should be locked when the system is about to
86 // suspend.
87 virtual bool ShouldLockScreenBeforeSuspending() const = 0;
88
89 // Locks the screen. The locking happens asynchronously.
90 virtual void LockScreen() = 0;
91
92 // Unlocks the screen.
93 virtual void UnlockScreen() = 0;
94
95 // Returns |true| if user session blocked by some overlying UI. It can be
96 // login screen, lock screen or screen for adding users into multi-profile
97 // session.
98 virtual bool IsUserSessionBlocked() const = 0;
99
100 // Returns current session state.
101 virtual SessionState GetSessionState() const = 0;
102
103 // Gets the user info for the user with the given |index|. See session_types.h
104 // for a description of UserIndex.
105 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
106 virtual const user_manager::UserInfo* GetUserInfo(UserIndex index) const = 0;
107
108 // Whether or not the window's title should show the avatar.
109 virtual bool ShouldShowAvatar(WmWindow* window) const = 0;
110
111 // Returns the avatar image for the specified window.
112 virtual gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const = 0;
113
114 // Switches to another active user with |account_id|
115 // (if that user has already signed in).
116 virtual void SwitchActiveUser(const AccountId& account_id) = 0;
117
118 // Switches the active user to the next or previous user, with the same
119 // ordering as GetLoggedInUsers.
120 virtual void CycleActiveUser(CycleUser cycle_user) = 0;
121
122 // Returns true if primary user policy does not forbid multiple signin.
123 virtual bool IsMultiProfileAllowedByPrimaryUserPolicy() const = 0;
124
125 // Adds or removes sessions state observer.
126 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
127 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0;
128
129 bool IsInSecondaryLoginScreen() const;
130 };
131
132 } // namespace ash
133
134 #endif // ASH_SESSION_SESSION_STATE_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/root_window_controller_unittest.cc ('k') | ash/session/session_state_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698