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

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

Issue 1765643003: Load host settings in connect_ to ensure they are valid for every connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** @suppress {duplicate} */ 5 /** @suppress {duplicate} */
6 var remoting = remoting || {}; 6 var remoting = remoting || {};
7 7
8 (function() { 8 (function() {
9 9
10 'use strict'; 10 'use strict';
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 remoting.setMode(remoting.AppMode.HOME); 67 remoting.setMode(remoting.AppMode.HOME);
68 that.logger_.logSessionStateChange( 68 that.logger_.logSessionStateChange(
69 Event.SessionState.CONNECTION_CANCELED); 69 Event.SessionState.CONNECTION_CANCELED);
70 } else { 70 } else {
71 that.logger_.logSessionStateChange( 71 that.logger_.logSessionStateChange(
72 Event.SessionState.CONNECTION_FAILED, error); 72 Event.SessionState.CONNECTION_FAILED, error);
73 that.showErrorMessage_(error); 73 that.showErrorMessage_(error);
74 } 74 }
75 } 75 }
76 76
77 this.hostUpdateDialog_.showIfNecessary(webappVersion).then(function() { 77 this.hostUpdateDialog_.showIfNecessary(webappVersion).catch(
78 return that.host_.options.load(); 78 remoting.Error.handler(function(/** remoting.Error */ error) {
79 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { 79 // User cancels the Host upgrade dialog. Report it as bad version.
80 // User cancels out of the Host upgrade dialog. Report it as bad version. 80 throw new remoting.Error(remoting.Error.Tag.BAD_VERSION);
81 throw new remoting.Error(remoting.Error.Tag.BAD_VERSION);
82 })).then( 81 })).then(
83 this.gnubbyAuthHandler_.isGnubbyExtensionInstalled.bind( 82 this.gnubbyAuthHandler_.isGnubbyExtensionInstalled.bind(
84 this.gnubbyAuthHandler_) 83 this.gnubbyAuthHandler_)
85 ).then( 84 ).then(
86 function (extensionInstalled) { 85 function (extensionInstalled) {
87 if (extensionInstalled) { 86 if (extensionInstalled) {
88 this.additionalCapabilities_.push( 87 this.additionalCapabilities_.push(
89 remoting.ClientSession.Capability.SECURITY_KEY); 88 remoting.ClientSession.Capability.SECURITY_KEY);
90 } 89 }
91 }.bind(this) 90 }.bind(this)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 /** 137 /**
139 * @private 138 * @private
140 */ 139 */
141 remoting.Me2MeActivity.prototype.connect_ = function() { 140 remoting.Me2MeActivity.prototype.connect_ = function() {
142 base.dispose(this.desktopActivity_); 141 base.dispose(this.desktopActivity_);
143 142
144 this.desktopActivity_ = new remoting.DesktopRemotingActivity( 143 this.desktopActivity_ = new remoting.DesktopRemotingActivity(
145 this, this.logger_, this.additionalCapabilities_); 144 this, this.logger_, this.additionalCapabilities_);
146 this.desktopActivity_.getConnectingDialog().show(); 145 this.desktopActivity_.getConnectingDialog().show();
147 this.desktopActivity_.start(this.host_, this.createCredentialsProvider_()); 146 this.host_.options.load().then(
147 function() {
148 this.desktopActivity_.start(this.host_,
149 this.createCredentialsProvider_());
150 }.bind(this));
148 }; 151 };
149 152
150 /** 153 /**
151 * @return {remoting.CredentialsProvider} 154 * @return {remoting.CredentialsProvider}
152 * @private 155 * @private
153 */ 156 */
154 remoting.Me2MeActivity.prototype.createCredentialsProvider_ = function() { 157 remoting.Me2MeActivity.prototype.createCredentialsProvider_ = function() {
155 var host = this.host_; 158 var host = this.host_;
156 var that = this; 159 var that = this;
157 160
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 remoting.Me2MeActivity.prototype.reconnectOnHostOffline_ = function(error) { 207 remoting.Me2MeActivity.prototype.reconnectOnHostOffline_ = function(error) {
205 var that = this; 208 var that = this;
206 var onHostListRefresh = function() { 209 var onHostListRefresh = function() {
207 var host = that.hostList_.getHostForId(that.host_.hostId); 210 var host = that.hostList_.getHostForId(that.host_.hostId);
208 var SessionEntryPoint = remoting.ChromotingEvent.SessionEntryPoint; 211 var SessionEntryPoint = remoting.ChromotingEvent.SessionEntryPoint;
209 212
210 // Reconnect if the host's JID changes. 213 // Reconnect if the host's JID changes.
211 if (Boolean(host) && 214 if (Boolean(host) &&
212 host.jabberId != that.host_.jabberId && 215 host.jabberId != that.host_.jabberId &&
213 host.status == 'ONLINE') { 216 host.status == 'ONLINE') {
214 that.host_ = host; 217 that.host_ = host;
Jamie 2016/03/04 19:46:24 This is the offending line. An alternative fix wou
215 that.reconnect_(SessionEntryPoint.AUTO_RECONNECT_ON_HOST_OFFLINE); 218 that.reconnect_(SessionEntryPoint.AUTO_RECONNECT_ON_HOST_OFFLINE);
216 return; 219 return;
217 } 220 }
218 that.showErrorMessage_(error); 221 that.showErrorMessage_(error);
219 }; 222 };
220 223
221 this.retryOnHostOffline_ = false; 224 this.retryOnHostOffline_ = false;
222 // The plugin will be re-created when the host list has been refreshed. 225 // The plugin will be re-created when the host list has been refreshed.
223 this.hostList_.refreshAndDisplay().then( 226 this.hostList_.refreshAndDisplay().then(
224 onHostListRefresh 227 onHostListRefresh
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 }; 475 };
473 476
474 remoting.AutoReconnector.prototype.dispose = function() { 477 remoting.AutoReconnector.prototype.dispose = function() {
475 base.dispose(this.networkDetector_); 478 base.dispose(this.networkDetector_);
476 this.networkDetector_ = null; 479 this.networkDetector_ = null;
477 this.reconnectCallback_ = null; 480 this.reconnectCallback_ = null;
478 this.connectingDialog_.hide(); 481 this.connectingDialog_.hide();
479 }; 482 };
480 483
481 })(); 484 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698