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

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

Issue 937593002: Changed identity API to use promises instead of callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 }; 103 };
104 104
105 /** 105 /**
106 * Sign the user out of Chromoting by clearing (and revoking, if possible) the 106 * Sign the user out of Chromoting by clearing (and revoking, if possible) the
107 * OAuth refresh token. 107 * OAuth refresh token.
108 * 108 *
109 * Also clear all local storage, to avoid leaking information. 109 * Also clear all local storage, to avoid leaking information.
110 */ 110 */
111 remoting.signOut = function() { 111 remoting.signOut = function() {
112 remoting.oauth2.removeCachedAuthToken(function(){ 112 remoting.oauth2.removeCachedAuthToken().then(function(){
113 chrome.storage.local.clear(); 113 chrome.storage.local.clear();
114 remoting.setMode(remoting.AppMode.HOME); 114 remoting.setMode(remoting.AppMode.HOME);
115 window.location.reload(); 115 window.location.reload();
116 }); 116 });
117 }; 117 };
118 118
119 /** 119 /**
120 * Callback function called when the browser window gets a paste operation. 120 * Callback function called when the browser window gets a paste operation.
121 * 121 *
122 * @param {Event} event 122 * @param {Event} event
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } else { 207 } else {
208 chrome.windows.get(tab.windowId, null, windowCallback); 208 chrome.windows.get(tab.windowId, null, windowCallback);
209 } 209 }
210 }; 210 };
211 if (chrome.tabs) { 211 if (chrome.tabs) {
212 chrome.tabs.getCurrent(tabCallback); 212 chrome.tabs.getCurrent(tabCallback);
213 } else { 213 } else {
214 console.error('chome.tabs is not available.'); 214 console.error('chome.tabs is not available.');
215 } 215 }
216 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698