OLD | NEW |
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 Loading... |
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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
OLD | NEW |