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

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

Issue 1004513002: Eliminated named constants for instances of remoting.Error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/it2me_connect_flow.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 this.state_ = this.sequence_[this.currentStep_]; 62 this.state_ = this.sequence_[this.currentStep_];
63 } else { 63 } else {
64 this.state_ = remoting.HostSetupFlow.State.NONE; 64 this.state_ = remoting.HostSetupFlow.State.NONE;
65 } 65 }
66 }; 66 };
67 67
68 /** 68 /**
69 * @param {!remoting.Error} error 69 * @param {!remoting.Error} error
70 */ 70 */
71 remoting.HostSetupFlow.prototype.switchToErrorState = function(error) { 71 remoting.HostSetupFlow.prototype.switchToErrorState = function(error) {
72 if (error.tag == remoting.Error.Tag.CANCELLED) { 72 if (error.hasTag(remoting.Error.Tag.CANCELLED)) {
73 // Stop the setup flow if user rejected one of the actions. 73 // Stop the setup flow if user rejected one of the actions.
74 this.state_ = remoting.HostSetupFlow.State.NONE; 74 this.state_ = remoting.HostSetupFlow.State.NONE;
75 } else { 75 } else {
76 // Current step failed, so switch to corresponding error state. 76 // Current step failed, so switch to corresponding error state.
77 if (this.state_ == remoting.HostSetupFlow.State.STARTING_HOST) { 77 if (this.state_ == remoting.HostSetupFlow.State.STARTING_HOST) {
78 if (error.tag == remoting.Error.Tag.REGISTRATION_FAILED) { 78 if (error.hasTag(remoting.Error.Tag.REGISTRATION_FAILED)) {
79 this.state_ = remoting.HostSetupFlow.State.REGISTRATION_FAILED; 79 this.state_ = remoting.HostSetupFlow.State.REGISTRATION_FAILED;
80 } else { 80 } else {
81 this.state_ = remoting.HostSetupFlow.State.START_HOST_FAILED; 81 this.state_ = remoting.HostSetupFlow.State.START_HOST_FAILED;
82 } 82 }
83 } else if (this.state_ == remoting.HostSetupFlow.State.UPDATING_PIN) { 83 } else if (this.state_ == remoting.HostSetupFlow.State.UPDATING_PIN) {
84 this.state_ = remoting.HostSetupFlow.State.UPDATE_PIN_FAILED; 84 this.state_ = remoting.HostSetupFlow.State.UPDATE_PIN_FAILED;
85 } else if (this.state_ == remoting.HostSetupFlow.State.STOPPING_HOST) { 85 } else if (this.state_ == remoting.HostSetupFlow.State.STOPPING_HOST) {
86 this.state_ = remoting.HostSetupFlow.State.STOP_HOST_FAILED; 86 this.state_ = remoting.HostSetupFlow.State.STOP_HOST_FAILED;
87 } else { 87 } else {
88 // TODO(sergeyu): Add other error states and use them here. 88 // TODO(sergeyu): Add other error states and use them here.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (set_by_policy) { 202 if (set_by_policy) {
203 that.usageStats_.title = l10n.getTranslationOrError( 203 that.usageStats_.title = l10n.getTranslationOrError(
204 /*i18n-content*/ 'SETTING_MANAGED_BY_POLICY'); 204 /*i18n-content*/ 'SETTING_MANAGED_BY_POLICY');
205 } else { 205 } else {
206 that.usageStats_.title = ''; 206 that.usageStats_.title = '';
207 } 207 }
208 } 208 }
209 209
210 /** @param {!remoting.Error} error */ 210 /** @param {!remoting.Error} error */
211 function onError(error) { 211 function onError(error) {
212 console.error('Error getting consent status: ' + error); 212 console.error('Error getting consent status: ' + error.toString());
213 } 213 }
214 214
215 this.usageStats_.hidden = true; 215 this.usageStats_.hidden = true;
216 this.usageStatsCheckbox_.checked = false; 216 this.usageStatsCheckbox_.checked = false;
217 217
218 // Prevent user from ticking the box until the current consent status is 218 // Prevent user from ticking the box until the current consent status is
219 // known. 219 // known.
220 this.usageStatsCheckbox_.disabled = true; 220 this.usageStatsCheckbox_.disabled = true;
221 221
222 this.hostController_.getConsent(onGetConsent, onError); 222 this.hostController_.getConsent(onGetConsent, onError);
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 var c = pin.charAt(i); 562 var c = pin.charAt(i);
563 if ((c < '0') || (c > '9')) { 563 if ((c < '0') || (c > '9')) {
564 return false; 564 return false;
565 } 565 }
566 } 566 }
567 return true; 567 return true;
568 }; 568 };
569 569
570 /** @type {remoting.HostSetupDialog} */ 570 /** @type {remoting.HostSetupDialog} */
571 remoting.hostSetupDialog = null; 571 remoting.hostSetupDialog = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/it2me_connect_flow.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698