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

Side by Side Diff: remoting/webapp/crd/js/host_daemon_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
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/crd/js/it2me_host_facade.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 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 /** @private {!remoting.Error} */ 44 /** @private {!remoting.Error} */
45 this.error_ = remoting.Error.none(); 45 this.error_ = remoting.Error.none();
46 46
47 /** @private */ 47 /** @private */
48 this.onIncomingMessageCallback_ = this.onIncomingMessage_.bind(this); 48 this.onIncomingMessageCallback_ = this.onIncomingMessage_.bind(this);
49 49
50 /** @private */ 50 /** @private */
51 this.onDisconnectCallback_ = this.onDisconnect_.bind(this); 51 this.onDisconnectCallback_ = this.onDisconnect_.bind(this);
52 52
53 /** @private */
54 this.debugMessageHandler_ =
55 new remoting.NativeMessageHostDebugMessageHandler();
56
53 this.initialize_(); 57 this.initialize_();
54 }; 58 };
55 59
56 /** 60 /**
57 * @return {Promise} A promise that fulfills when the daemon finishes 61 * @return {Promise} A promise that fulfills when the daemon finishes
58 * initializing 62 * initializing
59 * @private 63 * @private
60 */ 64 */
61 remoting.HostDaemonFacade.prototype.initialize_ = function() { 65 remoting.HostDaemonFacade.prototype.initialize_ = function() {
62 if (!this.initializingPromise_) { 66 if (!this.initializingPromise_) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 }; 177 };
174 178
175 /** 179 /**
176 * Handler for incoming Native Messages. 180 * Handler for incoming Native Messages.
177 * 181 *
178 * @param {Object} message The received message. 182 * @param {Object} message The received message.
179 * @return {void} Nothing. 183 * @return {void} Nothing.
180 * @private 184 * @private
181 */ 185 */
182 remoting.HostDaemonFacade.prototype.onIncomingMessage_ = function(message) { 186 remoting.HostDaemonFacade.prototype.onIncomingMessage_ = function(message) {
187 if (this.debugMessageHandler_.handleMessage(message)) {
188 return;
189 }
190
183 /** @type {number} */ 191 /** @type {number} */
184 var id = message['id']; 192 var id = message['id'];
185 if (typeof(id) != 'number') { 193 if (typeof(id) != 'number') {
186 console.error('NativeMessaging: missing or non-numeric id'); 194 console.error('NativeMessaging: missing or non-numeric id');
187 return; 195 return;
188 } 196 }
189 var reply = this.pendingReplies_[id]; 197 var reply = this.pendingReplies_[id];
190 if (!reply) { 198 if (!reply) {
191 console.error('NativeMessaging: unexpected id: ', id); 199 console.error('NativeMessaging: unexpected id: ', id);
192 return; 200 return;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 authorizationCode: authorizationCode 486 authorizationCode: authorizationCode
479 }).then(function(reply) { 487 }).then(function(reply) {
480 var refreshToken = base.getStringAttr(reply, 'refreshToken'); 488 var refreshToken = base.getStringAttr(reply, 'refreshToken');
481 if (refreshToken) { 489 if (refreshToken) {
482 return refreshToken 490 return refreshToken
483 } else { 491 } else {
484 throw remoting.Error.unexpected('Missing refreshToken'); 492 throw remoting.Error.unexpected('Missing refreshToken');
485 } 493 }
486 }); 494 });
487 }; 495 };
OLDNEW
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/crd/js/it2me_host_facade.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698