login_screen_model.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. // Copyright 2019 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 ASH_PUBLIC_CPP_LOGIN_SCREEN_MODEL_H_
  5. #define ASH_PUBLIC_CPP_LOGIN_SCREEN_MODEL_H_
  6. #include <string>
  7. #include "ash/public/cpp/ash_public_export.h"
  8. #include "base/time/time.h"
  9. class AccountId;
  10. namespace ash {
  11. enum class FingerprintState;
  12. enum class SmartLockState;
  13. enum class OobeDialogState;
  14. struct AuthDisabledData;
  15. struct EasyUnlockIconInfo;
  16. struct InputMethodItem;
  17. struct LocaleItem;
  18. struct LoginUserInfo;
  19. struct UserAvatar;
  20. // Provides Chrome access to Ash's login UI. See additional docs for
  21. // ash::LoginDataDispatcher.
  22. class ASH_PUBLIC_EXPORT LoginScreenModel {
  23. public:
  24. // Set the users who are displayed on the login UI. |users| is filtered
  25. // and does not correspond to every user on the device.
  26. virtual void SetUserList(const std::vector<LoginUserInfo>& users) = 0;
  27. // Notification if pin is enabled or disabled for the given user.
  28. // |account_id|: The account id of the user in the user pod.
  29. // |is_enabled|: True if pin unlock is enabled.
  30. virtual void SetPinEnabledForUser(const AccountId& user, bool enabled) = 0;
  31. // TODO(https://crbug.com/1233614): Delete this method in favor of
  32. // SetSmartLockState once the Smart Lock UI revamp is enabled. Requests to
  33. // show the custom icon in the user pod. |account_id|: The account id of the
  34. // user in the user pod. |icon_info|: Information regarding the icon.
  35. virtual void ShowEasyUnlockIcon(const AccountId& account_id,
  36. const EasyUnlockIconInfo& icon_info) = 0;
  37. // Update the status of the challenge-response authentication against a
  38. // security token for the given user.
  39. virtual void SetChallengeResponseAuthEnabledForUser(const AccountId& user,
  40. bool enabled) = 0;
  41. // Shows a warning banner message on the login screen. A warning banner is
  42. // used to notify users of important messages before they log in to their
  43. // session. (e.g. Tell the user that an update of the user data will start
  44. // on login.) If |message| is empty, the banner will be hidden.
  45. virtual void UpdateWarningMessage(const std::u16string& message) = 0;
  46. // Update the status of fingerprint for |account_id|.
  47. virtual void SetFingerprintState(const AccountId& account_id,
  48. FingerprintState state) = 0;
  49. // Called after a fingerprint authentication attempt has been made. If
  50. // |successful| is true, then the fingerprint authentication attempt was
  51. // successful and the device should be unlocked. If false, an error message
  52. // should be shown to the user.
  53. virtual void NotifyFingerprintAuthResult(const AccountId& account_id,
  54. bool successful) = 0;
  55. // Reset the fingerprint state after an aborted unlock. This returns
  56. // fingerprint elements that were affected by a successful scan to their state
  57. // prior to the scan.
  58. virtual void ResetFingerprintUIState(const AccountId& account_id) = 0;
  59. // Update the status of Smart Lock for |account_id|.
  60. virtual void SetSmartLockState(const AccountId& account_id,
  61. SmartLockState state) = 0;
  62. // Called after a Smart Lock authentication attempt has been made. If
  63. // |successful| is true, then the Smart Lock authentication attempt was
  64. // successful and the device should be unlocked. If false, an error message
  65. // should be shown to the user.
  66. virtual void NotifySmartLockAuthResult(const AccountId& account_id,
  67. bool successful) = 0;
  68. // Called when auth should be enabled for the given user. When auth is
  69. // disabled, the user cannot unlock the device. Auth is enabled by default.
  70. // |account_id|: The account id of the user in the user pod.
  71. virtual void EnableAuthForUser(const AccountId& account_id) = 0;
  72. // Called when auth should be disabled for the given user. When auth is
  73. // disabled, the user cannot unlock the device. Auth is enabled by default.
  74. // |account_id|: The account id of the user in the user pod.
  75. // |auth_disabled_data|: The data needed to customize the lock screen UI.
  76. virtual void DisableAuthForUser(
  77. const AccountId& account_id,
  78. const AuthDisabledData& auth_disabled_data) = 0;
  79. virtual void SetTpmLockedState(const AccountId& user,
  80. bool is_locked,
  81. base::TimeDelta time_left) = 0;
  82. // Enables or disables the authentication type to tap-to-unlock for the user.
  83. virtual void SetTapToUnlockEnabledForUser(const AccountId& account_id,
  84. bool enabled) = 0;
  85. // Forces online sign-in for the user.
  86. virtual void ForceOnlineSignInForUser(const AccountId& account_id) = 0;
  87. // Called when |avatar| for |account_id| has changed.
  88. virtual void SetAvatarForUser(const AccountId& account_id,
  89. const UserAvatar& avatar) = 0;
  90. // Called when new system information is available.
  91. // |show|: Whether the system information should be displayed to user.
  92. // |enforced|: Whether the display of system information is enforced and
  93. // cannot be changed by some specific user operations (e.g., pressing alt-v).
  94. // |os_version_label_text|: The OS version.
  95. // |enterprise_info_text|: The enterprise info.
  96. // |bluetooth_name|: The name of the bluetooth adapter.
  97. // |adb_sideloading_enabled|: The device status of adb sideoading.
  98. virtual void SetSystemInfo(bool show,
  99. bool enforced,
  100. const std::string& os_version_label_text,
  101. const std::string& enterprise_info_text,
  102. const std::string& bluetooth_name,
  103. bool adb_sideloading_enabled) = 0;
  104. // Set the public session display name for user with |account_id|.
  105. virtual void SetPublicSessionDisplayName(const AccountId& account_id,
  106. const std::string& display_name) = 0;
  107. // Set the public session locales for user with |account_id|.
  108. // |locales|: Available locales for this user.
  109. // |default_locale|: Default locale for this user.
  110. // |show_advanced_view|: True if we should show the advanced expanded user
  111. // view for the public session.
  112. virtual void SetPublicSessionLocales(const AccountId& account_id,
  113. const std::vector<LocaleItem>& locales,
  114. const std::string& default_locale,
  115. bool show_advanced_view) = 0;
  116. // Set the public session keyboard layouts for user with |account_id|.
  117. // |locale|: The locale that |keyboard_layouts| can be used for.
  118. virtual void SetPublicSessionKeyboardLayouts(
  119. const AccountId& account_id,
  120. const std::string& locale,
  121. const std::vector<InputMethodItem>& keyboard_layouts) = 0;
  122. // Sets whether full management disclosure is needed for the public/managed
  123. // session login screen.
  124. virtual void SetPublicSessionShowFullManagementDisclosure(
  125. bool show_full_management_disclosure) = 0;
  126. // Called when focus is reported to be leaving a lock screen app window.
  127. // Requests focus to be handed off to the next suitable widget.
  128. // |reverse|: Whether the tab order is reversed.
  129. virtual void HandleFocusLeavingLockScreenApps(bool reverse) = 0;
  130. // Called when the dialog hosting oobe has changed state. The oobe dialog
  131. // provides support for any part of login that is implemented in JS/HTML, such
  132. // as add user or powerwash.
  133. virtual void NotifyOobeDialogState(OobeDialogState state) = 0;
  134. virtual void NotifyFocusPod(const AccountId& account_id) = 0;
  135. protected:
  136. virtual ~LoginScreenModel();
  137. };
  138. } // namespace ash
  139. #endif // ASH_PUBLIC_CPP_LOGIN_SCREEN_MODEL_H_