| 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 remoting.initElementEventHandlers = function() { | 10 remoting.initElementEventHandlers = function() { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 { event: 'click', id: 'sign-out', fn:remoting.signOut }, | 77 { event: 'click', id: 'sign-out', fn:remoting.signOut }, |
| 78 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, | 78 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, |
| 79 { event: 'click', id: 'token-refresh-error-sign-in', | 79 { event: 'click', id: 'token-refresh-error-sign-in', |
| 80 fn: remoting.handleAuthFailureAndRelaunch } | 80 fn: remoting.handleAuthFailureAndRelaunch } |
| 81 ]; | 81 ]; |
| 82 registerEventListeners(it2me_actions); | 82 registerEventListeners(it2me_actions); |
| 83 registerEventListeners(me2me_actions); | 83 registerEventListeners(me2me_actions); |
| 84 registerEventListeners(host_actions); | 84 registerEventListeners(host_actions); |
| 85 registerEventListeners(auth_actions); | 85 registerEventListeners(auth_actions); |
| 86 } | 86 } |
| 87 |
| 88 /** |
| 89 * Sign the user out of Chromoting by clearing (and revoking, if possible) the |
| 90 * OAuth refresh token. |
| 91 * |
| 92 * Also clear all local storage, to avoid leaking information. |
| 93 */ |
| 94 remoting.signOut = function() { |
| 95 remoting.oauth2.removeCachedAuthToken().then(function(){ |
| 96 chrome.storage.local.clear(); |
| 97 remoting.setMode(remoting.AppMode.HOME); |
| 98 window.location.reload(); |
| 99 }); |
| 100 }; |
| 101 |
| OLD | NEW |