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

Side by Side Diff: chrome/browser/resources/gaia_auth_host/authenticator.js

Issue 958923003: ChromeOS Gaia: Do not send 'focusready' message when Gaia window is focused (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed comment 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
« no previous file with comments | « chrome/browser/resources/chromeos/login/screen_gaia_signin.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 An UI component to authenciate to Chrome. The component hosts 6 * @fileoverview An UI component to authenciate to Chrome. The component hosts
7 * IdP web pages in a webview. A client who is interested in monitoring 7 * IdP web pages in a webview. A client who is interested in monitoring
8 * authentication events should pass a listener object of type 8 * authentication events should pass a listener object of type
9 * cr.login.GaiaAuthHost.Listener as defined in this file. After initialization, 9 * cr.login.GaiaAuthHost.Listener as defined in this file. After initialization,
10 * call {@code load} to start the authentication flow. 10 * call {@code load} to start the authentication flow.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 /** 150 /**
151 * Reloads the authenticator component. 151 * Reloads the authenticator component.
152 */ 152 */
153 Authenticator.prototype.reload = function() { 153 Authenticator.prototype.reload = function() {
154 this.webview_.src = this.reloadUrl_; 154 this.webview_.src = this.reloadUrl_;
155 this.authFlow_ = AuthFlow.DEFAULT; 155 this.authFlow_ = AuthFlow.DEFAULT;
156 this.loaded_ = false; 156 this.loaded_ = false;
157 }; 157 };
158 158
159 /** 159 /**
160 * Set focus in Gaia on default input. 160 * Send message 'focusready' to Gaia so it sets focus on default input.
161 */ 161 */
162 Authenticator.prototype.setFocus = function() { 162 Authenticator.prototype.sendFocusReady = function() {
163 this.onFocus_(); 163 var currentUrl = this.webview_.src;
164 if (currentUrl.lastIndexOf(this.idpOrigin_) == 0) {
165 var msg = {
166 'method': 'focusready'
167 };
168 // TODO(rsorokin): Get rid of this check once issue crbug.com/456118 is
169 // fixed.
170 if (this.webview_.contentWindow) {
171 console.error('send message');
Nikita (slow) 2015/02/26 15:10:50 What is this error about? Please remove it.
Roman Sorokin (ftl) 2015/02/26 15:14:06 Oops, sorry. Done.
172 this.webview_.contentWindow.postMessage(msg, currentUrl);
173 }
174 }
164 }; 175 };
165 176
166 Authenticator.prototype.constructInitialFrameUrl_ = function(data) { 177 Authenticator.prototype.constructInitialFrameUrl_ = function(data) {
167 var url = this.idpOrigin_ + (data.gaiaPath || IDP_PATH); 178 var url = this.idpOrigin_ + (data.gaiaPath || IDP_PATH);
168 179
169 if (this.isMinuteMaidChromeOS) { 180 if (this.isMinuteMaidChromeOS) {
170 if (data.chromeType) 181 if (data.chromeType)
171 url = appendParam(url, 'chrometype', data.chromeType); 182 url = appendParam(url, 'chrometype', data.chromeType);
172 if (data.clientId) 183 if (data.clientId)
173 url = appendParam(url, 'client_id', data.clientId); 184 url = appendParam(url, 'client_id', data.clientId);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 history.replaceState({url: url}); 249 history.replaceState({url: url});
239 }; 250 };
240 251
241 /** 252 /**
242 * Invoked when the sign-in page takes focus. 253 * Invoked when the sign-in page takes focus.
243 * @param {object} e The focus event being triggered. 254 * @param {object} e The focus event being triggered.
244 * @private 255 * @private
245 */ 256 */
246 Authenticator.prototype.onFocus_ = function(e) { 257 Authenticator.prototype.onFocus_ = function(e) {
247 this.webview_.focus(); 258 this.webview_.focus();
248 var currentUrl = this.webview_.src;
249 if (currentUrl.lastIndexOf(this.idpOrigin_) == 0) {
250 var msg = {
251 'method': 'focusready'
252 };
253 // TODO(rsorokin): Get rid of this check once issue crbug.com/456118 is
254 // fixed.
255 if (this.webview_.contentWindow)
256 this.webview_.contentWindow.postMessage(msg, currentUrl);
257 }
258 }; 259 };
259 260
260 /** 261 /**
261 * Invoked when the history state is changed. 262 * Invoked when the history state is changed.
262 * @param {object} e The popstate event being triggered. 263 * @param {object} e The popstate event being triggered.
263 * @private 264 * @private
264 */ 265 */
265 Authenticator.prototype.onPopState_ = function(e) { 266 Authenticator.prototype.onPopState_ = function(e) {
266 var state = e.state; 267 var state = e.state;
267 if (state && state.url) 268 if (state && state.url)
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 Authenticator.AuthFlow = AuthFlow; 414 Authenticator.AuthFlow = AuthFlow;
414 Authenticator.AuthMode = AuthMode; 415 Authenticator.AuthMode = AuthMode;
415 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; 416 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS;
416 417
417 return { 418 return {
418 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old 419 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old
419 // iframe-based flow is deprecated. 420 // iframe-based flow is deprecated.
420 GaiaAuthHost: Authenticator 421 GaiaAuthHost: Authenticator
421 }; 422 };
422 }); 423 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/screen_gaia_signin.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698