Commit a77510ea authored by jdufault's avatar jdufault Committed by Commit bot

cros: HTML fixes needed to reinitializing an existing lock WebUI.

See https://codereview.chromium.org/2512473004/ for additional context.

BUG=669638
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2555453003
Cr-Commit-Position: refs/heads/master@{#437964}
parent b9b243bd
......@@ -269,6 +269,13 @@ bool UserSelectionScreen::ShouldForceOnlineSignIn(
void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) {
handler_ = handler;
if (handler_) {
// Forcibly refresh all of the user images, as the |handler_| instance may
// have been reused.
for (user_manager::User* user : users_)
handler_->OnUserImageChanged(*user);
}
}
void UserSelectionScreen::SetView(UserBoardView* view) {
......
......@@ -23,6 +23,10 @@ class OobeUI;
// Class that manages control flow between wizard screens. Wizard controller
// interacts with screen controllers to move the user between screens.
//
// This class is allocated when the signin or lock screen is actually visible to
// the user. It is a 'per-session' class; SignInScreenHandler, in comparsion, is
// tied to the WebContents lifetime and therefore may live beyond this class.
class SignInScreenController : public user_manager::RemoveUserDelegate,
public content::NotificationObserver {
public:
......
......@@ -66,6 +66,39 @@ cr.define('cr.ui.Oobe', function() {
chrome.send('screenStateInitialize');
},
/**
* Notification from the host that the PIN keyboard will be used in the
* lock session so it should also get preloaded.
*/
preloadPinKeyboard: function() {
showPinKeyboardAsync();
},
/**
* Called when a preloaded webview (this) instance is being reused to
* display a new lock screen session. This will also be called when a
* lock screen has been preloaded and is being displayed for the first
* time.
*/
reload: function() {
// Sending accountPickerReady displays the webui. Wait for the next
// animation frame so the user does not see any state from the previous
// instance.
requestAnimationFrame(function() {
chrome.send('accountPickerReady');
});
},
/**
* Called when the lock screen has been dismissed but this webview will stay
* in memory. The webview will be reused when Oobe.reload() is called.
*/
teardown: function() {
// The PIN keyboard will disable the virtual keyboard. Make sure to
// revert the force disable when hiding the lock screen.
chrome.send('setForceDisableVirtualKeyboard', [false]);
},
// Dummy Oobe functions not present with stripped login UI.
initializeA11yMenu: function(e) {},
handleAccessibilityLinkClick: function(e) {},
......
......@@ -894,6 +894,21 @@ void SigninScreenHandler::ReloadGaia(bool force_reload) {
}
void SigninScreenHandler::Initialize() {
// Preload PIN keyboard if any of the users can authenticate via PIN.
if (user_manager::UserManager::IsInitialized()) {
for (user_manager::User* user :
user_manager::UserManager::Get()->GetLoggedInUsers()) {
chromeos::PinStorage* pin_storage =
chromeos::PinStorageFactory::GetForUser(user);
if (pin_storage && pin_storage->IsPinAuthenticationAvailable()) {
CallJS("cr.ui.Oobe.preloadPinKeyboard");
break;
}
}
}
// |delegate_| is null when we are preloading the lock screen.
if (delegate_ && show_on_init_) {
show_on_init_ = false;
ShowImpl();
......
......@@ -266,6 +266,14 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
* @param {array} users Array of user instances.
*/
initializePinKeyboardStateForUsers_: function(users) {
// It is possible that the PIN keyboard HTML has already been loaded. If
// that is the case, we want to show the user pods with the PIN keyboard
// immediately without running the PIN show/hide effect.
document.body.classList.add('disable-pin-animation');
setTimeout(function() {
document.body.classList.remove('disable-pin-animation');
});
for (var i = 0; i < users.length; ++i) {
var user = users[i];
if (user.showPin) {
......
......@@ -54,6 +54,10 @@ pin-keyboard {
top: -87px !important;
}
.disable-pin-animation .pod.pin-enabled {
transition: none;
}
.pod .pin-container {
height: 204px;
position: absolute;
......
......@@ -34,6 +34,10 @@
checked to determine if loaded. */
}
.disable-pin-animation .pin-container {
transition: none;
}
#scroll-container {
bottom: 0; /* Allows content overlap with control bar. */
left: 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment