[go: nahoru, domu]

blob: ce939894b198f1c8eaafbae3446a34a04b629e43 [file] [log] [blame]
xiaoyinh2bbdd102017-05-18 23:29:421// Copyright 2017 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
Jacob Dufaultffd9b0d2017-11-15 23:07:165#include "ash/login/login_screen_controller.h"
xiaoyinh2bbdd102017-05-18 23:29:426
Quan Nguyen92f924a2018-10-18 18:36:467#include <utility>
8
Quan Nguyen3d7a0f02018-09-04 23:53:559#include "ash/focus_cycler.h"
jdufaulteb4c9f1e2017-06-08 23:08:3010#include "ash/login/ui/lock_screen.h"
Jacob Dufault40623d52017-09-15 17:22:5311#include "ash/login/ui/login_data_dispatcher.h"
Henrique Grandinetti4eb2eae2019-05-31 16:31:1712#include "ash/login/ui/parent_access_widget.h"
Sarah Hu069eea12017-09-08 01:28:4013#include "ash/public/cpp/ash_pref_names.h"
Evan Stade2e4c22e2019-06-07 02:13:5514#include "ash/public/cpp/login_screen_client.h"
Anastasiia Nikolaienko94f9f7d2019-06-11 08:12:0715#include "ash/public/cpp/toast_data.h"
Aga Wronska16abb432018-01-11 23:49:5916#include "ash/root_window_controller.h"
Xiyuan Xiae7b19542019-05-06 23:05:1817#include "ash/session/session_controller_impl.h"
Jacob Dufault5ac266ef2018-07-18 17:30:3018#include "ash/shelf/login_shelf_view.h"
Quan Nguyend09dd112018-06-19 19:20:3219#include "ash/shelf/shelf.h"
20#include "ash/shelf/shelf_widget.h"
Sarah Hu069eea12017-09-08 01:28:4021#include "ash/shell.h"
Aga Wronska16abb432018-01-11 23:49:5922#include "ash/system/status_area_widget.h"
Quan Nguyen3d7a0f02018-09-04 23:53:5523#include "ash/system/status_area_widget_delegate.h"
Anastasiia Nikolaienko8cdd7e62019-06-12 12:16:2424#include "ash/system/toast/toast_manager_impl.h"
Jun Mukai5c7b5b42018-11-30 00:08:5025#include "ash/system/tray/system_tray_notifier.h"
Quan Nguyen92f924a2018-10-18 18:36:4626#include "base/bind.h"
Jacob Dufaultc06d6ca2018-04-24 23:49:1727#include "base/debug/alias.h"
Sarah Hu069eea12017-09-08 01:28:4028#include "base/strings/string_number_conversions.h"
Jialiu Linf99b788b2018-01-17 23:01:2129#include "base/strings/utf_string_conversions.h"
Sarah Hu069eea12017-09-08 01:28:4030#include "components/prefs/pref_registry_simple.h"
Jacob Dufault957e0922017-12-06 19:16:0931#include "components/session_manager/session_manager_types.h"
xiaoyinh2bbdd102017-05-18 23:29:4232
33namespace ash {
34
Sarah Hu069eea12017-09-08 01:28:4035namespace {
xiaoyinh2bbdd102017-05-18 23:29:4236
Aga Wronskaa844cdcd12018-01-29 16:06:4437enum class SystemTrayVisibility {
38 kNone, // Tray not visible anywhere.
39 kPrimary, // Tray visible only on primary display.
40 kAll, // Tray visible on all displays.
41};
42
43void SetSystemTrayVisibility(SystemTrayVisibility visibility) {
44 RootWindowController* primary_window_controller =
45 Shell::GetPrimaryRootWindowController();
46 for (RootWindowController* window_controller :
47 Shell::GetAllRootWindowControllers()) {
48 StatusAreaWidget* status_area = window_controller->GetStatusAreaWidget();
49 if (!status_area)
50 continue;
51 if (window_controller == primary_window_controller) {
52 status_area->SetSystemTrayVisibility(
53 visibility == SystemTrayVisibility::kPrimary ||
54 visibility == SystemTrayVisibility::kAll);
55 } else {
56 status_area->SetSystemTrayVisibility(visibility ==
57 SystemTrayVisibility::kAll);
58 }
59 }
Aga Wronska16abb432018-01-11 23:49:5960}
61
Sarah Hu069eea12017-09-08 01:28:4062} // namespace
63
Jun Mukai5c7b5b42018-11-30 00:08:5064LoginScreenController::LoginScreenController(
65 SystemTrayNotifier* system_tray_notifier)
66 : system_tray_notifier_(system_tray_notifier), weak_factory_(this) {
67 system_tray_notifier_->AddSystemTrayFocusObserver(this);
68}
James Cook8f1e6062017-11-13 23:40:5969
Jun Mukai5c7b5b42018-11-30 00:08:5070LoginScreenController::~LoginScreenController() {
71 system_tray_notifier_->RemoveSystemTrayFocusObserver(this);
72}
xiaoyinh2bbdd102017-05-18 23:29:4273
Sarah Hu069eea12017-09-08 01:28:4074// static
Jacob Dufaultffd9b0d2017-11-15 23:07:1675void LoginScreenController::RegisterProfilePrefs(PrefRegistrySimple* registry,
76 bool for_test) {
Sarah Hu069eea12017-09-08 01:28:4077 if (for_test) {
78 // There is no remote pref service, so pretend that ash owns the pref.
79 registry->RegisterStringPref(prefs::kQuickUnlockPinSalt, "");
80 return;
81 }
Sarah Hu069eea12017-09-08 01:28:4082}
83
Jacob Dufault2ca8c502018-06-25 19:12:1484bool LoginScreenController::IsAuthenticating() const {
85 return authentication_stage_ != AuthenticationStage::kIdle;
86}
87
Jacob Dufault2d20ae62018-09-20 22:19:5288void LoginScreenController::AuthenticateUserWithPasswordOrPin(
89 const AccountId& account_id,
90 const std::string& password,
91 bool authenticated_by_pin,
92 OnAuthenticateCallback callback) {
Jacob Dufault8876ba82018-03-27 22:55:4393 // It is an error to call this function while an authentication is in
94 // progress.
Jacob Dufault2d20ae62018-09-20 22:19:5295 LOG_IF(FATAL, IsAuthenticating())
Jacob Dufault58a1bf42018-07-10 17:44:5696 << "Duplicate authentication attempt; current authentication stage is "
97 << static_cast<int>(authentication_stage_);
Jacob Dufault8876ba82018-03-27 22:55:4398
Evan Stade2e4c22e2019-06-07 02:13:5599 if (!client_) {
Jacob Dufaultb7a2d842017-12-01 23:21:15100 std::move(callback).Run(base::nullopt);
xiaoyinh9f6fa0e2017-06-07 19:22:32101 return;
Jacob Dufaultb7a2d842017-12-01 23:21:15102 }
xiaoyinh9f6fa0e2017-06-07 19:22:32103
Jacob Dufaulteafc6fe2017-10-11 21:16:52104 // If auth is disabled by the debug overlay bypass the mojo call entirely, as
105 // it will dismiss the lock screen if the password is correct.
Jacob Dufault0fbed9c02017-11-14 19:22:24106 switch (force_fail_auth_for_debug_overlay_) {
107 case ForceFailAuth::kOff:
108 break;
109 case ForceFailAuth::kImmediate:
Jacob Dufaultb7a2d842017-12-01 23:21:15110 OnAuthenticateComplete(std::move(callback), false /*success*/);
Jacob Dufault0fbed9c02017-11-14 19:22:24111 return;
112 case ForceFailAuth::kDelayed:
Jacob Dufault2ca8c502018-06-25 19:12:14113 // Set a dummy authentication stage so that |IsAuthenticating| returns
114 // true.
115 authentication_stage_ = AuthenticationStage::kDoAuthenticate;
Jacob Dufault0fbed9c02017-11-14 19:22:24116 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
Jacob Dufaultb7a2d842017-12-01 23:21:15117 FROM_HERE,
118 base::BindOnce(&LoginScreenController::OnAuthenticateComplete,
119 weak_factory_.GetWeakPtr(), base::Passed(&callback),
120 false),
Jacob Dufault0fbed9c02017-11-14 19:22:24121 base::TimeDelta::FromSeconds(1));
122 return;
Jacob Dufaulteafc6fe2017-10-11 21:16:52123 }
124
Quan Nguyenf5224352018-11-06 02:03:34125 authentication_stage_ = AuthenticationStage::kDoAuthenticate;
126
127 int dummy_value;
128 bool is_pin =
129 authenticated_by_pin && base::StringToInt(password, &dummy_value);
Evan Stade2e4c22e2019-06-07 02:13:55130 client_->AuthenticateUserWithPasswordOrPin(
Quan Nguyenf5224352018-11-06 02:03:34131 account_id, password, is_pin,
132 base::BindOnce(&LoginScreenController::OnAuthenticateComplete,
133 weak_factory_.GetWeakPtr(), base::Passed(&callback)));
xiaoyinh9f6fa0e2017-06-07 19:22:32134}
135
Jacob Dufault2d20ae62018-09-20 22:19:52136void LoginScreenController::AuthenticateUserWithExternalBinary(
137 const AccountId& account_id,
138 OnAuthenticateCallback callback) {
139 // It is an error to call this function while an authentication is in
140 // progress.
141 LOG_IF(FATAL, IsAuthenticating())
142 << "Duplicate authentication attempt; current authentication stage is "
143 << static_cast<int>(authentication_stage_);
144
Evan Stade2e4c22e2019-06-07 02:13:55145 if (!client_) {
Jacob Dufault2d20ae62018-09-20 22:19:52146 std::move(callback).Run(base::nullopt);
147 return;
148 }
149
150 authentication_stage_ = AuthenticationStage::kDoAuthenticate;
Evan Stade2e4c22e2019-06-07 02:13:55151 client_->AuthenticateUserWithExternalBinary(
Jacob Dufault2d20ae62018-09-20 22:19:52152 account_id,
153 base::BindOnce(&LoginScreenController::OnAuthenticateComplete,
154 weak_factory_.GetWeakPtr(), std::move(callback)));
155}
156
Quan Nguyen92f924a2018-10-18 18:36:46157void LoginScreenController::EnrollUserWithExternalBinary(
158 OnAuthenticateCallback callback) {
Evan Stade2e4c22e2019-06-07 02:13:55159 if (!client_) {
Quan Nguyen92f924a2018-10-18 18:36:46160 std::move(callback).Run(base::nullopt);
161 return;
162 }
163
Evan Stade2e4c22e2019-06-07 02:13:55164 client_->EnrollUserWithExternalBinary(base::BindOnce(
Quan Nguyen92f924a2018-10-18 18:36:46165 [](OnAuthenticateCallback callback, bool success) {
166 std::move(callback).Run(base::make_optional<bool>(success));
167 },
168 std::move(callback)));
169}
170
Jacob Dufault2d20ae62018-09-20 22:19:52171void LoginScreenController::AuthenticateUserWithEasyUnlock(
172 const AccountId& account_id) {
173 // TODO(jdufault): integrate this into authenticate stage after mojom is
174 // refactored to use a callback.
Evan Stade2e4c22e2019-06-07 02:13:55175 if (!client_)
xiaoyinh9f6fa0e2017-06-07 19:22:32176 return;
Evan Stade2e4c22e2019-06-07 02:13:55177 client_->AuthenticateUserWithEasyUnlock(account_id);
xiaoyinh9f6fa0e2017-06-07 19:22:32178}
179
Evan Stade2e4c22e2019-06-07 02:13:55180bool LoginScreenController::ValidateParentAccessCode(
Henrique Grandinetti4eb2eae2019-05-31 16:31:17181 const AccountId& account_id,
Evan Stade2e4c22e2019-06-07 02:13:55182 const std::string& code) {
183 if (!client_)
184 return false;
Aga Wronskaac6cf362019-02-26 21:36:55185
Evan Stade2e4c22e2019-06-07 02:13:55186 return client_->ValidateParentAccessCode(account_id, code);
Aga Wronskaac6cf362019-02-26 21:36:55187}
188
Jacob Dufaultffd9b0d2017-11-15 23:07:16189void LoginScreenController::HardlockPod(const AccountId& account_id) {
Evan Stade2e4c22e2019-06-07 02:13:55190 if (!client_)
xiaoyinh9f6fa0e2017-06-07 19:22:32191 return;
Evan Stade2e4c22e2019-06-07 02:13:55192 client_->HardlockPod(account_id);
xiaoyinh9f6fa0e2017-06-07 19:22:32193}
194
Jacob Dufaultffd9b0d2017-11-15 23:07:16195void LoginScreenController::OnFocusPod(const AccountId& account_id) {
Evan Stade2e4c22e2019-06-07 02:13:55196 if (!client_)
xiaoyinhf534c4f2017-06-13 20:50:27197 return;
Evan Stade2e4c22e2019-06-07 02:13:55198 client_->OnFocusPod(account_id);
xiaoyinhf534c4f2017-06-13 20:50:27199}
200
Jacob Dufaultffd9b0d2017-11-15 23:07:16201void LoginScreenController::OnNoPodFocused() {
Evan Stade2e4c22e2019-06-07 02:13:55202 if (!client_)
xiaoyinhf534c4f2017-06-13 20:50:27203 return;
Evan Stade2e4c22e2019-06-07 02:13:55204 client_->OnNoPodFocused();
xiaoyinhf534c4f2017-06-13 20:50:27205}
206
Jacob Dufaultffd9b0d2017-11-15 23:07:16207void LoginScreenController::LoadWallpaper(const AccountId& account_id) {
Evan Stade2e4c22e2019-06-07 02:13:55208 if (!client_)
xiaoyinhf534c4f2017-06-13 20:50:27209 return;
Evan Stade2e4c22e2019-06-07 02:13:55210 client_->LoadWallpaper(account_id);
xiaoyinhf534c4f2017-06-13 20:50:27211}
212
Jacob Dufaultffd9b0d2017-11-15 23:07:16213void LoginScreenController::SignOutUser() {
Evan Stade2e4c22e2019-06-07 02:13:55214 if (!client_)
xiaoyinhf534c4f2017-06-13 20:50:27215 return;
Evan Stade2e4c22e2019-06-07 02:13:55216 client_->SignOutUser();
xiaoyinhf534c4f2017-06-13 20:50:27217}
218
Jacob Dufaultffd9b0d2017-11-15 23:07:16219void LoginScreenController::CancelAddUser() {
Evan Stade2e4c22e2019-06-07 02:13:55220 if (!client_)
Wenzhao Zang16e7ea722017-09-16 01:27:30221 return;
Evan Stade2e4c22e2019-06-07 02:13:55222 client_->CancelAddUser();
Wenzhao Zang16e7ea722017-09-16 01:27:30223}
224
Aga Wronska6a32f9872018-01-06 00:16:10225void LoginScreenController::LoginAsGuest() {
Evan Stade2e4c22e2019-06-07 02:13:55226 if (!client_)
Aga Wronska6a32f9872018-01-06 00:16:10227 return;
Evan Stade2e4c22e2019-06-07 02:13:55228 client_->LoginAsGuest();
Aga Wronska6a32f9872018-01-06 00:16:10229}
230
Jacob Dufaultffd9b0d2017-11-15 23:07:16231void LoginScreenController::OnMaxIncorrectPasswordAttempted(
xiaoyinhf534c4f2017-06-13 20:50:27232 const AccountId& account_id) {
Evan Stade2e4c22e2019-06-07 02:13:55233 if (!client_)
xiaoyinhf534c4f2017-06-13 20:50:27234 return;
Evan Stade2e4c22e2019-06-07 02:13:55235 client_->OnMaxIncorrectPasswordAttempted(account_id);
xiaoyinhf534c4f2017-06-13 20:50:27236}
237
Jacob Dufaultffd9b0d2017-11-15 23:07:16238void LoginScreenController::FocusLockScreenApps(bool reverse) {
Evan Stade2e4c22e2019-06-07 02:13:55239 if (!client_)
Toni Barzicf61c4452017-10-05 03:57:48240 return;
Evan Stade2e4c22e2019-06-07 02:13:55241 client_->FocusLockScreenApps(reverse);
Toni Barzicf61c4452017-10-05 03:57:48242}
243
Evan Stade2e4c22e2019-06-07 02:13:55244void LoginScreenController::ShowGaiaSignin(bool can_close,
245 const AccountId& prefilled_account) {
246 if (!client_)
Sarah Hu9fba0e752018-02-07 01:41:09247 return;
Evan Stade2e4c22e2019-06-07 02:13:55248 client_->ShowGaiaSignin(can_close, prefilled_account);
Sarah Hu9fba0e752018-02-07 01:41:09249}
250
Jacob Dufaultfc31c742018-03-20 17:32:19251void LoginScreenController::OnRemoveUserWarningShown() {
Evan Stade2e4c22e2019-06-07 02:13:55252 if (!client_)
Jacob Dufaultfc31c742018-03-20 17:32:19253 return;
Evan Stade2e4c22e2019-06-07 02:13:55254 client_->OnRemoveUserWarningShown();
Jacob Dufaultfc31c742018-03-20 17:32:19255}
256
257void LoginScreenController::RemoveUser(const AccountId& account_id) {
Evan Stade2e4c22e2019-06-07 02:13:55258 if (!client_)
Jacob Dufaultfc31c742018-03-20 17:32:19259 return;
Evan Stade2e4c22e2019-06-07 02:13:55260 client_->RemoveUser(account_id);
Jacob Dufaultfc31c742018-03-20 17:32:19261}
262
Sarah Hu3fcf9f82018-03-22 20:32:54263void LoginScreenController::LaunchPublicSession(
264 const AccountId& account_id,
265 const std::string& locale,
266 const std::string& input_method) {
Evan Stade2e4c22e2019-06-07 02:13:55267 if (!client_)
Sarah Hu3fcf9f82018-03-22 20:32:54268 return;
Evan Stade2e4c22e2019-06-07 02:13:55269 client_->LaunchPublicSession(account_id, locale, input_method);
Sarah Hu3fcf9f82018-03-22 20:32:54270}
271
Sarah Huf9affb122018-04-27 21:36:36272void LoginScreenController::RequestPublicSessionKeyboardLayouts(
273 const AccountId& account_id,
274 const std::string& locale) {
Evan Stade2e4c22e2019-06-07 02:13:55275 if (!client_)
Sarah Huf9affb122018-04-27 21:36:36276 return;
Evan Stade2e4c22e2019-06-07 02:13:55277 client_->RequestPublicSessionKeyboardLayouts(account_id, locale);
Sarah Huf9affb122018-04-27 21:36:36278}
279
Sarah Hu0007c932018-06-18 20:21:04280void LoginScreenController::ShowFeedback() {
Evan Stade2e4c22e2019-06-07 02:13:55281 if (!client_)
Sarah Hu0007c932018-06-18 20:21:04282 return;
Evan Stade2e4c22e2019-06-07 02:13:55283 client_->ShowFeedback();
Sarah Hu0007c932018-06-18 20:21:04284}
285
Evan Stade2e4c22e2019-06-07 02:13:55286void LoginScreenController::SetClient(LoginScreenClient* client) {
287 client_ = client;
Toni Barzicf61c4452017-10-05 03:57:48288}
289
Evan Stadeb153f822019-05-23 19:14:43290LoginScreenModel* LoginScreenController::GetModel() {
Evan Stadeddde2b22019-05-24 20:51:31291 return &login_data_dispatcher_;
Evan Stadeb153f822019-05-23 19:14:43292}
293
Evan Stade9fe9cbe2019-06-03 23:05:55294void LoginScreenController::ShowKioskAppError(const std::string& message) {
295 ToastData toast_data(
296 "KioskAppError", base::UTF8ToUTF16(message), -1 /*duration_ms*/,
297 base::Optional<base::string16>(base::string16()) /*dismiss_text*/,
298 true /*visible_on_lock_screen*/);
299 Shell::Get()->toast_manager()->Show(toast_data);
300}
301
302void LoginScreenController::FocusLoginShelf(bool reverse) {
303 Shelf* shelf = Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow());
304 // Tell the focus direction to the status area or the shelf so they can focus
305 // the correct child view.
306 if (reverse || !ShelfWidget::IsUsingViewsShelf()) {
307 if (!Shell::GetPrimaryRootWindowController()->IsSystemTrayVisible())
308 return;
309 shelf->GetStatusAreaWidget()
310 ->status_area_widget_delegate()
311 ->set_default_last_focusable_child(reverse);
312 Shell::Get()->focus_cycler()->FocusWidget(shelf->GetStatusAreaWidget());
313 } else {
314 shelf->shelf_widget()->set_default_last_focusable_child(reverse);
315 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
316 }
317}
318
319bool LoginScreenController::IsReadyForPassword() {
320 return LockScreen::HasInstance() && !IsAuthenticating();
321}
322
323void LoginScreenController::EnableAddUserButton(bool enable) {
324 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
325 ->shelf_widget()
326 ->login_shelf_view()
327 ->SetAddUserButtonEnabled(enable);
328}
329
330void LoginScreenController::EnableShutdownButton(bool enable) {
331 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
332 ->shelf_widget()
333 ->login_shelf_view()
334 ->SetShutdownButtonEnabled(enable);
335}
336
Evan Stade98b718e2019-06-03 17:15:34337void LoginScreenController::ShowGuestButtonInOobe(bool show) {
338 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
339 ->shelf_widget()
340 ->login_shelf_view()
341 ->ShowGuestButtonInOobe(show);
342}
343
344void LoginScreenController::ShowParentAccessButton(bool show) {
345 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
346 ->shelf_widget()
347 ->login_shelf_view()
348 ->ShowParentAccessButton(show);
349}
350
Henrique Grandinetti4eb2eae2019-05-31 16:31:17351void LoginScreenController::ShowParentAccessWidget(
352 const AccountId& child_account_id,
Henrique Grandinetti98b31502019-06-11 18:06:09353 base::RepeatingCallback<void(bool success)> callback,
354 ParentAccessRequestReason reason) {
355 parent_access_widget_ = std::make_unique<ash::ParentAccessWidget>(
356 child_account_id, callback, reason);
Henrique Grandinetti4eb2eae2019-05-31 16:31:17357}
358
Evan Stade9fe9cbe2019-06-03 23:05:55359void LoginScreenController::SetAllowLoginAsGuest(bool allow_guest) {
360 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
361 ->shelf_widget()
362 ->login_shelf_view()
363 ->SetAllowLoginAsGuest(allow_guest);
364}
365
Evan Stade2e4c22e2019-06-07 02:13:55366void LoginScreenController::ShowLockScreen() {
Jacob Dufault589d9942018-03-27 20:28:47367 OnShow();
Evan Stade98b718e2019-06-03 17:15:34368 LockScreen::Show(LockScreen::ScreenType::kLock);
Jacob Dufault589d9942018-03-27 20:28:47369}
370
Evan Stade2e4c22e2019-06-07 02:13:55371void LoginScreenController::ShowLoginScreen() {
Jacob Dufault589d9942018-03-27 20:28:47372 // Login screen can only be used during login.
Evan Stade2e4c22e2019-06-07 02:13:55373 CHECK_EQ(session_manager::SessionState::LOGIN_PRIMARY,
374 Shell::Get()->session_controller()->GetSessionState())
375 << "Not showing login screen since session state is "
376 << static_cast<int>(
377 Shell::Get()->session_controller()->GetSessionState());
Jacob Dufault589d9942018-03-27 20:28:47378
379 OnShow();
Evan Stade98b718e2019-06-03 17:15:34380 // TODO(jdufault): rename LockScreen to LoginScreen.
381 LockScreen::Show(LockScreen::ScreenType::kLogin);
Jacob Dufault589d9942018-03-27 20:28:47382}
383
Evan Stade9c07ab42019-05-13 21:21:56384void LoginScreenController::SetKioskApps(
385 const std::vector<KioskAppMenuEntry>& kiosk_apps,
386 const base::RepeatingCallback<void(const KioskAppMenuEntry&)>& launch_app) {
387 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
388 ->shelf_widget()
389 ->login_shelf_view()
390 ->SetKioskApps(kiosk_apps, launch_app);
391}
392
Quan Nguyene3e1d252018-07-19 23:00:44393void LoginScreenController::ShowResetScreen() {
Evan Stade2e4c22e2019-06-07 02:13:55394 client_->ShowResetScreen();
Quan Nguyene3e1d252018-07-19 23:00:44395}
396
Quan Nguyenff20e232018-08-02 21:34:11397void LoginScreenController::ShowAccountAccessHelpApp() {
Evan Stade2e4c22e2019-06-07 02:13:55398 client_->ShowAccountAccessHelpApp();
Quan Nguyenff20e232018-08-02 21:34:11399}
400
Evan Stade3c971bc2019-06-11 22:12:44401void LoginScreenController::ShowLockScreenNotificationSettings() {
402 client_->ShowLockScreenNotificationSettings();
403}
404
Quan Nguyen3d7a0f02018-09-04 23:53:55405void LoginScreenController::FocusOobeDialog() {
Evan Stade2e4c22e2019-06-07 02:13:55406 if (!client_)
Tony de Luna46801932019-03-11 18:02:01407 return;
Evan Stade2e4c22e2019-06-07 02:13:55408 client_->FocusOobeDialog();
Quan Nguyen3d7a0f02018-09-04 23:53:55409}
410
Quan Nguyene377eb62019-02-11 23:02:25411void LoginScreenController::NotifyUserActivity() {
Evan Stade2e4c22e2019-06-07 02:13:55412 if (!client_)
Xiyuan Xia5a8c4172019-05-13 16:23:48413 return;
Evan Stade2e4c22e2019-06-07 02:13:55414 client_->OnUserActivity();
Quan Nguyene377eb62019-02-11 23:02:25415}
416
Jacob Dufaultb7a2d842017-12-01 23:21:15417void LoginScreenController::OnAuthenticateComplete(
418 OnAuthenticateCallback callback,
419 bool success) {
Jacob Dufault8876ba82018-03-27 22:55:43420 authentication_stage_ = AuthenticationStage::kUserCallback;
Quan Nguyen92f924a2018-10-18 18:36:46421 std::move(callback).Run(base::make_optional<bool>(success));
Jacob Dufault8876ba82018-03-27 22:55:43422 authentication_stage_ = AuthenticationStage::kIdle;
xiaoyinh2bbdd102017-05-18 23:29:42423}
424
Jacob Dufaultcbc1ee02018-02-28 18:38:54425void LoginScreenController::OnShow() {
426 SetSystemTrayVisibility(SystemTrayVisibility::kPrimary);
Jacob Dufaultc06d6ca2018-04-24 23:49:17427 if (authentication_stage_ != AuthenticationStage::kIdle) {
428 AuthenticationStage authentication_stage = authentication_stage_;
429 base::debug::Alias(&authentication_stage);
430 LOG(FATAL) << "Unexpected authentication stage "
431 << static_cast<int>(authentication_stage_);
432 }
Jacob Dufaultcbc1ee02018-02-28 18:38:54433}
434
Jun Mukai5c7b5b42018-11-30 00:08:50435void LoginScreenController::OnFocusLeavingSystemTray(bool reverse) {
Evan Stade2e4c22e2019-06-07 02:13:55436 if (!client_)
Jun Mukai5c7b5b42018-11-30 00:08:50437 return;
Evan Stade2e4c22e2019-06-07 02:13:55438 client_->OnFocusLeavingSystemTray(reverse);
Jun Mukai5c7b5b42018-11-30 00:08:50439}
440
xiaoyinh2bbdd102017-05-18 23:29:42441} // namespace ash