[go: nahoru, domu]

blob: 48eb189c3225cae17fda6860ffd008c892f5fa98 [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"
Aga Wronska16abb432018-01-11 23:49:5914#include "ash/root_window_controller.h"
Xiyuan Xiae7b19542019-05-06 23:05:1815#include "ash/session/session_controller_impl.h"
Jacob Dufault5ac266ef2018-07-18 17:30:3016#include "ash/shelf/login_shelf_view.h"
Quan Nguyend09dd112018-06-19 19:20:3217#include "ash/shelf/shelf.h"
18#include "ash/shelf/shelf_widget.h"
Sarah Hu069eea12017-09-08 01:28:4019#include "ash/shell.h"
Aga Wronska16abb432018-01-11 23:49:5920#include "ash/system/status_area_widget.h"
Quan Nguyen3d7a0f02018-09-04 23:53:5521#include "ash/system/status_area_widget_delegate.h"
Quan Nguyenb7c2ea22018-09-10 17:44:1822#include "ash/system/toast/toast_data.h"
23#include "ash/system/toast/toast_manager.h"
Jun Mukai5c7b5b42018-11-30 00:08:5024#include "ash/system/tray/system_tray_notifier.h"
Quan Nguyen92f924a2018-10-18 18:36:4625#include "base/bind.h"
Jacob Dufaultc06d6ca2018-04-24 23:49:1726#include "base/debug/alias.h"
Sarah Hu069eea12017-09-08 01:28:4027#include "base/strings/string_number_conversions.h"
Jialiu Linf99b788b2018-01-17 23:01:2128#include "base/strings/utf_string_conversions.h"
Sarah Hu069eea12017-09-08 01:28:4029#include "components/prefs/pref_registry_simple.h"
Jacob Dufault957e0922017-12-06 19:16:0930#include "components/session_manager/session_manager_types.h"
xiaoyinh2bbdd102017-05-18 23:29:4231
32namespace ash {
33
Sarah Hu069eea12017-09-08 01:28:4034namespace {
xiaoyinh2bbdd102017-05-18 23:29:4235
Aga Wronskaa844cdcd12018-01-29 16:06:4436enum class SystemTrayVisibility {
37 kNone, // Tray not visible anywhere.
38 kPrimary, // Tray visible only on primary display.
39 kAll, // Tray visible on all displays.
40};
41
42void SetSystemTrayVisibility(SystemTrayVisibility visibility) {
43 RootWindowController* primary_window_controller =
44 Shell::GetPrimaryRootWindowController();
45 for (RootWindowController* window_controller :
46 Shell::GetAllRootWindowControllers()) {
47 StatusAreaWidget* status_area = window_controller->GetStatusAreaWidget();
48 if (!status_area)
49 continue;
50 if (window_controller == primary_window_controller) {
51 status_area->SetSystemTrayVisibility(
52 visibility == SystemTrayVisibility::kPrimary ||
53 visibility == SystemTrayVisibility::kAll);
54 } else {
55 status_area->SetSystemTrayVisibility(visibility ==
56 SystemTrayVisibility::kAll);
57 }
58 }
Aga Wronska16abb432018-01-11 23:49:5959}
60
Sarah Hu069eea12017-09-08 01:28:4061} // namespace
62
Jun Mukai5c7b5b42018-11-30 00:08:5063LoginScreenController::LoginScreenController(
64 SystemTrayNotifier* system_tray_notifier)
65 : system_tray_notifier_(system_tray_notifier), weak_factory_(this) {
66 system_tray_notifier_->AddSystemTrayFocusObserver(this);
67}
James Cook8f1e6062017-11-13 23:40:5968
Jun Mukai5c7b5b42018-11-30 00:08:5069LoginScreenController::~LoginScreenController() {
70 system_tray_notifier_->RemoveSystemTrayFocusObserver(this);
71}
xiaoyinh2bbdd102017-05-18 23:29:4272
Sarah Hu069eea12017-09-08 01:28:4073// static
Jacob Dufaultffd9b0d2017-11-15 23:07:1674void LoginScreenController::RegisterProfilePrefs(PrefRegistrySimple* registry,
75 bool for_test) {
Sarah Hu069eea12017-09-08 01:28:4076 if (for_test) {
77 // There is no remote pref service, so pretend that ash owns the pref.
78 registry->RegisterStringPref(prefs::kQuickUnlockPinSalt, "");
79 return;
80 }
Sarah Hu069eea12017-09-08 01:28:4081}
82
Jacob Dufaultffd9b0d2017-11-15 23:07:1683void LoginScreenController::BindRequest(mojom::LoginScreenRequest request) {
James Cookede316a2017-12-14 22:38:4384 bindings_.AddBinding(this, std::move(request));
xiaoyinh2bbdd102017-05-18 23:29:4285}
86
Jacob Dufault2ca8c502018-06-25 19:12:1487bool LoginScreenController::IsAuthenticating() const {
88 return authentication_stage_ != AuthenticationStage::kIdle;
89}
90
Jacob Dufault2d20ae62018-09-20 22:19:5291void LoginScreenController::AuthenticateUserWithPasswordOrPin(
92 const AccountId& account_id,
93 const std::string& password,
94 bool authenticated_by_pin,
95 OnAuthenticateCallback callback) {
Jacob Dufault8876ba82018-03-27 22:55:4396 // It is an error to call this function while an authentication is in
97 // progress.
Jacob Dufault2d20ae62018-09-20 22:19:5298 LOG_IF(FATAL, IsAuthenticating())
Jacob Dufault58a1bf42018-07-10 17:44:5699 << "Duplicate authentication attempt; current authentication stage is "
100 << static_cast<int>(authentication_stage_);
Jacob Dufault8876ba82018-03-27 22:55:43101
102 if (!login_screen_client_) {
Jacob Dufaultb7a2d842017-12-01 23:21:15103 std::move(callback).Run(base::nullopt);
xiaoyinh9f6fa0e2017-06-07 19:22:32104 return;
Jacob Dufaultb7a2d842017-12-01 23:21:15105 }
xiaoyinh9f6fa0e2017-06-07 19:22:32106
Jacob Dufaulteafc6fe2017-10-11 21:16:52107 // If auth is disabled by the debug overlay bypass the mojo call entirely, as
108 // it will dismiss the lock screen if the password is correct.
Jacob Dufault0fbed9c02017-11-14 19:22:24109 switch (force_fail_auth_for_debug_overlay_) {
110 case ForceFailAuth::kOff:
111 break;
112 case ForceFailAuth::kImmediate:
Jacob Dufaultb7a2d842017-12-01 23:21:15113 OnAuthenticateComplete(std::move(callback), false /*success*/);
Jacob Dufault0fbed9c02017-11-14 19:22:24114 return;
115 case ForceFailAuth::kDelayed:
Jacob Dufault2ca8c502018-06-25 19:12:14116 // Set a dummy authentication stage so that |IsAuthenticating| returns
117 // true.
118 authentication_stage_ = AuthenticationStage::kDoAuthenticate;
Jacob Dufault0fbed9c02017-11-14 19:22:24119 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
Jacob Dufaultb7a2d842017-12-01 23:21:15120 FROM_HERE,
121 base::BindOnce(&LoginScreenController::OnAuthenticateComplete,
122 weak_factory_.GetWeakPtr(), base::Passed(&callback),
123 false),
Jacob Dufault0fbed9c02017-11-14 19:22:24124 base::TimeDelta::FromSeconds(1));
125 return;
Jacob Dufaulteafc6fe2017-10-11 21:16:52126 }
127
Quan Nguyenf5224352018-11-06 02:03:34128 authentication_stage_ = AuthenticationStage::kDoAuthenticate;
129
130 int dummy_value;
131 bool is_pin =
132 authenticated_by_pin && base::StringToInt(password, &dummy_value);
133 login_screen_client_->AuthenticateUserWithPasswordOrPin(
134 account_id, password, is_pin,
135 base::BindOnce(&LoginScreenController::OnAuthenticateComplete,
136 weak_factory_.GetWeakPtr(), base::Passed(&callback)));
xiaoyinh9f6fa0e2017-06-07 19:22:32137}
138
Jacob Dufault2d20ae62018-09-20 22:19:52139void LoginScreenController::AuthenticateUserWithExternalBinary(
140 const AccountId& account_id,
141 OnAuthenticateCallback callback) {
142 // It is an error to call this function while an authentication is in
143 // progress.
144 LOG_IF(FATAL, IsAuthenticating())
145 << "Duplicate authentication attempt; current authentication stage is "
146 << static_cast<int>(authentication_stage_);
147
148 if (!login_screen_client_) {
149 std::move(callback).Run(base::nullopt);
150 return;
151 }
152
153 authentication_stage_ = AuthenticationStage::kDoAuthenticate;
154 login_screen_client_->AuthenticateUserWithExternalBinary(
155 account_id,
156 base::BindOnce(&LoginScreenController::OnAuthenticateComplete,
157 weak_factory_.GetWeakPtr(), std::move(callback)));
158}
159
Quan Nguyen92f924a2018-10-18 18:36:46160void LoginScreenController::EnrollUserWithExternalBinary(
161 OnAuthenticateCallback callback) {
162 if (!login_screen_client_) {
163 std::move(callback).Run(base::nullopt);
164 return;
165 }
166
167 login_screen_client_->EnrollUserWithExternalBinary(base::BindOnce(
168 [](OnAuthenticateCallback callback, bool success) {
169 std::move(callback).Run(base::make_optional<bool>(success));
170 },
171 std::move(callback)));
172}
173
Jacob Dufault2d20ae62018-09-20 22:19:52174void LoginScreenController::AuthenticateUserWithEasyUnlock(
175 const AccountId& account_id) {
176 // TODO(jdufault): integrate this into authenticate stage after mojom is
177 // refactored to use a callback.
Jacob Dufaultffd9b0d2017-11-15 23:07:16178 if (!login_screen_client_)
xiaoyinh9f6fa0e2017-06-07 19:22:32179 return;
Jacob Dufault2d20ae62018-09-20 22:19:52180 login_screen_client_->AuthenticateUserWithEasyUnlock(account_id);
xiaoyinh9f6fa0e2017-06-07 19:22:32181}
182
Aga Wronskaac6cf362019-02-26 21:36:55183void LoginScreenController::ValidateParentAccessCode(
Henrique Grandinetti4eb2eae2019-05-31 16:31:17184 const AccountId& account_id,
Aga Wronskaac6cf362019-02-26 21:36:55185 const std::string& code,
186 OnParentAccessValidation callback) {
187 if (!login_screen_client_) {
188 std::move(callback).Run(base::nullopt);
189 return;
190 }
191
192 login_screen_client_->ValidateParentAccessCode(
193 account_id, code,
194 base::BindOnce(&LoginScreenController::OnParentAccessValidationComplete,
195 weak_factory_.GetWeakPtr(), std::move(callback)));
196}
197
Jacob Dufaultffd9b0d2017-11-15 23:07:16198void LoginScreenController::HardlockPod(const AccountId& account_id) {
199 if (!login_screen_client_)
xiaoyinh9f6fa0e2017-06-07 19:22:32200 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16201 login_screen_client_->HardlockPod(account_id);
xiaoyinh9f6fa0e2017-06-07 19:22:32202}
203
Jacob Dufaultffd9b0d2017-11-15 23:07:16204void LoginScreenController::OnFocusPod(const AccountId& account_id) {
205 if (!login_screen_client_)
xiaoyinhf534c4f2017-06-13 20:50:27206 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16207 login_screen_client_->OnFocusPod(account_id);
xiaoyinhf534c4f2017-06-13 20:50:27208}
209
Jacob Dufaultffd9b0d2017-11-15 23:07:16210void LoginScreenController::OnNoPodFocused() {
211 if (!login_screen_client_)
xiaoyinhf534c4f2017-06-13 20:50:27212 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16213 login_screen_client_->OnNoPodFocused();
xiaoyinhf534c4f2017-06-13 20:50:27214}
215
Jacob Dufaultffd9b0d2017-11-15 23:07:16216void LoginScreenController::LoadWallpaper(const AccountId& account_id) {
217 if (!login_screen_client_)
xiaoyinhf534c4f2017-06-13 20:50:27218 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16219 login_screen_client_->LoadWallpaper(account_id);
xiaoyinhf534c4f2017-06-13 20:50:27220}
221
Jacob Dufaultffd9b0d2017-11-15 23:07:16222void LoginScreenController::SignOutUser() {
223 if (!login_screen_client_)
xiaoyinhf534c4f2017-06-13 20:50:27224 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16225 login_screen_client_->SignOutUser();
xiaoyinhf534c4f2017-06-13 20:50:27226}
227
Jacob Dufaultffd9b0d2017-11-15 23:07:16228void LoginScreenController::CancelAddUser() {
229 if (!login_screen_client_)
Wenzhao Zang16e7ea722017-09-16 01:27:30230 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16231 login_screen_client_->CancelAddUser();
Wenzhao Zang16e7ea722017-09-16 01:27:30232}
233
Aga Wronska6a32f9872018-01-06 00:16:10234void LoginScreenController::LoginAsGuest() {
235 if (!login_screen_client_)
236 return;
237 login_screen_client_->LoginAsGuest();
238}
239
Jacob Dufaultffd9b0d2017-11-15 23:07:16240void LoginScreenController::OnMaxIncorrectPasswordAttempted(
xiaoyinhf534c4f2017-06-13 20:50:27241 const AccountId& account_id) {
Jacob Dufaultffd9b0d2017-11-15 23:07:16242 if (!login_screen_client_)
xiaoyinhf534c4f2017-06-13 20:50:27243 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16244 login_screen_client_->OnMaxIncorrectPasswordAttempted(account_id);
xiaoyinhf534c4f2017-06-13 20:50:27245}
246
Jacob Dufaultffd9b0d2017-11-15 23:07:16247void LoginScreenController::FocusLockScreenApps(bool reverse) {
248 if (!login_screen_client_)
Toni Barzicf61c4452017-10-05 03:57:48249 return;
Jacob Dufaultffd9b0d2017-11-15 23:07:16250 login_screen_client_->FocusLockScreenApps(reverse);
Toni Barzicf61c4452017-10-05 03:57:48251}
252
Wenzhao Zang767a9f32018-05-02 21:20:55253void LoginScreenController::ShowGaiaSignin(
Jacob Dufaultfb72607d2018-06-12 19:50:33254 bool can_close,
255 const base::Optional<AccountId>& prefilled_account) {
Sarah Hu9fba0e752018-02-07 01:41:09256 if (!login_screen_client_)
257 return;
Jacob Dufaultfb72607d2018-06-12 19:50:33258 login_screen_client_->ShowGaiaSignin(can_close, prefilled_account);
Sarah Hu9fba0e752018-02-07 01:41:09259}
260
Jacob Dufaultfc31c742018-03-20 17:32:19261void LoginScreenController::OnRemoveUserWarningShown() {
262 if (!login_screen_client_)
263 return;
264 login_screen_client_->OnRemoveUserWarningShown();
265}
266
267void LoginScreenController::RemoveUser(const AccountId& account_id) {
268 if (!login_screen_client_)
269 return;
270 login_screen_client_->RemoveUser(account_id);
271}
272
Sarah Hu3fcf9f82018-03-22 20:32:54273void LoginScreenController::LaunchPublicSession(
274 const AccountId& account_id,
275 const std::string& locale,
276 const std::string& input_method) {
277 if (!login_screen_client_)
278 return;
279 login_screen_client_->LaunchPublicSession(account_id, locale, input_method);
280}
281
Sarah Huf9affb122018-04-27 21:36:36282void LoginScreenController::RequestPublicSessionKeyboardLayouts(
283 const AccountId& account_id,
284 const std::string& locale) {
285 if (!login_screen_client_)
286 return;
287 login_screen_client_->RequestPublicSessionKeyboardLayouts(account_id, locale);
288}
289
Sarah Hu0007c932018-06-18 20:21:04290void LoginScreenController::ShowFeedback() {
291 if (!login_screen_client_)
292 return;
293 login_screen_client_->ShowFeedback();
294}
295
Jacob Dufaultffd9b0d2017-11-15 23:07:16296void LoginScreenController::FlushForTesting() {
297 login_screen_client_.FlushForTesting();
Toni Barzicf61c4452017-10-05 03:57:48298}
299
Evan Stadeb153f822019-05-23 19:14:43300LoginScreenModel* LoginScreenController::GetModel() {
Evan Stadeddde2b22019-05-24 20:51:31301 return &login_data_dispatcher_;
Evan Stadeb153f822019-05-23 19:14:43302}
303
Evan Stade98b718e2019-06-03 17:15:34304void LoginScreenController::ShowGuestButtonInOobe(bool show) {
305 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
306 ->shelf_widget()
307 ->login_shelf_view()
308 ->ShowGuestButtonInOobe(show);
309}
310
311void LoginScreenController::ShowParentAccessButton(bool show) {
312 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
313 ->shelf_widget()
314 ->login_shelf_view()
315 ->ShowParentAccessButton(show);
316}
317
Henrique Grandinetti4eb2eae2019-05-31 16:31:17318void LoginScreenController::ShowParentAccessWidget(
319 const AccountId& child_account_id,
320 base::RepeatingCallback<void(bool success)> callback) {
321 parent_access_widget_ =
322 std::make_unique<ash::ParentAccessWidget>(child_account_id, callback);
323}
324
Jacob Dufault589d9942018-03-27 20:28:47325void LoginScreenController::SetClient(mojom::LoginScreenClientPtr client) {
326 login_screen_client_ = std::move(client);
327}
328
329void LoginScreenController::ShowLockScreen(ShowLockScreenCallback on_shown) {
330 OnShow();
Evan Stade98b718e2019-06-03 17:15:34331 LockScreen::Show(LockScreen::ScreenType::kLock);
Jacob Dufault589d9942018-03-27 20:28:47332 std::move(on_shown).Run(true);
333}
334
335void LoginScreenController::ShowLoginScreen(ShowLoginScreenCallback on_shown) {
336 // Login screen can only be used during login.
337 if (Shell::Get()->session_controller()->GetSessionState() !=
338 session_manager::SessionState::LOGIN_PRIMARY) {
339 LOG(ERROR) << "Not showing login screen since session state is "
340 << static_cast<int>(
341 Shell::Get()->session_controller()->GetSessionState());
342 std::move(on_shown).Run(false);
343 return;
344 }
345
346 OnShow();
Evan Stade98b718e2019-06-03 17:15:34347 // TODO(jdufault): rename LockScreen to LoginScreen.
348 LockScreen::Show(LockScreen::ScreenType::kLogin);
Jacob Dufault589d9942018-03-27 20:28:47349 std::move(on_shown).Run(true);
350}
351
Jacob Dufault589d9942018-03-27 20:28:47352void LoginScreenController::IsReadyForPassword(
353 IsReadyForPasswordCallback callback) {
Jacob Dufault2ca8c502018-06-25 19:12:14354 std::move(callback).Run(LockScreen::HasInstance() && !IsAuthenticating());
Jacob Dufault589d9942018-03-27 20:28:47355}
356
Quan Nguyenb7c2ea22018-09-10 17:44:18357void LoginScreenController::ShowKioskAppError(const std::string& message) {
358 ToastData toast_data(
359 "KioskAppError", base::UTF8ToUTF16(message), -1 /*duration_ms*/,
360 base::Optional<base::string16>(base::string16()) /*dismiss_text*/,
361 true /*visible_on_lock_screen*/);
362 Shell::Get()->toast_manager()->Show(toast_data);
363}
364
Sarah Hu51d19d32018-08-27 19:41:50365void LoginScreenController::SetAllowLoginAsGuest(bool allow_guest) {
366 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
367 ->shelf_widget()
368 ->login_shelf_view()
369 ->SetAllowLoginAsGuest(allow_guest);
370}
371
Quan Nguyen3d7a0f02018-09-04 23:53:55372void LoginScreenController::FocusLoginShelf(bool reverse) {
373 Shelf* shelf = Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow());
374 // Tell the focus direction to the status area or the shelf so they can focus
375 // the correct child view.
Jun Mukai103f57b2018-11-15 01:03:01376 if (reverse || !ShelfWidget::IsUsingViewsShelf()) {
377 if (!Shell::GetPrimaryRootWindowController()->IsSystemTrayVisible())
Jun Mukaid96b4d7452018-11-09 00:37:23378 return;
Quan Nguyen3d7a0f02018-09-04 23:53:55379 shelf->GetStatusAreaWidget()
380 ->status_area_widget_delegate()
381 ->set_default_last_focusable_child(reverse);
382 Shell::Get()->focus_cycler()->FocusWidget(shelf->GetStatusAreaWidget());
383 } else {
384 shelf->shelf_widget()->set_default_last_focusable_child(reverse);
385 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
386 }
387}
388
Evan Stade9c07ab42019-05-13 21:21:56389void LoginScreenController::SetKioskApps(
390 const std::vector<KioskAppMenuEntry>& kiosk_apps,
391 const base::RepeatingCallback<void(const KioskAppMenuEntry&)>& launch_app) {
392 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
393 ->shelf_widget()
394 ->login_shelf_view()
395 ->SetKioskApps(kiosk_apps, launch_app);
396}
397
Sarah Hu4976046e2018-07-19 23:47:47398void LoginScreenController::SetAddUserButtonEnabled(bool enable) {
399 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
400 ->shelf_widget()
401 ->login_shelf_view()
402 ->SetAddUserButtonEnabled(enable);
403}
404
Bruno Santoscf9d9cc2018-12-14 13:18:45405void LoginScreenController::SetShutdownButtonEnabled(bool enable) {
406 Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
407 ->shelf_widget()
408 ->login_shelf_view()
409 ->SetShutdownButtonEnabled(enable);
410}
411
Quan Nguyene3e1d252018-07-19 23:00:44412void LoginScreenController::ShowResetScreen() {
413 login_screen_client_->ShowResetScreen();
414}
415
Quan Nguyenff20e232018-08-02 21:34:11416void LoginScreenController::ShowAccountAccessHelpApp() {
417 login_screen_client_->ShowAccountAccessHelpApp();
418}
419
Quan Nguyen3d7a0f02018-09-04 23:53:55420void LoginScreenController::FocusOobeDialog() {
Tony de Luna46801932019-03-11 18:02:01421 if (!login_screen_client_)
422 return;
Quan Nguyen3d7a0f02018-09-04 23:53:55423 login_screen_client_->FocusOobeDialog();
424}
425
Quan Nguyene377eb62019-02-11 23:02:25426void LoginScreenController::NotifyUserActivity() {
Xiyuan Xia5a8c4172019-05-13 16:23:48427 if (!login_screen_client_)
428 return;
Quan Nguyene377eb62019-02-11 23:02:25429 login_screen_client_->OnUserActivity();
430}
431
Jacob Dufaultb7a2d842017-12-01 23:21:15432void LoginScreenController::OnAuthenticateComplete(
433 OnAuthenticateCallback callback,
434 bool success) {
Jacob Dufault8876ba82018-03-27 22:55:43435 authentication_stage_ = AuthenticationStage::kUserCallback;
Quan Nguyen92f924a2018-10-18 18:36:46436 std::move(callback).Run(base::make_optional<bool>(success));
Jacob Dufault8876ba82018-03-27 22:55:43437 authentication_stage_ = AuthenticationStage::kIdle;
xiaoyinh2bbdd102017-05-18 23:29:42438}
439
Aga Wronskaac6cf362019-02-26 21:36:55440void LoginScreenController::OnParentAccessValidationComplete(
441 OnParentAccessValidation callback,
442 bool success) {
443 std::move(callback).Run(base::make_optional<bool>(success));
444}
445
Jacob Dufaultcbc1ee02018-02-28 18:38:54446void LoginScreenController::OnShow() {
447 SetSystemTrayVisibility(SystemTrayVisibility::kPrimary);
Jacob Dufaultc06d6ca2018-04-24 23:49:17448 if (authentication_stage_ != AuthenticationStage::kIdle) {
449 AuthenticationStage authentication_stage = authentication_stage_;
450 base::debug::Alias(&authentication_stage);
451 LOG(FATAL) << "Unexpected authentication stage "
452 << static_cast<int>(authentication_stage_);
453 }
Jacob Dufaultcbc1ee02018-02-28 18:38:54454}
455
Jun Mukai5c7b5b42018-11-30 00:08:50456void LoginScreenController::OnFocusLeavingSystemTray(bool reverse) {
457 if (!login_screen_client_)
458 return;
459 login_screen_client_->OnFocusLeavingSystemTray(reverse);
460}
461
xiaoyinh2bbdd102017-05-18 23:29:42462} // namespace ash