| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_SESSION_STATE_DELEGATE_H_ | 5 #ifndef ASH_SESSION_SESSION_STATE_DELEGATE_H_ |
| 6 #define ASH_SESSION_SESSION_STATE_DELEGATE_H_ | 6 #define ASH_SESSION_SESSION_STATE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/session/session_types.h" | 11 #include "ash/session/session_types.h" |
| 12 | 12 |
| 13 class AccountId; | 13 class AccountId; |
| 14 | 14 |
| 15 namespace aura { | |
| 16 class Window; | |
| 17 } | |
| 18 | |
| 19 namespace gfx { | 15 namespace gfx { |
| 20 class ImageSkia; | 16 class ImageSkia; |
| 21 } | 17 } |
| 22 | 18 |
| 23 namespace user_manager { | 19 namespace user_manager { |
| 24 class UserInfo; | 20 class UserInfo; |
| 25 } | 21 } |
| 26 | 22 |
| 27 namespace ash { | 23 namespace ash { |
| 28 | 24 |
| 29 class SessionStateObserver; | 25 class SessionStateObserver; |
| 26 class WmWindow; |
| 30 | 27 |
| 31 // Delegate for checking and modifying the session state. | 28 // Delegate for checking and modifying the session state. |
| 32 class ASH_EXPORT SessionStateDelegate { | 29 class ASH_EXPORT SessionStateDelegate { |
| 33 public: | 30 public: |
| 34 // Defines the cycle direction for |CycleActiveUser|. | 31 // Defines the cycle direction for |CycleActiveUser|. |
| 35 enum CycleUser { | 32 enum CycleUser { |
| 36 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user. | 33 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user. |
| 37 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user. | 34 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user. |
| 38 }; | 35 }; |
| 39 | 36 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 52 | 49 |
| 53 // Inside user session (including lock screen), | 50 // Inside user session (including lock screen), |
| 54 // no login UI (primary or multi-profiles) is shown. | 51 // no login UI (primary or multi-profiles) is shown. |
| 55 SESSION_STATE_ACTIVE, | 52 SESSION_STATE_ACTIVE, |
| 56 | 53 |
| 57 // When secondary user login UI is shown i.e. other users are | 54 // 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. | 55 // already logged in and is currently adding another user to the session. |
| 59 SESSION_STATE_LOGIN_SECONDARY, | 56 SESSION_STATE_LOGIN_SECONDARY, |
| 60 }; | 57 }; |
| 61 | 58 |
| 62 virtual ~SessionStateDelegate() {}; | 59 virtual ~SessionStateDelegate() {} |
| 63 | 60 |
| 64 // Returns the maximum possible number of logged in users. | 61 // Returns the maximum possible number of logged in users. |
| 65 virtual int GetMaximumNumberOfLoggedInUsers() const = 0; | 62 virtual int GetMaximumNumberOfLoggedInUsers() const = 0; |
| 66 | 63 |
| 67 // Returns the number of signed in users. If 0 is returned, there is either | 64 // Returns the number of signed in users. If 0 is returned, there is either |
| 68 // no session in progress or no active user. | 65 // no session in progress or no active user. |
| 69 virtual int NumberOfLoggedInUsers() const = 0; | 66 virtual int NumberOfLoggedInUsers() const = 0; |
| 70 | 67 |
| 71 // Returns true if there is possible to add more users to multiprofile | 68 // 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 | 69 // session. Error is stored in |error| if it is not NULL and function |
| (...skipping 29 matching lines...) Expand all Loading... |
| 102 | 99 |
| 103 // Returns current session state. | 100 // Returns current session state. |
| 104 virtual SessionState GetSessionState() const = 0; | 101 virtual SessionState GetSessionState() const = 0; |
| 105 | 102 |
| 106 // Gets the user info for the user with the given |index|. See session_types.h | 103 // Gets the user info for the user with the given |index|. See session_types.h |
| 107 // for a description of UserIndex. | 104 // for a description of UserIndex. |
| 108 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | 105 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. |
| 109 virtual const user_manager::UserInfo* GetUserInfo(UserIndex index) const = 0; | 106 virtual const user_manager::UserInfo* GetUserInfo(UserIndex index) const = 0; |
| 110 | 107 |
| 111 // Whether or not the window's title should show the avatar. | 108 // Whether or not the window's title should show the avatar. |
| 112 virtual bool ShouldShowAvatar(aura::Window* window) const = 0; | 109 virtual bool ShouldShowAvatar(WmWindow* window) const = 0; |
| 113 | 110 |
| 114 // Returns the avatar image for the specified window. | 111 // Returns the avatar image for the specified window. |
| 115 virtual gfx::ImageSkia GetAvatarImageForWindow( | 112 virtual gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const = 0; |
| 116 aura::Window* window) const = 0; | |
| 117 | 113 |
| 118 // Switches to another active user with |account_id| | 114 // Switches to another active user with |account_id| |
| 119 // (if that user has already signed in). | 115 // (if that user has already signed in). |
| 120 virtual void SwitchActiveUser(const AccountId& account_id) = 0; | 116 virtual void SwitchActiveUser(const AccountId& account_id) = 0; |
| 121 | 117 |
| 122 // Switches the active user to the next or previous user, with the same | 118 // Switches the active user to the next or previous user, with the same |
| 123 // ordering as GetLoggedInUsers. | 119 // ordering as GetLoggedInUsers. |
| 124 virtual void CycleActiveUser(CycleUser cycle_user) = 0; | 120 virtual void CycleActiveUser(CycleUser cycle_user) = 0; |
| 125 | 121 |
| 126 // Returns true if primary user policy does not forbid multiple signin. | 122 // Returns true if primary user policy does not forbid multiple signin. |
| 127 virtual bool IsMultiProfileAllowedByPrimaryUserPolicy() const = 0; | 123 virtual bool IsMultiProfileAllowedByPrimaryUserPolicy() const = 0; |
| 128 | 124 |
| 129 // Adds or removes sessions state observer. | 125 // Adds or removes sessions state observer. |
| 130 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; | 126 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; |
| 131 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; | 127 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; |
| 132 | 128 |
| 133 bool IsInSecondaryLoginScreen() const; | 129 bool IsInSecondaryLoginScreen() const; |
| 134 }; | 130 }; |
| 135 | 131 |
| 136 } // namespace ash | 132 } // namespace ash |
| 137 | 133 |
| 138 #endif // ASH_SESSION_SESSION_STATE_DELEGATE_H_ | 134 #endif // ASH_SESSION_SESSION_STATE_DELEGATE_H_ |
| OLD | NEW |