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

Side by Side Diff: remoting/webapp/crd/js/client_session.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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class handling creation and teardown of a remoting client session. 7 * Class handling creation and teardown of a remoting client session.
8 * 8 *
9 * The ClientSession class controls lifetime of the client plugin 9 * The ClientSession class controls lifetime of the client plugin
10 * object and provides the plugin with the functionality it needs to 10 * object and provides the plugin with the functionality it needs to
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 /** @type {remoting.ClientSession} */ 1574 /** @type {remoting.ClientSession} */
1575 var that = this; 1575 var that = this;
1576 1576
1577 /** @param {string} token */ 1577 /** @param {string} token */
1578 var sendToken = function(token) { 1578 var sendToken = function(token) {
1579 remoting.clientSession.sendClientMessage('accessToken', token); 1579 remoting.clientSession.sendClientMessage('accessToken', token);
1580 }; 1580 };
1581 /** @param {remoting.Error} error */ 1581 /** @param {remoting.Error} error */
1582 var sendError = function(error) { 1582 var sendError = function(error) {
1583 console.log('Failed to refresh access token: ' + error); 1583 console.log('Failed to refresh access token: ' + error);
1584 } 1584 };
1585 remoting.identity.callWithNewToken(sendToken, sendError); 1585 remoting.identity.getNewToken().
1586 then(sendToken).
1587 catch(remoting.Error.handler(sendError));
1586 window.setTimeout(this.sendGoogleDriveAccessToken_.bind(this), 1588 window.setTimeout(this.sendGoogleDriveAccessToken_.bind(this),
1587 remoting.ACCESS_TOKEN_RESEND_INTERVAL_MS); 1589 remoting.ACCESS_TOKEN_RESEND_INTERVAL_MS);
1588 }; 1590 };
1589 1591
1590 /** 1592 /**
1591 * @return {{width: number, height: number}} The height of the window's client 1593 * @return {{width: number, height: number}} The height of the window's client
1592 * area. This differs between apps v1 and apps v2 due to the custom window 1594 * area. This differs between apps v1 and apps v2 due to the custom window
1593 * borders used by the latter. 1595 * borders used by the latter.
1594 * @private 1596 * @private
1595 */ 1597 */
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 * @param {Object} message The parsed extension message data. 1712 * @param {Object} message The parsed extension message data.
1711 * @return {boolean} True if the message was recognized, false otherwise. 1713 * @return {boolean} True if the message was recognized, false otherwise.
1712 */ 1714 */
1713 remoting.ClientSession.prototype.handleExtensionMessage = 1715 remoting.ClientSession.prototype.handleExtensionMessage =
1714 function(type, message) { 1716 function(type, message) {
1715 if (this.videoFrameRecorder_) { 1717 if (this.videoFrameRecorder_) {
1716 return this.videoFrameRecorder_.handleMessage(type, message); 1718 return this.videoFrameRecorder_.handleMessage(type, message);
1717 } 1719 }
1718 return false; 1720 return false;
1719 } 1721 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698