| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var chrome = chrome || {}; | 5 var chrome = chrome || {}; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Organizes all signin event listeners and asynchronous requests. | 8 * Organizes all signin event listeners and asynchronous requests. |
| 9 * This object has no public constructor. | 9 * This object has no public constructor. |
| 10 * @type {Object} | 10 * @type {Object} |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 chrome.signin[signinFunction] = makeSigninFunction(signinFunction); | 161 chrome.signin[signinFunction] = makeSigninFunction(signinFunction); |
| 162 } | 162 } |
| 163 | 163 |
| 164 chrome.signin.internalsInfo = {}; | 164 chrome.signin.internalsInfo = {}; |
| 165 | 165 |
| 166 // Replace the displayed values with the latest fetched ones. | 166 // Replace the displayed values with the latest fetched ones. |
| 167 function refreshSigninInfo(signinInfo) { | 167 function refreshSigninInfo(signinInfo) { |
| 168 chrome.signin.internalsInfo = signinInfo; | 168 chrome.signin.internalsInfo = signinInfo; |
| 169 jstProcess(new JsEvalContext(signinInfo), $('signin-info')); | 169 jstProcess(new JsEvalContext(signinInfo), $('signin-info')); |
| 170 jstProcess(new JsEvalContext(signinInfo), $('token-info')); | 170 jstProcess(new JsEvalContext(signinInfo), $('token-info')); |
| 171 jstProcess(new JsEvalContext(signinInfo), $('account-info')); |
| 171 } | 172 } |
| 172 | 173 |
| 173 // Replace the cookie information with the fetched values. | 174 // Replace the cookie information with the fetched values. |
| 174 function updateCookieAccounts(cookieAccountsInfo) { | 175 function updateCookieAccounts(cookieAccountsInfo) { |
| 175 jstProcess(new JsEvalContext(cookieAccountsInfo), $('cookie-info')); | 176 jstProcess(new JsEvalContext(cookieAccountsInfo), $('cookie-info')); |
| 176 } | 177 } |
| 177 | 178 |
| 178 // On load, do an initial refresh and register refreshSigninInfo to be invoked | 179 // On load, do an initial refresh and register refreshSigninInfo to be invoked |
| 179 // whenever we get new signin information from SigninInternalsUI. | 180 // whenever we get new signin information from SigninInternalsUI. |
| 180 function onLoad() { | 181 function onLoad() { |
| 181 chrome.signin.getSigninInfo(refreshSigninInfo); | 182 chrome.signin.getSigninInfo(refreshSigninInfo); |
| 182 | 183 |
| 183 chrome.signin.onSigninInfoChanged.addListener(refreshSigninInfo); | 184 chrome.signin.onSigninInfoChanged.addListener(refreshSigninInfo); |
| 184 chrome.signin.onCookieAccountsFetched.addListener(updateCookieAccounts); | 185 chrome.signin.onCookieAccountsFetched.addListener(updateCookieAccounts); |
| 185 } | 186 } |
| 186 | 187 |
| 187 document.addEventListener('DOMContentLoaded', onLoad, false); | 188 document.addEventListener('DOMContentLoaded', onLoad, false); |
| 188 })(); | 189 })(); |
| OLD | NEW |