OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_SESSION_STATE_DELEGATE_H_ | 5 #ifndef ASH_SESSION_SESSION_STATE_DELEGATE_H_ |
6 #define ASH_SESSION_STATE_DELEGATE_H_ | 6 #define ASH_SESSION_SESSION_STATE_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 | 13 |
14 namespace aura { | 14 namespace aura { |
15 class Window; | 15 class Window; |
16 } // namespace aura | 16 } // namespace aura |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class BrowserContext; | 19 class BrowserContext; |
20 } | 20 } |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 class ImageSkia; | 23 class ImageSkia; |
24 } // namespace gfx | 24 } // namespace gfx |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 class SessionStateObserver; | 28 class SessionStateObserver; |
| 29 class UserInfo; |
29 | 30 |
30 // The index for the multi-profile item to use. The list is always LRU sorted | 31 // The index for the multi-profile item to use. The list is always LRU sorted |
31 // So that the index #0 is the currently active user. | 32 // So that the index #0 is the currently active user. |
32 typedef int MultiProfileIndex; | 33 typedef int MultiProfileIndex; |
33 | 34 |
34 // A list of user_id. | 35 // A list of user_id. |
35 typedef std::vector<std::string> UserIdList; | 36 typedef std::vector<std::string> UserIdList; |
36 | 37 |
37 // Delegate for checking and modifying the session state. | 38 // Delegate for checking and modifying the session state. |
38 // TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause | 39 // TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 virtual void UnlockScreen() = 0; | 102 virtual void UnlockScreen() = 0; |
102 | 103 |
103 // Returns |true| if user session blocked by some overlying UI. It can be | 104 // Returns |true| if user session blocked by some overlying UI. It can be |
104 // login screen, lock screen or screen for adding users into multi-profile | 105 // login screen, lock screen or screen for adding users into multi-profile |
105 // session. | 106 // session. |
106 virtual bool IsUserSessionBlocked() const = 0; | 107 virtual bool IsUserSessionBlocked() const = 0; |
107 | 108 |
108 // Returns current session state. | 109 // Returns current session state. |
109 virtual SessionState GetSessionState() const = 0; | 110 virtual SessionState GetSessionState() const = 0; |
110 | 111 |
111 // Gets the displayed name for the user with the given |index|. | 112 // TODO(oshima): consolidate these two GetUserInfo. |
| 113 |
| 114 // Gets the user info for the user with the given |index|. |
112 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | 115 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. |
113 virtual const base::string16 GetUserDisplayName( | 116 virtual const UserInfo* GetUserInfo(MultiProfileIndex index) const = 0; |
114 MultiProfileIndex index) const = 0; | |
115 | |
116 // Gets the given name of the user with |index|. An empty string can be | |
117 // returned if the given name of the user is unknown. | |
118 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
119 virtual const base::string16 GetUserGivenName( | |
120 MultiProfileIndex index) const = 0; | |
121 | |
122 // Gets the display email address for the user with the given |index|. | |
123 // The display email address might contains some periods in the email name | |
124 // as well as capitalized letters. For example: "Foo.Bar@mock.com". | |
125 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
126 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0; | |
127 | |
128 // Gets the user id (sanitized email address) for the user with the given | |
129 // |index|. The function would return something like "foobar@mock.com". | |
130 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
131 virtual const std::string GetUserID(MultiProfileIndex index) const = 0; | |
132 | 117 |
133 // Gets the avatar image for the user associated with the |context|. | 118 // Gets the avatar image for the user associated with the |context|. |
134 virtual const gfx::ImageSkia& GetUserImage( | 119 virtual const UserInfo* GetUserInfo( |
135 content::BrowserContext* context) const = 0; | 120 content::BrowserContext* context) const = 0; |
136 | 121 |
137 // Whether or not the window's title should show the avatar. | 122 // Whether or not the window's title should show the avatar. |
138 virtual bool ShouldShowAvatar(aura::Window* window) = 0; | 123 virtual bool ShouldShowAvatar(aura::Window* window) const = 0; |
139 | 124 |
140 // Switches to another active user with |user_id| | 125 // Switches to another active user with |user_id| |
141 // (if that user has already signed in). | 126 // (if that user has already signed in). |
142 virtual void SwitchActiveUser(const std::string& user_id) = 0; | 127 virtual void SwitchActiveUser(const std::string& user_id) = 0; |
143 | 128 |
144 // Switches the active user to the next or previous user, with the same | 129 // Switches the active user to the next or previous user, with the same |
145 // ordering as GetLoggedInUsers. | 130 // ordering as GetLoggedInUsers. |
146 virtual void CycleActiveUser(CycleUser cycle_user) = 0; | 131 virtual void CycleActiveUser(CycleUser cycle_user) = 0; |
147 | 132 |
148 // Adds or removes sessions state observer. | 133 // Adds or removes sessions state observer. |
149 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; | 134 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; |
150 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; | 135 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; |
151 }; | 136 }; |
152 | 137 |
153 } // namespace ash | 138 } // namespace ash |
154 | 139 |
155 #endif // ASH_SESSION_STATE_DELEGATE_H_ | 140 #endif // ASH_SESSION_SESSION_STATE_DELEGATE_H_ |
OLD | NEW |