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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_gaia_signin.js

Issue 1029053002: Back button for the WebView-based sign-in flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Oobe signin screen implementation. 6 * @fileoverview Oobe signin screen implementation.
7 */ 7 */
8 8
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
10 // Gaia loading time after which error message must be displayed and 10 // Gaia loading time after which error message must be displayed and
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost(webview); 112 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost(webview);
113 } else { 113 } else {
114 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); 114 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame'));
115 } 115 }
116 this.gaiaAuthHost_.addEventListener( 116 this.gaiaAuthHost_.addEventListener(
117 'ready', this.onAuthReady_.bind(this)); 117 'ready', this.onAuthReady_.bind(this));
118 this.gaiaAuthHost_.addEventListener( 118 this.gaiaAuthHost_.addEventListener(
119 'dialogShown', this.onDialogShown_.bind(this)); 119 'dialogShown', this.onDialogShown_.bind(this));
120 this.gaiaAuthHost_.addEventListener( 120 this.gaiaAuthHost_.addEventListener(
121 'dialogHidden', this.onDialogHidden_.bind(this)); 121 'dialogHidden', this.onDialogHidden_.bind(this));
122 this.gaiaAuthHost_.addEventListener(
123 'backButton', this.onBackButton_.bind(this));
122 this.gaiaAuthHost_.confirmPasswordCallback = 124 this.gaiaAuthHost_.confirmPasswordCallback =
123 this.onAuthConfirmPassword_.bind(this); 125 this.onAuthConfirmPassword_.bind(this);
124 this.gaiaAuthHost_.noPasswordCallback = 126 this.gaiaAuthHost_.noPasswordCallback =
125 this.onAuthNoPassword_.bind(this); 127 this.onAuthNoPassword_.bind(this);
126 this.gaiaAuthHost_.insecureContentBlockedCallback = 128 this.gaiaAuthHost_.insecureContentBlockedCallback =
127 this.onInsecureContentBlocked_.bind(this); 129 this.onInsecureContentBlocked_.bind(this);
128 this.gaiaAuthHost_.missingGaiaInfoCallback = 130 this.gaiaAuthHost_.missingGaiaInfoCallback =
129 this.missingGaiaInfo_.bind(this); 131 this.missingGaiaInfo_.bind(this);
130 this.gaiaAuthHost_.samlApiUsedCallback = 132 this.gaiaAuthHost_.samlApiUsedCallback =
131 this.samlApiUsed_.bind(this); 133 this.samlApiUsed_.bind(this);
132 this.gaiaAuthHost_.addEventListener('authFlowChange', 134 this.gaiaAuthHost_.addEventListener('authFlowChange',
133 this.onAuthFlowChange_.bind(this)); 135 this.onAuthFlowChange_.bind(this));
134 this.gaiaAuthHost_.addEventListener('authCompleted', 136 this.gaiaAuthHost_.addEventListener('authCompleted',
135 this.onAuthCompletedMessage_.bind(this)); 137 this.onAuthCompletedMessage_.bind(this));
136 138
137 $('enterprise-info-hint-link').addEventListener('click', function(e) { 139 $('enterprise-info-hint-link').addEventListener('click', function(e) {
138 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); 140 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]);
139 e.preventDefault(); 141 e.preventDefault();
140 }); 142 });
141 143
144 $('back-button-item').addEventListener('click', function(e) {
145 $('back-button-item').hidden = true;
146 $('signin-frame').back();
147 e.preventDefault();
148 }.bind(this));
142 $('close-button-item').addEventListener('click', function(e) { 149 $('close-button-item').addEventListener('click', function(e) {
143 this.cancel(); 150 this.cancel();
144 e.preventDefault(); 151 e.preventDefault();
145 }.bind(this)); 152 }.bind(this));
146 153
147 this.updateLocalizedContent(); 154 this.updateLocalizedContent();
148 }, 155 },
149 156
150 /** 157 /**
151 * Header text of the screen. 158 * Header text of the screen.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 chrome.send('loginUIStateChanged', ['gaia-signin', true]); 261 chrome.send('loginUIStateChanged', ['gaia-signin', true]);
255 $('login-header-bar').signinUIState = 262 $('login-header-bar').signinUIState =
256 this.isEnrollingConsumerManagement_ ? 263 this.isEnrollingConsumerManagement_ ?
257 SIGNIN_UI_STATE.CONSUMER_MANAGEMENT_ENROLLMENT : 264 SIGNIN_UI_STATE.CONSUMER_MANAGEMENT_ENROLLMENT :
258 SIGNIN_UI_STATE.GAIA_SIGNIN; 265 SIGNIN_UI_STATE.GAIA_SIGNIN;
259 266
260 // Ensure that GAIA signin (or loading UI) is actually visible. 267 // Ensure that GAIA signin (or loading UI) is actually visible.
261 window.requestAnimationFrame(function() { 268 window.requestAnimationFrame(function() {
262 chrome.send('loginVisible', ['gaia-loading']); 269 chrome.send('loginVisible', ['gaia-loading']);
263 }); 270 });
271 $('back-button-item').disabled = false;
272 $('back-button-item').hidden = true;
264 $('close-button-item').disabled = false; 273 $('close-button-item').disabled = false;
265 this.classList.toggle('loading', this.loading); 274 this.classList.toggle('loading', this.loading);
266 275
267 // Button header is always visible when sign in is presented. 276 // Button header is always visible when sign in is presented.
268 // Header is hidden once GAIA reports on successful sign in. 277 // Header is hidden once GAIA reports on successful sign in.
269 Oobe.getInstance().headerHidden = false; 278 Oobe.getInstance().headerHidden = false;
270 }, 279 },
271 280
272 onAfterShow: function(data) { 281 onAfterShow: function(data) {
273 if (!this.loading && this.isWebviewSignin) 282 if (!this.loading && this.isWebviewSignin)
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 467
459 // Warm up the user images screen. 468 // Warm up the user images screen.
460 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); 469 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER});
461 }, 470 },
462 471
463 /** 472 /**
464 * Invoked when the auth host emits 'dialogShown' event. 473 * Invoked when the auth host emits 'dialogShown' event.
465 * @private 474 * @private
466 */ 475 */
467 onDialogShown_: function() { 476 onDialogShown_: function() {
477 $('back-button-item').disabled = true;
468 $('close-button-item').disabled = true; 478 $('close-button-item').disabled = true;
469 }, 479 },
470 480
471 /** 481 /**
472 * Invoked when the auth host emits 'dialogHidden' event. 482 * Invoked when the auth host emits 'dialogHidden' event.
473 * @private 483 * @private
474 */ 484 */
475 onDialogHidden_: function() { 485 onDialogHidden_: function() {
486 $('back-button-item').disabled = false;
476 $('close-button-item').disabled = false; 487 $('close-button-item').disabled = false;
477 }, 488 },
478 489
479 /** 490 /**
491 * Invoked when the auth host emits 'backButton' event.
492 * @private
493 */
494 onBackButton_: function(e) {
495 $('back-button-item').hidden = !e.detail;
496 },
497
498 /**
480 * Invoked when the user has successfully authenticated via SAML, the 499 * Invoked when the user has successfully authenticated via SAML, the
481 * principals API was not used and the auth host needs the user to confirm 500 * principals API was not used and the auth host needs the user to confirm
482 * the scraped password. 501 * the scraped password.
483 * @param {number} passwordCount The number of passwords that were scraped. 502 * @param {number} passwordCount The number of passwords that were scraped.
484 * @private 503 * @private
485 */ 504 */
486 onAuthConfirmPassword_: function(passwordCount) { 505 onAuthConfirmPassword_: function(passwordCount) {
487 this.loading = true; 506 this.loading = true;
488 Oobe.getInstance().headerHidden = false; 507 Oobe.getInstance().headerHidden = false;
489 508
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 * For more info see C++ class 'WebUILoginView' which calls this method. 743 * For more info see C++ class 'WebUILoginView' which calls this method.
725 * @param {number} error Error code. 744 * @param {number} error Error code.
726 * @param {string} url The URL that failed to load. 745 * @param {string} url The URL that failed to load.
727 */ 746 */
728 onFrameError: function(error, url) { 747 onFrameError: function(error, url) {
729 this.error_ = error; 748 this.error_ = error;
730 chrome.send('frameLoadingCompleted', [this.error_]); 749 chrome.send('frameLoadingCompleted', [this.error_]);
731 }, 750 },
732 }; 751 };
733 }); 752 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698