Chromium Code Reviews| 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> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 // TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause | 38 // TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause |
| 39 // GetUserXXX are useful for non multi profile scenario in ash_shell. | 39 // GetUserXXX are useful for non multi profile scenario in ash_shell. |
| 40 class ASH_EXPORT SessionStateDelegate { | 40 class ASH_EXPORT SessionStateDelegate { |
| 41 public: | 41 public: |
| 42 // Defines the cycle direction for |CycleActiveUser|. | 42 // Defines the cycle direction for |CycleActiveUser|. |
| 43 enum CycleUser { | 43 enum CycleUser { |
| 44 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user. | 44 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user. |
| 45 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user. | 45 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user. |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Defines session state i.e. whether session is running or not and | |
| 49 // whether user session is blocked by things like multi-profile login. | |
| 50 enum SessionState { | |
| 51 // When primary user login UI is shown i.e. after boot or sign out, | |
| 52 // no active user session exists yet. | |
| 53 STATE_LOGIN_PRIMARY = 0, | |
|
stevenjb
2014/04/10 17:47:55
I'd still like to name these SESSION_STATE_*
Nikita (slow)
2014/04/11 08:58:41
Done.
| |
| 54 | |
| 55 // Inside user session, no blocking UI (login/lock) is shown. | |
| 56 STATE_SESSION, | |
|
stevenjb
2014/04/10 17:47:55
Maybe SESSION_STATE_ACTIVE?
Nikita (slow)
2014/04/11 08:58:41
Done.
| |
| 57 | |
| 58 // When secondary user login UI is shown i.e. other users are | |
| 59 // already logged in and is currently adding another user to the session. | |
| 60 STATE_LOGIN_SECONDARY, | |
| 61 }; | |
| 62 | |
| 48 virtual ~SessionStateDelegate() {}; | 63 virtual ~SessionStateDelegate() {}; |
| 49 | 64 |
| 50 // Returns the browser context for the user given by |index|. | 65 // Returns the browser context for the user given by |index|. |
| 51 virtual content::BrowserContext* GetBrowserContextByIndex( | 66 virtual content::BrowserContext* GetBrowserContextByIndex( |
| 52 MultiProfileIndex index) = 0; | 67 MultiProfileIndex index) = 0; |
| 53 | 68 |
| 54 // Returns the browser context associated with the window. | 69 // Returns the browser context associated with the window. |
| 55 virtual content::BrowserContext* GetBrowserContextForWindow( | 70 virtual content::BrowserContext* GetBrowserContextForWindow( |
| 56 aura::Window* window) = 0; | 71 aura::Window* window) = 0; |
| 57 | 72 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 82 virtual void LockScreen() = 0; | 97 virtual void LockScreen() = 0; |
| 83 | 98 |
| 84 // Unlocks the screen. | 99 // Unlocks the screen. |
| 85 virtual void UnlockScreen() = 0; | 100 virtual void UnlockScreen() = 0; |
| 86 | 101 |
| 87 // Returns |true| if user session blocked by some overlying UI. It can be | 102 // Returns |true| if user session blocked by some overlying UI. It can be |
| 88 // login screen, lock screen or screen for adding users into multi-profile | 103 // login screen, lock screen or screen for adding users into multi-profile |
| 89 // session. | 104 // session. |
| 90 virtual bool IsUserSessionBlocked() const = 0; | 105 virtual bool IsUserSessionBlocked() const = 0; |
| 91 | 106 |
| 107 // Returns current session state. | |
| 108 virtual SessionState GetSessionState() const = 0; | |
| 109 | |
| 92 // Gets the displayed name for the user with the given |index|. | 110 // Gets the displayed name for the user with the given |index|. |
| 93 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | 111 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. |
| 94 virtual const base::string16 GetUserDisplayName( | 112 virtual const base::string16 GetUserDisplayName( |
| 95 MultiProfileIndex index) const = 0; | 113 MultiProfileIndex index) const = 0; |
| 96 | 114 |
| 97 // Gets the display email address for the user with the given |index|. | 115 // Gets the display email address for the user with the given |index|. |
| 98 // The display email address might contains some periods in the email name | 116 // The display email address might contains some periods in the email name |
| 99 // as well as capitalized letters. For example: "Foo.Bar@mock.com". | 117 // as well as capitalized letters. For example: "Foo.Bar@mock.com". |
| 100 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. | 118 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. |
| 101 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0; | 119 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 121 virtual void CycleActiveUser(CycleUser cycle_user) = 0; | 139 virtual void CycleActiveUser(CycleUser cycle_user) = 0; |
| 122 | 140 |
| 123 // Adds or removes sessions state observer. | 141 // Adds or removes sessions state observer. |
| 124 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; | 142 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; |
| 125 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; | 143 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; |
| 126 }; | 144 }; |
| 127 | 145 |
| 128 } // namespace ash | 146 } // namespace ash |
| 129 | 147 |
| 130 #endif // ASH_SESSION_STATE_DELEGATE_H_ | 148 #endif // ASH_SESSION_STATE_DELEGATE_H_ |
| OLD | NEW |