OLD | NEW |
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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 (function() { | 10 (function() { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 * @param {string} username | 78 * @param {string} username |
79 * @param {string} authToken | 79 * @param {string} authToken |
80 */ | 80 */ |
81 remoting.DnsBlackholeChecker.prototype.connect = function(server, | 81 remoting.DnsBlackholeChecker.prototype.connect = function(server, |
82 username, | 82 username, |
83 authToken) { | 83 authToken) { |
84 base.debug.assert(this.onStateChangedCallback_ != null); | 84 base.debug.assert(this.onStateChangedCallback_ != null); |
85 | 85 |
86 this.signalStrategy_.connect(server, username, authToken); | 86 this.signalStrategy_.connect(server, username, authToken); |
87 | 87 |
88 this.xhr_ = | 88 this.xhr_ = remoting.xhr.start({ |
89 remoting.xhr.get(remoting.DnsBlackholeChecker.URL_TO_REQUEST_, | 89 method: 'GET', |
90 this.onHttpRequestDone_.bind(this)); | 90 url: remoting.DnsBlackholeChecker.URL_TO_REQUEST_, |
| 91 onDone: this.onHttpRequestDone_.bind(this) |
| 92 }); |
91 }; | 93 }; |
92 | 94 |
93 remoting.DnsBlackholeChecker.prototype.getState = function() { | 95 remoting.DnsBlackholeChecker.prototype.getState = function() { |
94 return this.state_; | 96 return this.state_; |
95 }; | 97 }; |
96 | 98 |
97 remoting.DnsBlackholeChecker.prototype.getError = function() { | 99 remoting.DnsBlackholeChecker.prototype.getError = function() { |
98 if (this.blackholeState_ == BlackholeState.BLOCKED) { | 100 if (this.blackholeState_ == BlackholeState.BLOCKED) { |
99 return remoting.Error.NOT_AUTHORIZED; | 101 return remoting.Error.NOT_AUTHORIZED; |
100 } | 102 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 * @private | 180 * @private |
179 */ | 181 */ |
180 remoting.DnsBlackholeChecker.prototype.setState_ = function(newState) { | 182 remoting.DnsBlackholeChecker.prototype.setState_ = function(newState) { |
181 if (this.state_ != newState) { | 183 if (this.state_ != newState) { |
182 this.state_ = newState; | 184 this.state_ = newState; |
183 this.onStateChangedCallback_(this.state_); | 185 this.onStateChangedCallback_(this.state_); |
184 } | 186 } |
185 }; | 187 }; |
186 | 188 |
187 }()); | 189 }()); |
OLD | NEW |