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

Unified Diff: remoting/webapp/host_dispatcher.js

Issue 17465007: Remoting webapp: Add onError param to HostNativeMessaging.initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/host_native_messaging.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_dispatcher.js
diff --git a/remoting/webapp/host_dispatcher.js b/remoting/webapp/host_dispatcher.js
index 7b81c0e71066fce7c31aa2bc698ce112b26b0e79..7e58501319c2f80fa71a8954d21ede18511a9858 100644
--- a/remoting/webapp/host_dispatcher.js
+++ b/remoting/webapp/host_dispatcher.js
@@ -43,24 +43,28 @@ remoting.HostDispatcher = function(createPluginCallback) {
/** @type {Array.<function()>} */
this.pendingRequests_ = [];
- /** @param {boolean} success */
- var onNativeMessagingInit = function(success) {
- if (success) {
- console.log('Native Messaging supported.');
- that.state_ = remoting.HostDispatcher.State.NATIVE_MESSAGING;
- } else {
- console.log('Native Messaging unsupported, falling back to NPAPI.');
- that.npapiHost_ = createPluginCallback();
- that.state_ = remoting.HostDispatcher.State.NPAPI;
- }
- // Send pending requests.
+ function sendPendingRequests() {
for (var i = 0; i < that.pendingRequests_.length; i++) {
that.pendingRequests_[i]();
}
that.pendingRequests_ = null;
- };
+ }
+
+ function onNativeMessagingInit() {
+ console.log('Native Messaging supported.');
+ that.state_ = remoting.HostDispatcher.State.NATIVE_MESSAGING;
+ sendPendingRequests();
+ }
+
+ function onNativeMessagingFailed(error) {
+ console.log('Native Messaging unsupported, falling back to NPAPI.');
+ that.npapiHost_ = createPluginCallback();
+ that.state_ = remoting.HostDispatcher.State.NPAPI;
+ sendPendingRequests();
+ }
- this.nativeMessagingHost_.initialize(onNativeMessagingInit);
+ this.nativeMessagingHost_.initialize(onNativeMessagingInit,
+ onNativeMessagingFailed);
};
/** @enum {number} */
« no previous file with comments | « no previous file | remoting/webapp/host_native_messaging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698