session_manager_observer.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_OBSERVER_H_
  5. #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_OBSERVER_H_
  6. #include "base/observer_list_types.h"
  7. #include "components/session_manager/session_manager_types.h"
  8. namespace session_manager {
  9. // An observer interface for SessionManager.
  10. // TODO(xiyuan): Use this to replace UserManager::UserSessionStateObserver,
  11. // http://crbug.com/657149.
  12. class SessionManagerObserver : public base::CheckedObserver {
  13. public:
  14. // Invoked when session state is changed.
  15. virtual void OnSessionStateChanged() {}
  16. // Invoked when a user profile is loaded.
  17. virtual void OnUserProfileLoaded(const AccountId& account_id) {}
  18. // Invoked when a user session is started. If this is a new user on the
  19. // machine this will not be called until after post-login steps are finished
  20. // (for example a profile picture has been selected). In contrast,
  21. // UserSessionStateObserver::OnActiveUserChanged() is invoked immediately
  22. // after the user has logged in.
  23. virtual void OnUserSessionStarted(bool is_primary_user) {}
  24. // Invoked when a network error message is displayed on the WebUI login
  25. // screen.
  26. virtual void OnNetworkErrorScreenShown() {}
  27. // Invoked when the specific part of login/lock WebUI is considered to be
  28. // visible. That moment is tracked as the first paint event after
  29. // `OnNetworkErrorScreenShown()`.
  30. //
  31. // Possible series of notifications:
  32. // 1. Boot into fresh OOBE. `OnLoginOrLockScreenVisible()`.
  33. // 2. Boot into user pods list (normal boot). Same for lock screen.
  34. // `OnLoginOrLockScreenVisible()`.
  35. // 3. Boot into GAIA sign in UI (user pods display disabled or no users):
  36. // if no network is connected or flaky network
  37. // (`OnLoginOrLockScreenVisible()` + `OnNetworkErrorScreenShown()`).
  38. // 4. Boot into retail mode. `OnLoginOrLockScreenVisible()`.
  39. virtual void OnLoginOrLockScreenVisible() {}
  40. };
  41. } // namespace session_manager
  42. #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_OBSERVER_H_