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

Unified Diff: remoting/webapp/host_native_messaging.js

Issue 151883005: Revert 248271 "Add a minimum required version to the webapp mani..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1817/src/
Patch Set: Created 6 years, 11 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/appsv2.patch ('k') | remoting/webapp/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_native_messaging.js
===================================================================
--- remoting/webapp/host_native_messaging.js (revision 248343)
+++ remoting/webapp/host_native_messaging.js (working copy)
@@ -56,8 +56,8 @@
/**
* Sets up connection to the Native Messaging host process and exchanges
- * 'hello' messages. Invokes onDone on success and onError on failure (the
- * native messaging host is probably not installed).
+ * 'hello' messages. If Native Messaging is not available or the host
+ * process is not installed, this returns false to the callback.
*
* @param {function(): void} onDone Called after successful initialization.
* @param {function(remoting.Error): void} onError Called if initialization
@@ -65,6 +65,22 @@
* @return {void} Nothing.
*/
remoting.HostNativeMessaging.prototype.initialize = function(onDone, onError) {
+ if (!chrome.runtime.connectNative) {
+ console.log('Native Messaging API not available');
+ onError(remoting.Error.UNEXPECTED);
+ return;
+ }
+
+ // NativeMessaging API exists on Chrome 26.xxx but fails to notify
+ // onDisconnect in the case where the Host components are not installed. Need
+ // to blacklist these versions of Chrome.
+ var majorVersion = navigator.appVersion.match('Chrome/(\\d+)\.')[1];
+ if (!majorVersion || majorVersion <= 26) {
+ console.log('Native Messaging not supported on this version of Chrome');
+ onError(remoting.Error.UNEXPECTED);
+ return;
+ }
+
try {
this.port_ = chrome.runtime.connectNative(
'com.google.chrome.remote_desktop');
« no previous file with comments | « remoting/webapp/appsv2.patch ('k') | remoting/webapp/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698