Disable accessible touch exploration by default.
[chromium-blink-merge.git] / ash / session / session_state_delegate.h
blob89c1ff8d4f951d2bd76630ebddfaf86f17107b8c
1 // Copyright (c) 2013 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.
5 #ifndef ASH_SESSION_SESSION_STATE_DELEGATE_H_
6 #define ASH_SESSION_SESSION_STATE_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "base/strings/string16.h"
14 namespace aura {
15 class Window;
16 } // namespace aura
18 namespace content {
19 class BrowserContext;
22 namespace gfx {
23 class ImageSkia;
24 } // namespace gfx
26 namespace user_manager {
27 class UserInfo;
28 } // namespace user_manager
30 namespace ash {
32 class SessionStateObserver;
34 // The index for the multi-profile item to use. The list is always LRU sorted
35 // So that the index #0 is the currently active user.
36 typedef int MultiProfileIndex;
38 // A list of user_id.
39 typedef std::vector<std::string> UserIdList;
41 // Delegate for checking and modifying the session state.
42 // TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause
43 // GetUserXXX are useful for non multi profile scenario in ash_shell.
44 class ASH_EXPORT SessionStateDelegate {
45 public:
46 // Defines the cycle direction for |CycleActiveUser|.
47 enum CycleUser {
48 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user.
49 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user.
52 // Defines session state i.e. whether session is running or not and
53 // whether user session is blocked by things like multi-profile login.
54 enum SessionState {
55 // When primary user login UI is shown i.e. after boot or sign out,
56 // no active user session exists yet.
57 SESSION_STATE_LOGIN_PRIMARY = 0,
59 // Inside user session (including lock screen),
60 // no login UI (primary or multi-profiles) is shown.
61 SESSION_STATE_ACTIVE,
63 // When secondary user login UI is shown i.e. other users are
64 // already logged in and is currently adding another user to the session.
65 SESSION_STATE_LOGIN_SECONDARY,
68 virtual ~SessionStateDelegate() {};
70 // Returns the browser context for the user given by |index|.
71 virtual content::BrowserContext* GetBrowserContextByIndex(
72 MultiProfileIndex index) = 0;
74 // Returns the browser context associated with the window.
75 virtual content::BrowserContext* GetBrowserContextForWindow(
76 aura::Window* window) = 0;
78 // Returns the maximum possible number of logged in users.
79 virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
81 // Returns the number of signed in users. If 0 is returned, there is either
82 // no session in progress or no active user.
83 virtual int NumberOfLoggedInUsers() const = 0;
85 // Returns |true| if the session has been fully started for the active user.
86 // When a user becomes active, the profile and browser UI are not immediately
87 // available. Only once this method starts returning |true| is the browser
88 // startup complete and both profile and UI are fully available.
89 virtual bool IsActiveUserSessionStarted() const = 0;
91 // Returns true if the screen can be locked.
92 virtual bool CanLockScreen() const = 0;
94 // Returns true if the screen is currently locked.
95 virtual bool IsScreenLocked() const = 0;
97 // Returns true if the screen should be locked when the system is about to
98 // suspend.
99 virtual bool ShouldLockScreenBeforeSuspending() const = 0;
101 // Locks the screen. The locking happens asynchronously.
102 virtual void LockScreen() = 0;
104 // Unlocks the screen.
105 virtual void UnlockScreen() = 0;
107 // Returns |true| if user session blocked by some overlying UI. It can be
108 // login screen, lock screen or screen for adding users into multi-profile
109 // session.
110 virtual bool IsUserSessionBlocked() const = 0;
112 // Returns current session state.
113 virtual SessionState GetSessionState() const = 0;
115 // TODO(oshima): consolidate these two GetUserInfo.
117 // Gets the user info for the user with the given |index|.
118 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
119 virtual const user_manager::UserInfo* GetUserInfo(
120 MultiProfileIndex index) const = 0;
122 // Gets the avatar image for the user associated with the |context|.
123 virtual const user_manager::UserInfo* GetUserInfo(
124 content::BrowserContext* context) const = 0;
126 // Whether or not the window's title should show the avatar.
127 virtual bool ShouldShowAvatar(aura::Window* window) const = 0;
129 // Switches to another active user with |user_id|
130 // (if that user has already signed in).
131 virtual void SwitchActiveUser(const std::string& user_id) = 0;
133 // Switches the active user to the next or previous user, with the same
134 // ordering as GetLoggedInUsers.
135 virtual void CycleActiveUser(CycleUser cycle_user) = 0;
137 // Adds or removes sessions state observer.
138 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
139 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0;
142 } // namespace ash
144 #endif // ASH_SESSION_SESSION_STATE_DELEGATE_H_