summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 17:57:34 +0000
committersimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 17:57:34 +0000
commit15d65b2086c56e1eb4772d8fb552f9df0da1138c (patch)
tree717602af162b351942c8550a048a757beb20461c /remoting
parent6761d6332edf7050a7686c0d98709e8ce6f6d2c7 (diff)
downloadchromium_src-15d65b2086c56e1eb4772d8fb552f9df0da1138c.zip
chromium_src-15d65b2086c56e1eb4772d8fb552f9df0da1138c.tar.gz
chromium_src-15d65b2086c56e1eb4772d8fb552f9df0da1138c.tar.bz2
[Chromoting] Show an error message if the client plugin is disabled.
BUG=123852 Review URL: https://chromiumcodereview.appspot.com/10114014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/webapp/_locales/en/messages.json12
-rw-r--r--remoting/webapp/client_plugin.js7
-rw-r--r--remoting/webapp/client_plugin_async.js7
-rw-r--r--remoting/webapp/client_plugin_v1.js7
-rw-r--r--remoting/webapp/client_screen.js4
-rw-r--r--remoting/webapp/client_session.js8
-rw-r--r--remoting/webapp/remoting.js3
-rw-r--r--remoting/webapp/server_log_entry.js2
8 files changed, 47 insertions, 3 deletions
diff --git a/remoting/webapp/_locales/en/messages.json b/remoting/webapp/_locales/en/messages.json
index ea2488d..3082231 100644
--- a/remoting/webapp/_locales/en/messages.json
+++ b/remoting/webapp/_locales/en/messages.json
@@ -166,6 +166,18 @@
"message": "The server failed to respond to the network request.",
"description": "Error displayed by the client if the server does not respond to a network request."
},
+ "ERROR_PLUGIN_DISABLED": {
+ "message": "The Chromoting client plugin is disabled. Please check $urlStart$plugin settings$urlEnd$.",
+ "description": "Error displayed by the client if the client plugin is disabled.",
+ "placeholders": {
+ "urlStart": {
+ "content": "<a href='#' onclick='chrome.tabs.create({url:\"chrome://plugins\"});'>"
+ },
+ "urlEnd": {
+ "content": "</a>"
+ }
+ }
+ },
"ERROR_SERVICE_UNAVAILABLE": {
"message": "The service is temporarily unavailable. Please try again later.",
"description": "Error displayed when the service returns a 503 error. Such errors are usually temporary, and resolve themselves in about 30 seconds."
diff --git a/remoting/webapp/client_plugin.js b/remoting/webapp/client_plugin.js
index 24054a6..fa73870b 100644
--- a/remoting/webapp/client_plugin.js
+++ b/remoting/webapp/client_plugin.js
@@ -60,7 +60,7 @@ remoting.ClientPlugin.Feature = {
remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
/**
- * @return {Element} HTML element that correspods to the plugin.
+ * @return {Element} HTML element that corresponds to the plugin.
*/
remoting.ClientPlugin.prototype.element = function() {};
@@ -134,3 +134,8 @@ remoting.ClientPlugin.prototype.getPerfStats = function() {};
* @param {string} item The clipboard item.
*/
remoting.ClientPlugin.prototype.sendClipboardItem = function(mimeType, item) {};
+
+/**
+ * @return {boolean} Whether the plugin is enabled.
+ */
+remoting.ClientPlugin.prototype.isEnabled = function() {};
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index 183b836..b004bb4 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -356,3 +356,10 @@ remoting.ClientPluginAsync.prototype.sendClipboardItem =
{ method: 'sendClipboardItem',
data: { mimeType: mimeType, item: item }}));
};
+
+/**
+ * @return {boolean} Whether the plugin is enabled.
+ */
+remoting.ClientPluginAsync.prototype.isEnabled = function() {
+ return (this.plugin.postMessage != undefined);
+} \ No newline at end of file
diff --git a/remoting/webapp/client_plugin_v1.js b/remoting/webapp/client_plugin_v1.js
index e67887b..025eab6 100644
--- a/remoting/webapp/client_plugin_v1.js
+++ b/remoting/webapp/client_plugin_v1.js
@@ -260,3 +260,10 @@ remoting.ClientPluginV1.prototype.remapKey =
function(fromKeycode, toKeycode) {
return;
};
+
+/**
+ * @return {boolean} Whether the plugin is enabled.
+ */
+remoting.ClientPluginV1.prototype.isEnabled = function() {
+ return true;
+};
diff --git a/remoting/webapp/client_screen.js b/remoting/webapp/client_screen.js
index 8be30fb..9eb6884 100644
--- a/remoting/webapp/client_screen.js
+++ b/remoting/webapp/client_screen.js
@@ -193,7 +193,9 @@ function onClientStateChange_(oldState, newState) {
// automatically retry.
var clearPin = false;
- if (newState == remoting.ClientSession.State.CREATED) {
+ if (newState == remoting.ClientSession.State.PLUGIN_DISABLED) {
+ showConnectError_(remoting.Error.PLUGIN_DISABLED);
+ } else if (newState == remoting.ClientSession.State.CREATED) {
console.log('Created plugin');
} else if (newState == remoting.ClientSession.State.BAD_PLUGIN_VERSION) {
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index 8fab461..07b4e33 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -96,6 +96,7 @@ remoting.ClientSession = function(hostJid, hostPublicKey, sharedSecret,
// no corresponding plugin state transition.
/** @enum {number} */
remoting.ClientSession.State = {
+ PLUGIN_DISABLED: -4,
CREATED: -3,
BAD_PLUGIN_VERSION: -2,
UNKNOWN_PLUGIN_ERROR: -1,
@@ -242,6 +243,13 @@ remoting.ClientSession.prototype.createPluginAndConnect =
function(container, oauth2AccessToken) {
this.plugin = this.createClientPlugin_(container, this.PLUGIN_ID);
+ if (!this.plugin.isEnabled()) {
+ this.plugin.cleanup();
+ delete this.plugin;
+ this.setState_(remoting.ClientSession.State.PLUGIN_DISABLED);
+ return;
+ }
+
this.plugin.element().focus();
/** @type {remoting.ClientSession} */
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index e7836c8..79880ea 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -24,7 +24,8 @@ remoting.Error = {
HOST_OVERLOAD: /*i18n-content*/'ERROR_HOST_OVERLOAD',
GENERIC: /*i18n-content*/'ERROR_GENERIC',
UNEXPECTED: /*i18n-content*/'ERROR_UNEXPECTED',
- SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE'
+ SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE',
+ PLUGIN_DISABLED: /*i18n-content*/'ERROR_PLUGIN_DISABLED'
};
/**
diff --git a/remoting/webapp/server_log_entry.js b/remoting/webapp/server_log_entry.js
index 9cad50b..eb2e255 100644
--- a/remoting/webapp/server_log_entry.js
+++ b/remoting/webapp/server_log_entry.js
@@ -62,6 +62,8 @@ remoting.ServerLogEntry.getValueForSessionState = function(state) {
return 'closed';
case remoting.ClientSession.State.FAILED:
return 'connection-failed';
+ case remoting.ClientSession.State.PLUGIN_DISABLED:
+ return 'plugin-disabled';
default:
return 'undefined-' + state;
}