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

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

Issue 1272833002: Pass error messages from native messaging to web-app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer feedback. Created 5 years, 4 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 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 It2me Host component via Native Messaging. 7 * Class to communicate with the It2me Host component via Native Messaging.
8 */ 8 */
9 9
10 /** @suppress {duplicate} */ 10 /** @suppress {duplicate} */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 * missing required attributes, attributes with incorrect types, etc. 54 * missing required attributes, attributes with incorrect types, etc.
55 * @private {?function(!remoting.Error):void} 55 * @private {?function(!remoting.Error):void}
56 */ 56 */
57 this.onError_ = function(error) {}; 57 this.onError_ = function(error) {};
58 58
59 /** @private {?function(remoting.HostSession.State):void} */ 59 /** @private {?function(remoting.HostSession.State):void} */
60 this.onStateChanged_ = function() {}; 60 this.onStateChanged_ = function() {};
61 61
62 /** @private {?function(boolean):void} */ 62 /** @private {?function(boolean):void} */
63 this.onNatPolicyChanged_ = function() {}; 63 this.onNatPolicyChanged_ = function() {};
64
65 /** @private */
66 this.debugMessageHandler_ =
67 new remoting.NativeMessageHostDebugMessageHandler();
68
64 }; 69 };
65 70
66 remoting.It2MeHostFacade.prototype.dispose = function() { 71 remoting.It2MeHostFacade.prototype.dispose = function() {
67 base.dispose(this.eventHooks_); 72 base.dispose(this.eventHooks_);
68 this.eventHooks_ = null; 73 this.eventHooks_ = null;
69 if (this.port_) { 74 if (this.port_) {
70 this.port_.disconnect(); 75 this.port_.disconnect();
71 this.port_ = null; 76 this.port_ = null;
72 } 77 }
73 }; 78 };
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 206
202 /** 207 /**
203 * Handler for incoming messages. 208 * Handler for incoming messages.
204 * 209 *
205 * @param {Object} message The received message. 210 * @param {Object} message The received message.
206 * @return {void} 211 * @return {void}
207 * @private 212 * @private
208 */ 213 */
209 remoting.It2MeHostFacade.prototype.onIncomingMessage_ = 214 remoting.It2MeHostFacade.prototype.onIncomingMessage_ =
210 function(message) { 215 function(message) {
216 if (this.debugMessageHandler_.handleMessage(message)) {
217 return;
218 }
219
211 var type = base.getStringAttr(message, 'type'); 220 var type = base.getStringAttr(message, 'type');
212 221
213 switch (type) { 222 switch (type) {
214 case 'helloResponse': 223 case 'helloResponse':
215 var version = base.getStringAttr(message, 'version'); 224 var version = base.getStringAttr(message, 'version');
216 console.log('Host version: ', version); 225 console.log('Host version: ', version);
217 this.initialized_ = true; 226 this.initialized_ = true;
218 // A "hello" request is sent immediately after the native messaging host 227 // A "hello" request is sent immediately after the native messaging host
219 // is started. We can proceed to the next task once we receive the 228 // is started. We can proceed to the next task once we receive the
220 // "helloReponse". 229 // "helloReponse".
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 chrome.runtime.lastError.message); 325 chrome.runtime.lastError.message);
317 this.onInitializationFailed_(); 326 this.onInitializationFailed_();
318 } else { 327 } else {
319 console.error('Native Messaging port disconnected.'); 328 console.error('Native Messaging port disconnected.');
320 this.port_ = null; 329 this.port_ = null;
321 this.onError_(remoting.Error.unexpected()); 330 this.onError_(remoting.Error.unexpected());
322 } 331 }
323 }; 332 };
324 333
325 })(); 334 })();
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_daemon_facade.js ('k') | remoting/webapp/crd/js/native_message_host_log_message_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698