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 // Do not show loading spinner to give user a faster response | 52 $('contents').classList.toggle('loading', true); |
53 // with inline flows. | |
54 $('contents').classList.toggle('loading', | |
55 data.authMode != cr.login.GaiaAuthHost.AuthMode.INLINE); | |
56 } | 53 } |
57 | 54 |
58 /** | 55 /** |
59 * Closes the inline login dialog. | 56 * Closes the inline login dialog. |
60 */ | 57 */ |
61 function closeDialog() { | 58 function closeDialog() { |
62 chrome.send('DialogClose', ['']); | 59 chrome.send('DialogClose', ['']); |
63 } | 60 } |
64 | 61 |
65 /** | 62 /** |
66 * Invoked when failed to get oauth2 refresh token. | 63 * Invoked when failed to get oauth2 refresh token. |
67 */ | 64 */ |
68 function handleOAuth2TokenFailure() { | 65 function handleOAuth2TokenFailure() { |
69 // TODO(xiyuan): Show an error UI. | 66 // TODO(xiyuan): Show an error UI. |
70 authExtHost.reload(); | 67 authExtHost.reload(); |
71 $('contents').classList.toggle('loading', true); | 68 $('contents').classList.toggle('loading', true); |
72 } | 69 } |
73 | 70 |
74 return { | 71 return { |
75 initialize: initialize, | 72 initialize: initialize, |
76 loadAuthExtension: loadAuthExtension, | 73 loadAuthExtension: loadAuthExtension, |
77 closeDialog: closeDialog, | 74 closeDialog: closeDialog, |
78 handleOAuth2TokenFailure: handleOAuth2TokenFailure | 75 handleOAuth2TokenFailure: handleOAuth2TokenFailure |
79 }; | 76 }; |
80 }); | 77 }); |
81 | 78 |
82 document.addEventListener('DOMContentLoaded', inline.login.initialize); | 79 document.addEventListener('DOMContentLoaded', inline.login.initialize); |
OLD | NEW |