Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2022)

Unified Diff: chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js

Issue 917633002: Block esc, back button and cancel button until gaia is loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
index 572b104764b0bbd589f875d6cd09df49d892fa31..595f4b46326b954d61275007926a49bf8cc8559d 100644
--- a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
+++ b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
@@ -43,6 +43,27 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
*/
learnMoreHelpTopicID_: null,
+ /**
+ * We block esc, back button and cancel button until gaia is loaded to
+ * prevent multiple cancel events.
+ */
+ isCancelDisabled_: null,
+
+ get isCancelDisabled() { return this.isCancelDisabled_ },
+ set isCancelDisabled(disabled) {
+ if (disabled == this.isCancelDisabled)
+ return;
+ this.isCancelDisabled_ = disabled;
+
+ $('oauth-enroll-back-button').disabled = disabled;
+ $('oauth-enroll-back-button').
+ classList.toggle('preserve-disabled-state', disabled);
+
+ $('oauth-enroll-cancel-button').disabled = disabled;
+ $('oauth-enroll-cancel-button').
+ classList.toggle('preserve-disabled-state', disabled);
+ },
+
/** @override */
decorate: function() {
window.addEventListener('message',
@@ -106,13 +127,9 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
['oauth-enroll-focus-on-error'],
loadTimeData.getString('oauthEnrollBack'),
function() {
- $('oauth-enroll-back-button').disabled = true;
-
- $('oauth-enroll-back-button').
- classList.add('preserve-disabled-state');
-
+ this.isCancelDisabled = true;
chrome.send('oauthEnrollClose', ['cancel']);
- });
+ }.bind(this));
makeButton(
'oauth-enroll-retry-button',
@@ -147,6 +164,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
data.enrollment_mode == modes[i]);
}
this.managementDomain_ = data.management_domain;
+ this.isCancelDisabled = true;
this.doReload();
this.learnMoreHelpTopicID_ = data.learn_more_help_topic_id;
this.updateLocalizedContent();
@@ -157,6 +175,9 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
* Cancels enrollment and drops the user back to the login screen.
*/
cancel: function() {
+ if (this.isCancelDisabled)
+ return;
+ this.isCancelDisabled = true;
chrome.send('oauthEnrollClose', ['cancel']);
},
@@ -253,11 +274,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
}
if (msg.method == 'loginUILoaded' && this.currentStep_ == STEP_SIGNIN) {
- $('oauth-enroll-back-button').disabled = false;
-
- $('oauth-enroll-back-button').
- classList.remove('preserve-disabled-state');
-
+ this.isCancelDisabled = false;
chrome.send('frameLoadingCompleted', [0]);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698