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

Unified Diff: remoting/webapp/host_native_messaging.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 | « remoting/webapp/host_dispatcher.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_native_messaging.js
diff --git a/remoting/webapp/host_native_messaging.js b/remoting/webapp/host_native_messaging.js
index fd6372c3e7a713eb6eec866a76fe080beb90f5f7..3da45c3666d55518de1f462de3722980567b2624 100644
--- a/remoting/webapp/host_native_messaging.js
+++ b/remoting/webapp/host_native_messaging.js
@@ -56,14 +56,15 @@ remoting.HostNativeMessaging.PendingReply = function(type, callback, onError) {
* 'hello' messages. If Native Messaging is not available or the host
* process is not installed, this returns false to the callback.
*
- * @param {function(boolean): void} onDone Called with the result of
- * initialization.
+ * @param {function(): void} onDone Called after successful initialization.
+ * @param {function(remoting.Error): void} onError Called if initialization
+ * failed.
* @return {void} Nothing.
*/
-remoting.HostNativeMessaging.prototype.initialize = function(onDone) {
+remoting.HostNativeMessaging.prototype.initialize = function(onDone, onError) {
if (!chrome.runtime.connectNative) {
console.log('Native Messaging API not available');
- onDone(false);
+ onError(remoting.Error.UNEXPECTED);
return;
}
@@ -73,7 +74,7 @@ remoting.HostNativeMessaging.prototype.initialize = function(onDone) {
var majorVersion = navigator.appVersion.match('Chrome/(\\d+)\.')[1];
if (!majorVersion || majorVersion <= 26) {
console.log('Native Messaging not supported on this version of Chrome');
- onDone(false);
+ onError(remoting.Error.UNEXPECTED);
return;
}
@@ -82,12 +83,12 @@ remoting.HostNativeMessaging.prototype.initialize = function(onDone) {
'com.google.chrome.remote_desktop');
this.port_.onMessage.addListener(this.onIncomingMessage_.bind(this));
this.port_.onDisconnect.addListener(this.onDisconnect_.bind(this));
- this.postMessage_({type: 'hello'}, onDone.bind(null, true),
- onDone.bind(null, false));
+ this.postMessage_({type: 'hello'}, onDone,
+ onError.bind(null, remoting.Error.UNEXPECTED));
} catch (err) {
console.log('Native Messaging initialization failed: ',
/** @type {*} */ (err));
- onDone(false);
+ onError(remoting.Error.UNEXPECTED);
return;
}
};
« no previous file with comments | « remoting/webapp/host_dispatcher.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698