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

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

Issue 1138143002: Pass Device ID in the oauth2/token request. Keep Device ID in local state on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment. Created 5 years, 7 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 15 matching lines...) Expand all
26 26
27 return { 27 return {
28 EXTERNAL_API: [ 28 EXTERNAL_API: [
29 'loadAuthExtension', 29 'loadAuthExtension',
30 'updateAuthExtension', 30 'updateAuthExtension',
31 'doReload', 31 'doReload',
32 'onWebviewError', 32 'onWebviewError',
33 'onFrameError', 33 'onFrameError',
34 'updateCancelButtonState', 34 'updateCancelButtonState',
35 'showWhitelistCheckFailedError', 35 'showWhitelistCheckFailedError',
36 'updateDeviceId',
37 ], 36 ],
38 37
39 /** 38 /**
40 * Frame loading error code (0 - no error). 39 * Frame loading error code (0 - no error).
41 * @type {number} 40 * @type {number}
42 * @private 41 * @private
43 */ 42 */
44 error_: 0, 43 error_: 0,
45 44
46 /** 45 /**
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 this.gaiaAuthHost_.addEventListener( 145 this.gaiaAuthHost_.addEventListener(
147 'ready', this.onAuthReady_.bind(this)); 146 'ready', this.onAuthReady_.bind(this));
148 this.gaiaAuthHost_.addEventListener( 147 this.gaiaAuthHost_.addEventListener(
149 'dialogShown', this.onDialogShown_.bind(this)); 148 'dialogShown', this.onDialogShown_.bind(this));
150 this.gaiaAuthHost_.addEventListener( 149 this.gaiaAuthHost_.addEventListener(
151 'dialogHidden', this.onDialogHidden_.bind(this)); 150 'dialogHidden', this.onDialogHidden_.bind(this));
152 this.gaiaAuthHost_.addEventListener( 151 this.gaiaAuthHost_.addEventListener(
153 'backButton', this.onBackButton_.bind(this)); 152 'backButton', this.onBackButton_.bind(this));
154 this.gaiaAuthHost_.addEventListener( 153 this.gaiaAuthHost_.addEventListener(
155 'showView', this.onShowView_.bind(this)); 154 'showView', this.onShowView_.bind(this));
156 this.gaiaAuthHost_.addEventListener('attemptLogin',
157 this.onAttemptLogin_.bind(this));
158 this.gaiaAuthHost_.confirmPasswordCallback = 155 this.gaiaAuthHost_.confirmPasswordCallback =
159 this.onAuthConfirmPassword_.bind(this); 156 this.onAuthConfirmPassword_.bind(this);
160 this.gaiaAuthHost_.noPasswordCallback = 157 this.gaiaAuthHost_.noPasswordCallback =
161 this.onAuthNoPassword_.bind(this); 158 this.onAuthNoPassword_.bind(this);
162 this.gaiaAuthHost_.insecureContentBlockedCallback = 159 this.gaiaAuthHost_.insecureContentBlockedCallback =
163 this.onInsecureContentBlocked_.bind(this); 160 this.onInsecureContentBlocked_.bind(this);
164 this.gaiaAuthHost_.missingGaiaInfoCallback = 161 this.gaiaAuthHost_.missingGaiaInfoCallback =
165 this.missingGaiaInfo_.bind(this); 162 this.missingGaiaInfo_.bind(this);
166 this.gaiaAuthHost_.samlApiUsedCallback = 163 this.gaiaAuthHost_.samlApiUsedCallback =
167 this.samlApiUsed_.bind(this); 164 this.samlApiUsed_.bind(this);
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 if (this.errorBubble_) { 620 if (this.errorBubble_) {
624 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); 621 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]);
625 this.errorBubble_ = undefined; 622 this.errorBubble_ = undefined;
626 } 623 }
627 624
628 chrome.send('loginWebuiReady'); 625 chrome.send('loginWebuiReady');
629 chrome.send('loginVisible', ['gaia-signin']); 626 chrome.send('loginVisible', ['gaia-signin']);
630 }, 627 },
631 628
632 /** 629 /**
633 * Invoked when the auth host emits 'attemptLogin' event.
634 * @param {Object} Message object with |detail| field keeping email:
635 * like {detail: 'user@gmail.com'} .
636 * @private
637 */
638 onAttemptLogin_: function(e) {
639 chrome.send('attemptLogin', [e.detail]);
640 },
641
642 /**
643 * Invoked when the user has successfully authenticated via SAML, the 630 * Invoked when the user has successfully authenticated via SAML, the
644 * principals API was not used and the auth host needs the user to confirm 631 * principals API was not used and the auth host needs the user to confirm
645 * the scraped password. 632 * the scraped password.
646 * @param {string} email The authenticated user's e-mail. 633 * @param {string} email The authenticated user's e-mail.
647 * @param {number} passwordCount The number of passwords that were scraped. 634 * @param {number} passwordCount The number of passwords that were scraped.
648 * @private 635 * @private
649 */ 636 */
650 onAuthConfirmPassword_: function(email, passwordCount) { 637 onAuthConfirmPassword_: function(email, passwordCount) {
651 this.loading = true; 638 this.loading = true;
652 Oobe.getInstance().headerHidden = false; 639 Oobe.getInstance().headerHidden = false;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 if (credentials.hasOwnProperty('authCodeOnly') && 727 if (credentials.hasOwnProperty('authCodeOnly') &&
741 credentials.authCodeOnly) { 728 credentials.authCodeOnly) {
742 chrome.send('completeAuthenticationAuthCodeOnly', 729 chrome.send('completeAuthenticationAuthCodeOnly',
743 [credentials.authCode]); 730 [credentials.authCode]);
744 } else { 731 } else {
745 chrome.send('completeAuthentication', [ 732 chrome.send('completeAuthentication', [
746 credentials.gaiaId, 733 credentials.gaiaId,
747 credentials.email, 734 credentials.email,
748 credentials.password, 735 credentials.password,
749 credentials.authCode, 736 credentials.authCode,
750 credentials.usingSAML, 737 credentials.usingSAML
751 credentials.deviceId
752 ]); 738 ]);
753 } 739 }
754 } else { 740 } else {
755 chrome.send('completeLogin', 741 chrome.send('completeLogin',
756 [credentials.gaiaId, 742 [credentials.gaiaId,
757 credentials.email, 743 credentials.email,
758 credentials.password, 744 credentials.password,
759 credentials.usingSAML]); 745 credentials.usingSAML]);
760 } 746 }
761 747
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 $('gaia-whitelist-error').textContent = 932 $('gaia-whitelist-error').textContent =
947 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : 933 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' :
948 'whitelistErrorConsumer'); 934 'whitelistErrorConsumer');
949 } 935 }
950 936
951 this.classList.toggle('whitelist-error', show); 937 this.classList.toggle('whitelist-error', show);
952 this.loading = !show; 938 this.loading = !show;
953 939
954 if (!show) 940 if (!show)
955 Oobe.showSigninUI(); 941 Oobe.showSigninUI();
956 }, 942 }
957
958 /**
959 * Inform Gaia of new deviceId.
960 * @param {data} Object like {'deviceId': 'test-device-id'}
961 */
962 updateDeviceId: function(data) {
963 if (!this.isNewGaiaFlow)
964 return;
965
966 if (data && data.deviceId)
967 this.gaiaAuthHost_.updateDeviceId(data.deviceId);
968 },
969 }; 943 };
970 }); 944 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698