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_COMMON_SESSION_SESSION_STATE_OBSERVER_H_ |
6 #define ASH_SESSION_SESSION_STATE_OBSERVER_H_ | 6 #define ASH_COMMON_SESSION_SESSION_STATE_OBSERVER_H_ |
7 | |
8 #include <string> | |
9 | 7 |
10 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
11 #include "ash/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
12 #include "base/macros.h" | 10 #include "base/macros.h" |
13 | 11 |
14 class AccountId; | 12 class AccountId; |
15 | 13 |
16 namespace ash { | 14 namespace ash { |
17 | 15 |
18 class ASH_EXPORT SessionStateObserver { | 16 class ASH_EXPORT SessionStateObserver { |
19 public: | 17 public: |
20 // Called when active user has changed. | 18 // Called when active user has changed. |
21 virtual void ActiveUserChanged(const AccountId& account_id) {} | 19 virtual void ActiveUserChanged(const AccountId& account_id) {} |
22 | 20 |
23 // Called when another user gets added to the existing session. | 21 // Called when another user gets added to the existing session. |
24 virtual void UserAddedToSession(const AccountId& account_id) {} | 22 virtual void UserAddedToSession(const AccountId& account_id) {} |
25 | 23 |
26 // Called when session state is changed. | 24 // Called when session state is changed. |
27 virtual void SessionStateChanged(SessionStateDelegate::SessionState state) {} | 25 virtual void SessionStateChanged(SessionStateDelegate::SessionState state) {} |
28 | 26 |
29 protected: | 27 protected: |
30 virtual ~SessionStateObserver() {} | 28 virtual ~SessionStateObserver() {} |
31 }; | 29 }; |
32 | 30 |
33 // A class to attach / detach an object as a session state observer with a | 31 // A class to attach / detach an object as a session state observer. |
34 // scoped pointer. | |
35 class ASH_EXPORT ScopedSessionStateObserver { | 32 class ASH_EXPORT ScopedSessionStateObserver { |
36 public: | 33 public: |
37 explicit ScopedSessionStateObserver(ash::SessionStateObserver* observer); | 34 explicit ScopedSessionStateObserver(SessionStateObserver* observer); |
38 virtual ~ScopedSessionStateObserver(); | 35 virtual ~ScopedSessionStateObserver(); |
39 | 36 |
40 private: | 37 private: |
41 ash::SessionStateObserver* observer_; | 38 ash::SessionStateObserver* observer_; |
42 | 39 |
43 DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver); | 40 DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver); |
44 }; | 41 }; |
45 | 42 |
46 } // namespace ash | 43 } // namespace ash |
47 | 44 |
48 #endif // ASH_SESSION_SESSION_STATE_OBSERVER_H_ | 45 #endif // ASH_COMMON_SESSION_SESSION_STATE_OBSERVER_H_ |
OLD | NEW |