| // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef ASH_SESSION_SESSION_OBSERVER_H_ |
| #define ASH_SESSION_SESSION_OBSERVER_H_ |
| |
| #include "ash/ash_export.h" |
| #include "base/macros.h" |
| #include "components/session_manager/session_manager_types.h" |
| |
| class AccountId; |
| class PrefService; |
| |
| namespace ash { |
| |
| enum class LoginStatus; |
| |
| class ASH_EXPORT SessionObserver { |
| public: |
| // Called when the active user session has changed. |
| virtual void OnActiveUserSessionChanged(const AccountId& account_id) {} |
| |
| // Called when a user session gets added to the existing session. |
| virtual void OnUserSessionAdded(const AccountId& account_id) {} |
| |
| // Called when a user session is updated, such as avatar change. |
| virtual void OnUserSessionUpdated(const AccountId& account_id) {} |
| |
| // Called when the session state is changed. |
| virtual void OnSessionStateChanged(session_manager::SessionState state) {} |
| |
| // Called when the login status is changed. |login_status| is the new status. |
| virtual void OnLoginStatusChanged(LoginStatus login_status) {} |
| |
| // Called when the lock state is changed. |locked| is the current lock stated. |
| virtual void OnLockStateChanged(bool locked) {} |
| |
| // Called when chrome is terminating. |
| virtual void OnChromeTerminating() {} |
| |
| // Called when the limit becomes available and when it changes. |
| virtual void OnSessionLengthLimitChanged() {} |
| |
| // Called when the signin screen profile |prefs| are ready. |
| virtual void OnSigninScreenPrefServiceInitialized(PrefService* prefs) {} |
| |
| // Called when the PrefService for the active user session changes. This can |
| // be due to the active user session changing or the PrefService for the |
| // currently-active user session becoming initialized. This is never called |
| // with null. |
| virtual void OnActiveUserPrefServiceChanged(PrefService* pref_service) {} |
| |
| protected: |
| virtual ~SessionObserver() {} |
| }; |
| |
| // A class to attach / detach an object as a session state observer. |
| class ASH_EXPORT ScopedSessionObserver { |
| public: |
| explicit ScopedSessionObserver(SessionObserver* observer); |
| virtual ~ScopedSessionObserver(); |
| |
| private: |
| SessionObserver* const observer_; |
| |
| DISALLOW_COPY_AND_ASSIGN(ScopedSessionObserver); |
| }; |
| |
| } // namespace ash |
| |
| #endif // ASH_SESSION_SESSION_OBSERVER_H_ |