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

Unified Diff: remoting/webapp/client_session.js

Issue 469453003: Cleanup client plugin handling code in the webapp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_session.js
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index 3579b0d55327a22961752911e0d5bd42deeaa83d..d4c570845703086bb65374a97eb747aa5936b5e9 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -356,13 +356,6 @@ remoting.ClientSession.KEY_RESIZE_TO_CLIENT = 'resizeToClient';
remoting.ClientSession.KEY_SHRINK_TO_FIT = 'shrinkToFit';
/**
- * The id of the client plugin
- *
- * @const
- */
-remoting.ClientSession.prototype.PLUGIN_ID = 'session-client-plugin';
-
-/**
* Set of capabilities for which hasCapability_() can be used to test.
*
* @enum {string}
@@ -398,39 +391,6 @@ remoting.ClientSession.prototype.hasCapability_ = function(capability) {
};
/**
- * @param {string} id Id to use for the plugin element .
- * @param {function(string, string):boolean} onExtensionMessage The handler for
- * protocol extension messages. Returns true if a message is recognized;
- * false otherwise.
- * @return {remoting.ClientPlugin} Create plugin object for the locally
- * installed plugin.
- */
-remoting.ClientSession.prototype.createClientPlugin_ =
- function(id, onExtensionMessage) {
- var plugin = /** @type {remoting.ViewerPlugin} */
- document.createElement('embed');
-
- plugin.id = id;
- if (remoting.settings.CLIENT_PLUGIN_TYPE == 'pnacl') {
- plugin.src = 'remoting_client_pnacl.nmf';
- plugin.type = 'application/x-pnacl';
- } else if (remoting.settings.CLIENT_PLUGIN_TYPE == 'nacl') {
- plugin.src = 'remoting_client_nacl.nmf';
- plugin.type = 'application/x-nacl';
- } else {
- plugin.src = 'about://none';
- plugin.type = 'application/vnd.chromium.remoting-viewer';
- }
-
- plugin.width = 0;
- plugin.height = 0;
- plugin.tabIndex = 0; // Required, otherwise focus() doesn't work.
- this.container_.querySelector('.client-plugin-container').appendChild(plugin);
-
- return new remoting.ClientPlugin(plugin, onExtensionMessage);
-};
-
-/**
* Callback function called when the plugin element gets focus.
*/
remoting.ClientSession.prototype.pluginGotFocus_ = function() {
@@ -449,8 +409,7 @@ remoting.ClientSession.prototype.pluginLostFocus_ = function() {
// Due to crbug.com/246335, we can't restore the focus immediately,
// otherwise the plugin gets confused about whether or not it has focus.
window.setTimeout(
- this.plugin_.element().focus.bind(this.plugin_.element()),
- 0);
+ this.plugin_.element().focus.bind(this.plugin_.element()), 0);
}
}
};
@@ -464,7 +423,9 @@ remoting.ClientSession.prototype.pluginLostFocus_ = function() {
*/
remoting.ClientSession.prototype.createPluginAndConnect =
function(onExtensionMessage) {
- this.plugin_ = this.createClientPlugin_(this.PLUGIN_ID, onExtensionMessage);
+ this.plugin_ = new remoting.ClientPlugin(
+ this.container_.querySelector('.client-plugin-container'),
+ onExtensionMessage);
remoting.HostSettings.load(this.hostId_,
this.onHostSettingsLoaded_.bind(this));
};
@@ -515,7 +476,7 @@ remoting.ClientSession.prototype.setFocusHandlers_ = function() {
*/
remoting.ClientSession.prototype.resetWithError_ = function(error) {
this.plugin_.cleanup();
- delete this.plugin_;
+ this.plugin_ = null;
this.error_ = error;
this.setState_(remoting.ClientSession.State.FAILED);
}
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698