Commit 6672ddbe authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Reset screen does not show itself automatically

Previously when ResetScreen was allocated it'd force set itself
as the active screen. This is the only screen that does this and
it does not play well with pre-allocating screen instances ahead of
time.

Bug: None
Change-Id: Ie70a0e64dd1f6891935fd0f6d39c99ab1d4999d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1560437
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649655}
parent f19f41ec
...@@ -109,12 +109,6 @@ login.createScreen('ResetScreen', 'reset', function() { ...@@ -109,12 +109,6 @@ login.createScreen('ResetScreen', 'reset', function() {
setScreenState: function(state) { setScreenState: function(state) {
this.screenState_ = state; this.screenState_ = state;
if (Oobe.getInstance().currentScreen != this) {
setTimeout(function() {
Oobe.resetSigninUI(false);
Oobe.showScreen({id: SCREEN_OOBE_RESET});
}, 0);
}
if (state == RESET_SCREEN_STATE.RESTART_REQUIRED) if (state == RESET_SCREEN_STATE.RESTART_REQUIRED)
this.ui_state = RESET_SCREEN_UI_STATE.RESTART_REQUIRED; this.ui_state = RESET_SCREEN_UI_STATE.RESTART_REQUIRED;
if (state == RESET_SCREEN_STATE.REVERT_PROMISE) if (state == RESET_SCREEN_STATE.REVERT_PROMISE)
...@@ -160,6 +154,11 @@ login.createScreen('ResetScreen', 'reset', function() { ...@@ -160,6 +154,11 @@ login.createScreen('ResetScreen', 'reset', function() {
*/ */
onBeforeShow: function(data) {}, onBeforeShow: function(data) {},
/** Event handler that is invoked after the screen is shown. */
onAfterShow: function() {
Oobe.resetSigninUI(false);
},
/** /**
* Sets css style for corresponding state of the screen. * Sets css style for corresponding state of the screen.
* @private * @private
......
...@@ -576,9 +576,6 @@ cr.define('cr.ui.login', function() { ...@@ -576,9 +576,6 @@ cr.define('cr.ui.login', function() {
// Adjust inner container height based on new step's height. // Adjust inner container height based on new step's height.
this.updateScreenSize(newStep); this.updateScreenSize(newStep);
if (newStep.onAfterShow)
newStep.onAfterShow(screenData);
// Default control to be focused (if specified). // Default control to be focused (if specified).
var defaultControl = newStep.defaultControl; var defaultControl = newStep.defaultControl;
...@@ -634,6 +631,11 @@ cr.define('cr.ui.login', function() { ...@@ -634,6 +631,11 @@ cr.define('cr.ui.login', function() {
} }
this.currentStep_ = nextStepIndex; this.currentStep_ = nextStepIndex;
// Call onAfterShow after currentStep_ so that the step can have a
// post-set hook.
if (newStep.onAfterShow)
newStep.onAfterShow(screenData);
var stepLogo = $('step-logo'); var stepLogo = $('step-logo');
if (stepLogo) { if (stepLogo) {
stepLogo.hidden = newStep.classList.contains('no-logo'); stepLogo.hidden = newStep.classList.contains('no-logo');
...@@ -1114,9 +1116,10 @@ cr.define('cr.ui.login', function() { ...@@ -1114,9 +1116,10 @@ cr.define('cr.ui.login', function() {
DisplayManager.resetSigninUI = function(forceOnline) { DisplayManager.resetSigninUI = function(forceOnline) {
var currentScreenId = Oobe.getInstance().currentScreen.id; var currentScreenId = Oobe.getInstance().currentScreen.id;
if ($(SCREEN_GAIA_SIGNIN)) if ($(SCREEN_GAIA_SIGNIN)) {
$(SCREEN_GAIA_SIGNIN) $(SCREEN_GAIA_SIGNIN)
.reset(currentScreenId == SCREEN_GAIA_SIGNIN, forceOnline); .reset(currentScreenId == SCREEN_GAIA_SIGNIN, forceOnline);
}
$('pod-row').reset(currentScreenId == SCREEN_ACCOUNT_PICKER); $('pod-row').reset(currentScreenId == SCREEN_ACCOUNT_PICKER);
}; };
......
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