Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 24 matching lines...) Expand all Loading... | |
| 35 remoting.identity = /** @type {remoting.Identity} */ (oauth2); | 35 remoting.identity = /** @type {remoting.Identity} */ (oauth2); |
| 36 if (!remoting.identity.isAuthenticated()) { | 36 if (!remoting.identity.isAuthenticated()) { |
| 37 remoting.AuthDialog.getInstance().show().then(function() { | 37 remoting.AuthDialog.getInstance().show().then(function() { |
| 38 remoting.oauth2.doAuthRedirect(function(){ | 38 remoting.oauth2.doAuthRedirect(function(){ |
| 39 window.location.reload(); | 39 window.location.reload(); |
| 40 }); | 40 }); |
| 41 }); | 41 }); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 remoting.identity.getUserInfo().then(function(userInfo) { | 45 remoting.identity.getUserInfo().then( |
| 46 onUserInfoAvailable(userInfo.email, userInfo.name); | 46 /** @param {{email:string, name:string}} userInfo */ |
|
kelvinp
2015/02/28 03:03:52
change in this file shouldn't be necessary.
garykac
2015/02/28 03:28:23
I agree.
Sadly, jscompile says it is. :-(
| |
| 47 }).catch(function(error) { | 47 function(userInfo) { |
| 48 onGetIdentityInfoError( | 48 onUserInfoAvailable(userInfo.email, userInfo.name); |
| 49 /** @type {remoting.Error} */ (error)); | 49 }).catch(function(error) { |
| 50 }); | 50 onGetIdentityInfoError( |
| 51 /** @type {remoting.Error} */ (error)); | |
| 52 }); | |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 /** | 55 /** |
| 54 * Removes the cached token and restarts the app. | 56 * Removes the cached token and restarts the app. |
| 55 * | 57 * |
| 56 * @return {void} Nothing. | 58 * @return {void} Nothing. |
| 57 */ | 59 */ |
| 58 remoting.handleAuthFailureAndRelaunch = function() { | 60 remoting.handleAuthFailureAndRelaunch = function() { |
| 59 remoting.identity.removeCachedAuthToken().then(function(){ | 61 remoting.identity.removeCachedAuthToken().then(function(){ |
| 60 if (base.isAppsV2()) { | 62 if (base.isAppsV2()) { |
| 61 base.Ipc.invoke('remoting.ActivationHandler.restart', | 63 base.Ipc.invoke('remoting.ActivationHandler.restart', |
| 62 chrome.app.window.current().id); | 64 chrome.app.window.current().id); |
| 63 } else { | 65 } else { |
| 64 window.location.reload(); | 66 window.location.reload(); |
| 65 } | 67 } |
| 66 }); | 68 }); |
| 67 }; | 69 }; |
| OLD | NEW |