| 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 cr.define('inline.login', function() { | 9 cr.define('inline.login', function() { |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Loads auth extension. | 73 * Loads auth extension. |
| 74 * @param {Object} data Parameters for auth extension. | 74 * @param {Object} data Parameters for auth extension. |
| 75 */ | 75 */ |
| 76 function loadAuthExtension(data) { | 76 function loadAuthExtension(data) { |
| 77 // TODO(rogerta): in when using webview, the |completeLogin| argument | 77 // TODO(rogerta): in when using webview, the |completeLogin| argument |
| 78 // is ignored. See addEventListener() call above. | 78 // is ignored. See addEventListener() call above. |
| 79 authExtHost.load(data.authMode, data, completeLogin); | 79 authExtHost.load(data.authMode, data, completeLogin); |
| 80 $('contents').classList.toggle('loading', | 80 $('contents') |
| 81 data.authMode != cr.login.GaiaAuthHost.AuthMode.DESKTOP || | 81 .classList.toggle( |
| 82 data.constrained == '1'); | 82 'loading', |
| 83 data.authMode != cr.login.GaiaAuthHost.AuthMode.DESKTOP || |
| 84 data.constrained == '1'); |
| 83 isLoginPrimaryAccount = data.isLoginPrimaryAccount; | 85 isLoginPrimaryAccount = data.isLoginPrimaryAccount; |
| 84 } | 86 } |
| 85 | 87 |
| 86 /** | 88 /** |
| 87 * Closes the inline login dialog. | 89 * Closes the inline login dialog. |
| 88 */ | 90 */ |
| 89 function closeDialog() { | 91 function closeDialog() { |
| 90 chrome.send('dialogClose', ['']); | 92 chrome.send('dialogClose', ['']); |
| 91 } | 93 } |
| 92 | 94 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 107 } | 109 } |
| 108 | 110 |
| 109 /** | 111 /** |
| 110 * Returns whether the auth UI is ready, for testing purpose. | 112 * Returns whether the auth UI is ready, for testing purpose. |
| 111 */ | 113 */ |
| 112 function isAuthReady() { | 114 function isAuthReady() { |
| 113 return authReadyFired; | 115 return authReadyFired; |
| 114 } | 116 } |
| 115 | 117 |
| 116 function showBackButton() { | 118 function showBackButton() { |
| 117 | |
| 118 $('navigation-button').icon = | 119 $('navigation-button').icon = |
| 119 isRTL() ? 'icons:arrow-forward' : 'icons:arrow-back'; | 120 isRTL() ? 'icons:arrow-forward' : 'icons:arrow-back'; |
| 120 | 121 |
| 121 $('navigation-button').setAttribute( | 122 $('navigation-button') |
| 122 'aria-label', loadTimeData.getString('accessibleBackButtonLabel')); | 123 .setAttribute( |
| 124 'aria-label', loadTimeData.getString('accessibleBackButtonLabel')); |
| 123 } | 125 } |
| 124 | 126 |
| 125 function showCloseButton() { | 127 function showCloseButton() { |
| 126 $('navigation-button').icon = 'icons:close'; | 128 $('navigation-button').icon = 'icons:close'; |
| 127 $('navigation-button').classList.add('enabled'); | 129 $('navigation-button').classList.add('enabled'); |
| 128 $('navigation-button').setAttribute( | 130 $('navigation-button') |
| 129 'aria-label', loadTimeData.getString('accessibleCloseButtonLabel')); | 131 .setAttribute( |
| 132 'aria-label', loadTimeData.getString('accessibleCloseButtonLabel')); |
| 130 } | 133 } |
| 131 | 134 |
| 132 function navigationButtonClicked() { | 135 function navigationButtonClicked() { |
| 133 chrome.send('navigationButtonClicked'); | 136 chrome.send('navigationButtonClicked'); |
| 134 } | 137 } |
| 135 | 138 |
| 136 return { | 139 return { |
| 137 closeDialog: closeDialog, | 140 closeDialog: closeDialog, |
| 138 getAuthExtHost: getAuthExtHost, | 141 getAuthExtHost: getAuthExtHost, |
| 139 handleOAuth2TokenFailure: handleOAuth2TokenFailure, | 142 handleOAuth2TokenFailure: handleOAuth2TokenFailure, |
| 140 initialize: initialize, | 143 initialize: initialize, |
| 141 isAuthReady: isAuthReady, | 144 isAuthReady: isAuthReady, |
| 142 loadAuthExtension: loadAuthExtension, | 145 loadAuthExtension: loadAuthExtension, |
| 143 navigationButtonClicked: navigationButtonClicked, | 146 navigationButtonClicked: navigationButtonClicked, |
| 144 showBackButton: showBackButton, | 147 showBackButton: showBackButton, |
| 145 showCloseButton: showCloseButton | 148 showCloseButton: showCloseButton |
| 146 }; | 149 }; |
| 147 }); | 150 }); |
| 148 | 151 |
| 149 document.addEventListener('DOMContentLoaded', inline.login.initialize); | 152 document.addEventListener('DOMContentLoaded', inline.login.initialize); |
| OLD | NEW |