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_STATE_DELEGATE_H_ |
6 #define ASH_SESSION_STATE_DELEGATE_H_ | 6 #define ASH_SESSION_STATE_DELEGATE_H_ |
7 | 7 |
8 #include <string> | |
9 #include <vector> | |
10 | |
8 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "base/string16.h" | |
13 | |
14 namespace gfx { | |
15 class ImageSkia; | |
16 } // namespace gfx | |
9 | 17 |
10 namespace ash { | 18 namespace ash { |
11 | 19 |
20 // The index for the multi-profile item to use. The list is always LRU sorted | |
21 // So that the index #0 is the currently active user. | |
22 typedef int MultiProfileIndex; | |
23 | |
24 // A list of email addresses. | |
25 typedef std::vector<std::string> UserEmailList; | |
26 | |
12 // Delegate for checking and modifying the session state. | 27 // Delegate for checking and modifying the session state. |
13 class ASH_EXPORT SessionStateDelegate { | 28 class ASH_EXPORT SessionStateDelegate { |
14 public: | 29 public: |
15 virtual ~SessionStateDelegate() {}; | 30 virtual ~SessionStateDelegate() {}; |
16 | 31 |
17 // Returns |true| if a session is in progress and there is an active user. | 32 // Returns the maximum possible number of logged in users. |
18 virtual bool HasActiveUser() const = 0; | 33 virtual int GetMaximumNumberOfLoggedInUsers() const = 0; |
34 | |
35 // Returns the number of signed in users. If 0 is returned, there is either | |
36 // no session in progress or no active user. | |
37 virtual int NumberOfLoggedInUsers() const = 0; | |
19 | 38 |
20 // Returns |true| if the session has been fully started for the active user. | 39 // Returns |true| if the session has been fully started for the active user. |
21 // When a user becomes active, the profile and browser UI are not immediately | 40 // When a user becomes active, the profile and browser UI are not immediately |
22 // available. Only once this method starts returning |true| is the browser | 41 // available. Only once this method starts returning |true| is the browser |
23 // startup complete and both profile and UI are fully available. | 42 // startup complete and both profile and UI are fully available. |
24 virtual bool IsActiveUserSessionStarted() const = 0; | 43 virtual bool IsActiveUserSessionStarted() const = 0; |
25 | 44 |
26 // Returns true if the screen can be locked. | 45 // Returns true if the screen can be locked. |
27 virtual bool CanLockScreen() const = 0; | 46 virtual bool CanLockScreen() const = 0; |
28 | 47 |
29 // Returns true if the screen is currently locked. | 48 // Returns true if the screen is currently locked. |
30 virtual bool IsScreenLocked() const = 0; | 49 virtual bool IsScreenLocked() const = 0; |
31 | 50 |
32 // Locks the screen. The locking happens asynchronously. | 51 // Locks the screen. The locking happens asynchronously. |
33 virtual void LockScreen() = 0; | 52 virtual void LockScreen() = 0; |
34 | 53 |
35 // Unlocks the screen. | 54 // Unlocks the screen. |
36 virtual void UnlockScreen() = 0; | 55 virtual void UnlockScreen() = 0; |
56 | |
57 // Gets the displayed name for the user with the given |index|. | |
58 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
59 virtual const base::string16 GetUserDisplayName( | |
60 MultiProfileIndex index) const = 0; | |
61 | |
62 // Gets the email address for the user with the given |index|. | |
63 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
64 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0; | |
Nikita (slow)
2013/05/17 17:00:32
nit: GetUserId
Mr4D (OOO till 08-26)
2013/05/17 18:45:09
Actually: No. This is the eMail address for displa
| |
65 | |
66 // Gets the avatar image for the user with the given |index|. | |
67 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | |
68 virtual const gfx::ImageSkia& GetUserImage(MultiProfileIndex index) const = 0; | |
69 | |
70 // Returns a list of all logged in users. | |
71 virtual void GetLoggedInUsers(UserEmailList* users) = 0; | |
72 | |
73 // Switches to another active user (if that user has already signed in). | |
74 virtual void SwitchActiveUser(const std::string& email) = 0; | |
Nikita (slow)
2013/05/17 17:00:32
nit: user_id
Mr4D (OOO till 08-26)
2013/05/17 18:45:09
Okay - even though that is also quite odd since it
| |
37 }; | 75 }; |
38 | 76 |
39 } // namespace ash | 77 } // namespace ash |
40 | 78 |
41 #endif // ASH_SESSION_STATE_DELEGATE_H_ | 79 #endif // ASH_SESSION_STATE_DELEGATE_H_ |
OLD | NEW |