Make combobox observers able to observe multiple comboboxes.
[chromium-blink-merge.git] / ash / session_state_delegate.h
blob91c6229133ea58d4b4ad5a7125a090ff2ee6b46f
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_STATE_DELEGATE_H_
6 #define ASH_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 gfx {
19 class ImageSkia;
20 } // namespace gfx
22 namespace ash {
24 class SessionStateObserver;
26 // The index for the multi-profile item to use. The list is always LRU sorted
27 // So that the index #0 is the currently active user.
28 typedef int MultiProfileIndex;
30 // A list of user_id.
31 typedef std::vector<std::string> UserIdList;
33 // Delegate for checking and modifying the session state.
34 class ASH_EXPORT SessionStateDelegate {
35 public:
36 // Defines the cycle direction for |CycleActiveUser|.
37 enum CycleUser {
38 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user.
39 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user.
42 virtual ~SessionStateDelegate() {};
44 // Returns the maximum possible number of logged in users.
45 virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
47 // Returns the number of signed in users. If 0 is returned, there is either
48 // no session in progress or no active user.
49 virtual int NumberOfLoggedInUsers() const = 0;
51 // Returns |true| if the session has been fully started for the active user.
52 // When a user becomes active, the profile and browser UI are not immediately
53 // available. Only once this method starts returning |true| is the browser
54 // startup complete and both profile and UI are fully available.
55 virtual bool IsActiveUserSessionStarted() const = 0;
57 // Returns true if the screen can be locked.
58 virtual bool CanLockScreen() const = 0;
60 // Returns true if the screen is currently locked.
61 virtual bool IsScreenLocked() const = 0;
63 // Returns true if the screen should be locked when the system is about to
64 // suspend.
65 virtual bool ShouldLockScreenBeforeSuspending() const = 0;
67 // Locks the screen. The locking happens asynchronously.
68 virtual void LockScreen() = 0;
70 // Unlocks the screen.
71 virtual void UnlockScreen() = 0;
73 // Returns |true| if user session blocked by some overlying UI. It can be
74 // login screen, lock screen or screen for adding users into multi-profile
75 // session.
76 virtual bool IsUserSessionBlocked() const = 0;
78 // Gets the displayed name for the user with the given |index|.
79 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
80 virtual const base::string16 GetUserDisplayName(
81 MultiProfileIndex index) const = 0;
83 // Gets the display email address for the user with the given |index|.
84 // The display email address might contains some periods in the email name
85 // as well as capitalized letters. For example: "Foo.Bar@mock.com".
86 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
87 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0;
89 // Gets the user id (sanitized email address) for the user with the given
90 // |index|. The function would return something like "foobar@mock.com".
91 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
92 virtual const std::string GetUserID(MultiProfileIndex index) const = 0;
94 // Gets the avatar image for the user with the given |index|.
95 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
96 virtual const gfx::ImageSkia& GetUserImage(MultiProfileIndex index) const = 0;
98 // Returns a list of all logged in users.
99 virtual void GetLoggedInUsers(UserIdList* users) = 0;
101 // Switches to another active user with |user_id|
102 // (if that user has already signed in).
103 virtual void SwitchActiveUser(const std::string& user_id) = 0;
105 // Switches the active user to the next or previous user, with the same
106 // ordering as GetLoggedInUsers.
107 virtual void CycleActiveUser(CycleUser cycle_user) = 0;
109 // Adds or removes sessions state observer.
110 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
111 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0;
113 // Transfers the visibility of a window to another user. Returns true when
114 // transfer was done. This could fail if the |window| belongs to no one and
115 // is therefore shown on the desktop of every user.
116 virtual bool TransferWindowToDesktopOfUser(
117 aura::Window* window,
118 ash::MultiProfileIndex index) = 0;
121 } // namespace ash
123 #endif // ASH_SESSION_STATE_DELEGATE_H_