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

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

Issue 1093373005: [Webapp Refactor] Cleans up the ClientSession.EventHandler interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 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 }; 67 };
68 68
69 remoting.It2MeActivity.prototype.stop = function() { 69 remoting.It2MeActivity.prototype.stop = function() {
70 this.desktopActivity_.stop(); 70 this.desktopActivity_.stop();
71 }; 71 };
72 72
73 /** 73 /**
74 * @param {!remoting.Error} error 74 * @param {!remoting.Error} error
75 */ 75 */
76 remoting.It2MeActivity.prototype.onConnectionFailed = function(error) { 76 remoting.It2MeActivity.prototype.onConnectionFailed = function(error) {
77 this.onError(error); 77 this.showErrorMessage_(error);
78 base.dispose(this.desktopActivity_);
79 this.desktopActivity_ = null;
78 }; 80 };
79 81
80 /** 82 /**
81 * @param {!remoting.ConnectionInfo} connectionInfo 83 * @param {!remoting.ConnectionInfo} connectionInfo
82 */ 84 */
83 remoting.It2MeActivity.prototype.onConnected = function(connectionInfo) { 85 remoting.It2MeActivity.prototype.onConnected = function(connectionInfo) {
84 this.accessCodeDialog_.inputField().value = ''; 86 this.accessCodeDialog_.inputField().value = '';
85 }; 87 };
86 88
87 remoting.It2MeActivity.prototype.onDisconnected = function() { 89 remoting.It2MeActivity.prototype.onDisconnected = function(error) {
88 this.showFinishDialog_(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); 90 if (error.isNone()) {
91 this.showFinishDialog_(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME);
92 } else {
93 this.showErrorMessage_(error);
94 }
95
96 base.dispose(this.desktopActivity_);
97 this.desktopActivity_ = null;
89 }; 98 };
90 99
91 /** 100 /**
92 * @param {!remoting.Error} error 101 * @param {!remoting.Error} error
102 * @private
93 */ 103 */
94 remoting.It2MeActivity.prototype.onError = function(error) { 104 remoting.It2MeActivity.prototype.showErrorMessage_ = function(error) {
95 var errorDiv = document.getElementById('connect-error-message'); 105 var errorDiv = document.getElementById('connect-error-message');
96 l10n.localizeElementFromTag(errorDiv, error.getTag()); 106 l10n.localizeElementFromTag(errorDiv, error.getTag());
97 this.showFinishDialog_(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); 107 this.showFinishDialog_(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME);
98 }; 108 };
99 109
100 /** @return {remoting.DesktopRemotingActivity} */ 110 /** @return {remoting.DesktopRemotingActivity} */
101 remoting.It2MeActivity.prototype.getDesktopActivityForTesting = function() { 111 remoting.It2MeActivity.prototype.getDesktopActivityForTesting = function() {
102 return this.desktopActivity_; 112 return this.desktopActivity_;
103 }; 113 };
104 114
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 switch (error) { 210 switch (error) {
201 case 0: return new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE); 211 case 0: return new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE);
202 case 404: return new remoting.Error(remoting.Error.Tag.INVALID_ACCESS_CODE); 212 case 404: return new remoting.Error(remoting.Error.Tag.INVALID_ACCESS_CODE);
203 case 502: // No break 213 case 502: // No break
204 case 503: return new remoting.Error(remoting.Error.Tag.SERVICE_UNAVAILABLE); 214 case 503: return new remoting.Error(remoting.Error.Tag.SERVICE_UNAVAILABLE);
205 default: return remoting.Error.unexpected(); 215 default: return remoting.Error.unexpected();
206 } 216 }
207 } 217 }
208 218
209 })(); 219 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698