[go: nahoru, domu]

Wire up chall-resp PIN requests with Lock Screen

Forward the security token PIN request to Ash when the Chrome OS Lock
Screen is on. This builds the missing connection between the
PinDialogManager (called by an extension) and the Lock Screen UI,
allowing to implement the PIN dialog UI on the Lock Screen.

Before this CL, the default popup-dialog-based UI would be used even
when on the Lock Screen, which wouldn't technically be visible and also
doesn't correspond to the UI Mocks.

The actual UI will be implemented in follow-up CLs.

Bug: 983103
Change-Id: If46a951bb871930fbda5d4d768928b7b3c49c852
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730164
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685577}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index eda11a8..38f7714a 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -24,6 +24,7 @@
 #include "ash/system/toast/toast_manager_impl.h"
 #include "ash/system/tray/system_tray_notifier.h"
 #include "base/bind.h"
+#include "base/callback.h"
 #include "base/debug/alias.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
@@ -391,6 +392,26 @@
       ->GetScopedGuestButtonBlocker();
 }
 
+void LoginScreenController::RequestSecurityTokenPin(
+    SecurityTokenPinRequest request) {
+  if (!LockScreen::HasInstance()) {
+    // Corner case: the PIN request is made at inappropriate time, racing with
+    // the lock screen showing/hiding.
+    std::move(request.pin_ui_closed_callback).Run();
+    return;
+  }
+  LockScreen::Get()->RequestSecurityTokenPin(std::move(request));
+}
+
+void LoginScreenController::ClearSecurityTokenPinRequest() {
+  if (!LockScreen::HasInstance()) {
+    // Corner case: the request is made at inappropriate time, racing with the
+    // lock screen showing/hiding.
+    return;
+  }
+  LockScreen::Get()->ClearSecurityTokenPinRequest();
+}
+
 void LoginScreenController::ShowLockScreen() {
   OnShow();
   LockScreen::Show(LockScreen::ScreenType::kLock);