| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 var timestamp = pad(now.getMonth() + 1, 2) + pad(now.getDate(), 2) + '/' + | 167 var timestamp = pad(now.getMonth() + 1, 2) + pad(now.getDate(), 2) + '/' + |
| 168 pad(now.getHours(), 2) + pad(now.getMinutes(), 2) + | 168 pad(now.getHours(), 2) + pad(now.getMinutes(), 2) + |
| 169 pad(now.getSeconds(), 2) + '.' + pad(now.getMilliseconds(), 3); | 169 pad(now.getSeconds(), 2) + '.' + pad(now.getMilliseconds(), 3); |
| 170 return '[' + timestamp + ']'; | 170 return '[' + timestamp + ']'; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 /** | 173 /** |
| 174 * Show an error message, optionally including a short-cut for signing in to | 174 * Show an error message, optionally including a short-cut for signing in to |
| 175 * Chromoting again. | 175 * Chromoting again. |
| 176 * | 176 * |
| 177 * @param {remoting.Error} error | 177 * @param {!remoting.Error} error |
| 178 * @return {void} Nothing. | 178 * @return {void} Nothing. |
| 179 */ | 179 */ |
| 180 remoting.showErrorMessage = function(error) { | 180 remoting.showErrorMessage = function(error) { |
| 181 l10n.localizeElementFromTag( | 181 l10n.localizeElementFromTag( |
| 182 document.getElementById('token-refresh-error-message'), | 182 document.getElementById('token-refresh-error-message'), |
| 183 error); | 183 error.tag); |
| 184 var auth_failed = (error == remoting.Error.AUTHENTICATION_FAILED); | 184 var auth_failed = (error.tag == remoting.Error.Tag.AUTHENTICATION_FAILED); |
| 185 if (base.isAppsV2()) { | 185 if (base.isAppsV2()) { |
| 186 remoting.handleAuthFailureAndRelaunch(); | 186 remoting.handleAuthFailureAndRelaunch(); |
| 187 } else { | 187 } else { |
| 188 document.getElementById('token-refresh-auth-failed').hidden = !auth_failed; | 188 document.getElementById('token-refresh-auth-failed').hidden = !auth_failed; |
| 189 document.getElementById('token-refresh-other-error').hidden = auth_failed; | 189 document.getElementById('token-refresh-other-error').hidden = auth_failed; |
| 190 remoting.setMode(remoting.AppMode.TOKEN_REFRESH_FAILED); | 190 remoting.setMode(remoting.AppMode.TOKEN_REFRESH_FAILED); |
| 191 } | 191 } |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 /** | 194 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 208 } else { | 208 } else { |
| 209 chrome.windows.get(tab.windowId, null, windowCallback); | 209 chrome.windows.get(tab.windowId, null, windowCallback); |
| 210 } | 210 } |
| 211 }; | 211 }; |
| 212 if (chrome.tabs) { | 212 if (chrome.tabs) { |
| 213 chrome.tabs.getCurrent(tabCallback); | 213 chrome.tabs.getCurrent(tabCallback); |
| 214 } else { | 214 } else { |
| 215 console.error('chome.tabs is not available.'); | 215 console.error('chome.tabs is not available.'); |
| 216 } | 216 } |
| 217 } | 217 } |
| OLD | NEW |