Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: remoting/webapp/crd/js/remoting.js

Issue 868203002: Handle authentication failures in the v2 app by restarting the app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 * Chromoting again. 192 * Chromoting again.
193 * 193 *
194 * @param {remoting.Error} error 194 * @param {remoting.Error} error
195 * @return {void} Nothing. 195 * @return {void} Nothing.
196 */ 196 */
197 remoting.showErrorMessage = function(error) { 197 remoting.showErrorMessage = function(error) {
198 l10n.localizeElementFromTag( 198 l10n.localizeElementFromTag(
199 document.getElementById('token-refresh-error-message'), 199 document.getElementById('token-refresh-error-message'),
200 error); 200 error);
201 var auth_failed = (error == remoting.Error.AUTHENTICATION_FAILED); 201 var auth_failed = (error == remoting.Error.AUTHENTICATION_FAILED);
202 document.getElementById('token-refresh-auth-failed').hidden = !auth_failed; 202 if (base.isAppsV2()) {
203 document.getElementById('token-refresh-other-error').hidden = auth_failed; 203 remoting.identity.handleAuthFailure();
204 remoting.setMode(remoting.AppMode.TOKEN_REFRESH_FAILED); 204 } else {
205 document.getElementById('token-refresh-auth-failed').hidden = !auth_failed;
206 document.getElementById('token-refresh-other-error').hidden = auth_failed;
207 remoting.setMode(remoting.AppMode.TOKEN_REFRESH_FAILED);
208 }
205 }; 209 };
206 210
207 /** 211 /**
208 * Determine whether or not the app is running in a window. 212 * Determine whether or not the app is running in a window.
209 * @param {function(boolean):void} callback Callback to receive whether or not 213 * @param {function(boolean):void} callback Callback to receive whether or not
210 * the current tab is running in windowed mode. 214 * the current tab is running in windowed mode.
211 */ 215 */
212 function isWindowed_(callback) { 216 function isWindowed_(callback) {
213 /** @param {chrome.Window} win The current window. */ 217 /** @param {chrome.Window} win The current window. */
214 var windowCallback = function(win) { 218 var windowCallback = function(win) {
215 callback(win.type == 'popup'); 219 callback(win.type == 'popup');
216 }; 220 };
217 /** @param {chrome.Tab} tab The current tab. */ 221 /** @param {chrome.Tab} tab The current tab. */
218 var tabCallback = function(tab) { 222 var tabCallback = function(tab) {
219 if (tab.pinned) { 223 if (tab.pinned) {
220 callback(false); 224 callback(false);
221 } else { 225 } else {
222 chrome.windows.get(tab.windowId, null, windowCallback); 226 chrome.windows.get(tab.windowId, null, windowCallback);
223 } 227 }
224 }; 228 };
225 if (chrome.tabs) { 229 if (chrome.tabs) {
226 chrome.tabs.getCurrent(tabCallback); 230 chrome.tabs.getCurrent(tabCallback);
227 } else { 231 } else {
228 console.error('chome.tabs is not available.'); 232 console.error('chome.tabs is not available.');
229 } 233 }
230 } 234 }
231 235
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698