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_SESSION_STATE_OBSERVER_H_ | 5 #ifndef ASH_SESSION_SESSION_STATE_OBSERVER_H_ |
6 #define ASH_SESSION_SESSION_STATE_OBSERVER_H_ | 6 #define ASH_SESSION_SESSION_STATE_OBSERVER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/session_manager/session_manager_types.h" | 10 #include "components/session_manager/session_manager_types.h" |
11 | 11 |
12 class AccountId; | 12 class AccountId; |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 | 15 |
16 enum class LoginStatus; | 16 enum class LoginStatus; |
17 | 17 |
| 18 // TODO(xiyuan): Rename to On*Changed(). |
18 class ASH_EXPORT SessionStateObserver { | 19 class ASH_EXPORT SessionStateObserver { |
19 public: | 20 public: |
20 // Called when active user has changed. | 21 // Called when active user has changed. |
21 virtual void ActiveUserChanged(const AccountId& account_id) {} | 22 virtual void ActiveUserChanged(const AccountId& account_id) {} |
22 | 23 |
23 // Called when another user gets added to the existing session. | 24 // Called when another user gets added to the existing session. |
24 virtual void UserAddedToSession(const AccountId& account_id) {} | 25 virtual void UserAddedToSession(const AccountId& account_id) {} |
25 | 26 |
26 // Called when a user session is updated, such as avatar change. | 27 // Called when a user session is updated, such as avatar change. |
27 virtual void UserSessionUpdated(const AccountId& account_id) {} | 28 virtual void UserSessionUpdated(const AccountId& account_id) {} |
28 | 29 |
29 // Called when the session state is changed. | 30 // Called when the session state is changed. |
30 virtual void SessionStateChanged(session_manager::SessionState state) {} | 31 virtual void SessionStateChanged(session_manager::SessionState state) {} |
31 | 32 |
32 // Called when the login status is changed. |login_status| is the new status. | 33 // Called when the login status is changed. |login_status| is the new status. |
33 virtual void LoginStatusChanged(LoginStatus login_status) {} | 34 virtual void LoginStatusChanged(LoginStatus login_status) {} |
34 | 35 |
| 36 // Called when the lock state is changed. |locked| is the current lock stated. |
| 37 virtual void LockStateChanged(bool locked) {} |
| 38 |
35 protected: | 39 protected: |
36 virtual ~SessionStateObserver() {} | 40 virtual ~SessionStateObserver() {} |
37 }; | 41 }; |
38 | 42 |
39 // A class to attach / detach an object as a session state observer. | 43 // A class to attach / detach an object as a session state observer. |
40 class ASH_EXPORT ScopedSessionStateObserver { | 44 class ASH_EXPORT ScopedSessionStateObserver { |
41 public: | 45 public: |
42 explicit ScopedSessionStateObserver(SessionStateObserver* observer); | 46 explicit ScopedSessionStateObserver(SessionStateObserver* observer); |
43 virtual ~ScopedSessionStateObserver(); | 47 virtual ~ScopedSessionStateObserver(); |
44 | 48 |
45 private: | 49 private: |
46 ash::SessionStateObserver* observer_; | 50 ash::SessionStateObserver* observer_; |
47 | 51 |
48 DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver); | 52 DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver); |
49 }; | 53 }; |
50 | 54 |
51 } // namespace ash | 55 } // namespace ash |
52 | 56 |
53 #endif // ASH_SESSION_SESSION_STATE_OBSERVER_H_ | 57 #endif // ASH_SESSION_SESSION_STATE_OBSERVER_H_ |
OLD | NEW |