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

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

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

Powered by Google App Engine
This is Rietveld 408576698