OLD | NEW |
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 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 chrome.send('initialize'); | 43 chrome.send('initialize'); |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * Loads auth extension. | 47 * Loads auth extension. |
48 * @param {Object} data Parameters for auth extension. | 48 * @param {Object} data Parameters for auth extension. |
49 */ | 49 */ |
50 function loadAuthExtension(data) { | 50 function loadAuthExtension(data) { |
51 authExtHost.load(data.authMode, data, onAuthCompleted); | 51 authExtHost.load(data.authMode, data, onAuthCompleted); |
52 $('contents').classList.toggle('loading', true); | 52 // Do not show loading spinner to give user a faster response |
| 53 // with inline flows. |
| 54 $('contents').classList.toggle('loading', |
| 55 data.authMode != cr.login.GaiaAuthHost.AuthMode.INLINE); |
53 } | 56 } |
54 | 57 |
55 /** | 58 /** |
56 * Closes the inline login dialog. | 59 * Closes the inline login dialog. |
57 */ | 60 */ |
58 function closeDialog() { | 61 function closeDialog() { |
59 chrome.send('DialogClose', ['']); | 62 chrome.send('DialogClose', ['']); |
60 } | 63 } |
61 | 64 |
62 /** | 65 /** |
63 * Invoked when failed to get oauth2 refresh token. | 66 * Invoked when failed to get oauth2 refresh token. |
64 */ | 67 */ |
65 function handleOAuth2TokenFailure() { | 68 function handleOAuth2TokenFailure() { |
66 // TODO(xiyuan): Show an error UI. | 69 // TODO(xiyuan): Show an error UI. |
67 authExtHost.reload(); | 70 authExtHost.reload(); |
68 $('contents').classList.toggle('loading', true); | 71 $('contents').classList.toggle('loading', true); |
69 } | 72 } |
70 | 73 |
71 return { | 74 return { |
72 initialize: initialize, | 75 initialize: initialize, |
73 loadAuthExtension: loadAuthExtension, | 76 loadAuthExtension: loadAuthExtension, |
74 closeDialog: closeDialog, | 77 closeDialog: closeDialog, |
75 handleOAuth2TokenFailure: handleOAuth2TokenFailure | 78 handleOAuth2TokenFailure: handleOAuth2TokenFailure |
76 }; | 79 }; |
77 }); | 80 }); |
78 | 81 |
79 document.addEventListener('DOMContentLoaded', inline.login.initialize); | 82 document.addEventListener('DOMContentLoaded', inline.login.initialize); |
OLD | NEW |