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

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: fixed bad merge 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 /** @type {remoting.ClientSession} */ 771 /** @type {remoting.ClientSession} */
772 var that = this; 772 var that = this;
773 773
774 /** @param {string} token */ 774 /** @param {string} token */
775 var sendToken = function(token) { 775 var sendToken = function(token) {
776 remoting.clientSession.sendClientMessage('accessToken', token); 776 remoting.clientSession.sendClientMessage('accessToken', token);
777 }; 777 };
778 /** @param {remoting.Error} error */ 778 /** @param {remoting.Error} error */
779 var sendError = function(error) { 779 var sendError = function(error) {
780 console.log('Failed to refresh access token: ' + error); 780 console.log('Failed to refresh access token: ' + error);
781 } 781 };
782 remoting.identity.callWithNewToken(sendToken, sendError); 782 remoting.identity.getNewToken().
783 then(sendToken).
784 catch(remoting.Error.handler(sendError));
783 window.setTimeout(this.sendGoogleDriveAccessToken_.bind(this), 785 window.setTimeout(this.sendGoogleDriveAccessToken_.bind(this),
784 remoting.ACCESS_TOKEN_RESEND_INTERVAL_MS); 786 remoting.ACCESS_TOKEN_RESEND_INTERVAL_MS);
785 }; 787 };
786 788
787 /** 789 /**
788 * Send a Cast extension message to the host. 790 * Send a Cast extension message to the host.
789 * @param {Object} data The cast message data. 791 * @param {Object} data The cast message data.
790 */ 792 */
791 remoting.ClientSession.prototype.sendCastExtensionMessage = function(data) { 793 remoting.ClientSession.prototype.sendCastExtensionMessage = function(data) {
792 if (!this.plugin_) 794 if (!this.plugin_)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 * @param {boolean} enable True to enable rendering. 844 * @param {boolean} enable True to enable rendering.
843 */ 845 */
844 remoting.ClientSession.prototype.enableDebugRegion = function(enable) { 846 remoting.ClientSession.prototype.enableDebugRegion = function(enable) {
845 if (enable) { 847 if (enable) {
846 this.plugin_.setDebugDirtyRegionHandler( 848 this.plugin_.setDebugDirtyRegionHandler(
847 this.uiHandler_.handleDebugRegion.bind(this.uiHandler_)); 849 this.uiHandler_.handleDebugRegion.bind(this.uiHandler_));
848 } else { 850 } else {
849 this.plugin_.setDebugDirtyRegionHandler(null); 851 this.plugin_.setDebugDirtyRegionHandler(null);
850 } 852 }
851 } 853 }
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/apps_v2_migration.js ('k') | remoting/webapp/crd/js/crd_event_handlers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698