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

Side by Side Diff: chrome/browser/resources/inline_login/inline_login.js

Issue 239143009: Disallow top-level navigation in gaia iframe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable flaky test Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 Inline login UI. 6 * @fileoverview Inline login UI.
7 */ 7 */
8 8
9 <include src="../gaia_auth_host/gaia_auth_host.js"></include> 9 <include src="../gaia_auth_host/gaia_auth_host.js"></include>
10 10
11 cr.define('inline.login', function() { 11 cr.define('inline.login', function() {
12 'use strict'; 12 'use strict';
13 13
14 /** 14 /**
15 * The auth extension host instance. 15 * The auth extension host instance.
16 * @type {Object} 16 * @type {Object}
17 */ 17 */
18 var authExtHost; 18 var authExtHost;
19 19
20 /** 20 /**
21 * Whether the auth ready event has been fired, for testing purpose.
22 */
23 var authReadyFired;
24
25 /**
21 * Handler of auth host 'ready' event. 26 * Handler of auth host 'ready' event.
22 */ 27 */
23 function onAuthReady() { 28 function onAuthReady() {
24 $('contents').classList.toggle('loading', false); 29 $('contents').classList.toggle('loading', false);
30 authReadyFired = true;
25 } 31 }
26 32
27 /** 33 /**
28 * Handler of auth host 'completed' event. 34 * Handler of auth host 'completed' event.
29 * @param {!Object} credentials Credentials of the completed authentication. 35 * @param {!Object} credentials Credentials of the completed authentication.
30 */ 36 */
31 function onAuthCompleted(credentials) { 37 function onAuthCompleted(credentials) {
32 chrome.send('completeLogin', [credentials]); 38 chrome.send('completeLogin', [credentials]);
33 $('contents').classList.toggle('loading', true); 39 $('contents').classList.toggle('loading', true);
34 } 40 }
(...skipping 27 matching lines...) Expand all
62 68
63 /** 69 /**
64 * Invoked when failed to get oauth2 refresh token. 70 * Invoked when failed to get oauth2 refresh token.
65 */ 71 */
66 function handleOAuth2TokenFailure() { 72 function handleOAuth2TokenFailure() {
67 // TODO(xiyuan): Show an error UI. 73 // TODO(xiyuan): Show an error UI.
68 authExtHost.reload(); 74 authExtHost.reload();
69 $('contents').classList.toggle('loading', true); 75 $('contents').classList.toggle('loading', true);
70 } 76 }
71 77
78 /**
79 * Returns the auth host instance, for testing purpose.
80 */
81 function getAuthExtHost() {
82 return authExtHost;
83 }
84
85 /**
86 * Returns whether the auth UI is ready, for testing purpose.
87 */
88 function isAuthReady() {
89 return authReadyFired;
90 }
91
72 return { 92 return {
93 getAuthExtHost: getAuthExtHost,
94 isAuthReady: isAuthReady,
73 initialize: initialize, 95 initialize: initialize,
74 loadAuthExtension: loadAuthExtension, 96 loadAuthExtension: loadAuthExtension,
75 closeDialog: closeDialog, 97 closeDialog: closeDialog,
76 handleOAuth2TokenFailure: handleOAuth2TokenFailure 98 handleOAuth2TokenFailure: handleOAuth2TokenFailure
77 }; 99 };
78 }); 100 });
79 101
80 document.addEventListener('DOMContentLoaded', inline.login.initialize); 102 document.addEventListener('DOMContentLoaded', inline.login.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/resources/gaia_auth/main.html ('k') | chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698