OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class to communicate with the host daemon via Native Messaging. | 7 * Class to communicate with the host daemon via Native Messaging. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 var reply = this.pendingReplies_[id]; | 194 var reply = this.pendingReplies_[id]; |
195 if (!reply) { | 195 if (!reply) { |
196 console.error('NativeMessaging: unexpected id: ', id); | 196 console.error('NativeMessaging: unexpected id: ', id); |
197 return; | 197 return; |
198 } | 198 } |
199 delete this.pendingReplies_[id]; | 199 delete this.pendingReplies_[id]; |
200 | 200 |
201 try { | 201 try { |
202 var type = base.getStringAttr(message, 'type'); | 202 var type = base.getStringAttr(message, 'type'); |
203 if (type != reply.type) { | 203 if (type != reply.type) { |
204 throw 'Expected reply type: ' + reply.type + ', got: ' + type; | 204 throw 'Expected reply type: ' + |
205 reply.type + ', got: ' + type; | |
Jamie
2015/04/07 01:13:12
No need for this change.
| |
205 } | 206 } |
206 | 207 |
207 this.handleIncomingMessage_(message, reply.onDone); | 208 this.handleIncomingMessage_(message, reply.onDone); |
208 } catch (/** @type {*} */ e) { | 209 } catch (/** @type {*} */ e) { |
209 console.error('Error while processing native message', e); | 210 console.error('Error while processing native message', e); |
210 reply.onError(remoting.Error.unexpected()); | 211 reply.onError(remoting.Error.unexpected()); |
211 } | 212 } |
212 } | 213 } |
213 | 214 |
214 /** | 215 /** |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 * @param {function(!remoting.Error):void} onError Callback to call on error. | 554 * @param {function(!remoting.Error):void} onError Callback to call on error. |
554 * @return {void} Nothing. | 555 * @return {void} Nothing. |
555 */ | 556 */ |
556 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = | 557 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = |
557 function(authorizationCode, onDone, onError) { | 558 function(authorizationCode, onDone, onError) { |
558 this.postMessage_({ | 559 this.postMessage_({ |
559 type: 'getCredentialsFromAuthCode', | 560 type: 'getCredentialsFromAuthCode', |
560 authorizationCode: authorizationCode | 561 authorizationCode: authorizationCode |
561 }, onDone, onError); | 562 }, onDone, onError); |
562 }; | 563 }; |
OLD | NEW |