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

Unified Diff: remoting/webapp/app_remoting/js/app_remoting.js

Issue 1016623002: [Webapp Refactor] Reparent the ConnectedView into the delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Please diff this patch against patch set 1 Created 5 years, 9 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/base/js/application.js » ('j') | remoting/webapp/crd/js/client_session.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/app_remoting/js/app_remoting.js
diff --git a/remoting/webapp/app_remoting/js/app_remoting.js b/remoting/webapp/app_remoting/js/app_remoting.js
index 80bb442749cf84ba9d1e4be77b2178679ab7d39a..7bc2799c422659a3314de154b30355400dbc8f2b 100644
--- a/remoting/webapp/app_remoting/js/app_remoting.js
+++ b/remoting/webapp/app_remoting/js/app_remoting.js
@@ -17,6 +17,7 @@ var remoting = remoting || {};
* @param {remoting.Application} app The main app that owns this delegate.
* @constructor
* @implements {remoting.Application.Delegate}
+ * @implements {remoting.ProtocolExtension}
*/
remoting.AppRemoting = function(app) {
app.setDelegate(this);
@@ -30,8 +31,11 @@ remoting.AppRemoting = function(app) {
/** @private {remoting.WindowActivationMenu} */
this.windowActivationMenu_ = null;
- /** @private {base.RepeatingTimer} */
- this.pingTimer_ = null;
+ /** @private {base.RepeatingTimer} */
+ this.pingTimer_ = null;
+
+ /** @private {remoting.DesktopConnectedView} */
+ this.connectedView_ = null;
};
/**
@@ -232,6 +236,8 @@ remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) {
JSON.stringify({fullName: userInfo.name}));
});
+ remoting.app.getSessionConnector().registerProtocolExtension(this);
+
var clientSession = connectionInfo.session();
// Set up a ping at 10-second intervals to test the connection speed.
var CONNECTION_SPEED_PING_INTERVAL = 10 * 1000;
@@ -239,6 +245,12 @@ remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) {
var message = { timestamp: new Date().getTime() };
clientSession.sendClientMessage('pingRequest', JSON.stringify(message));
}, CONNECTION_SPEED_PING_INTERVAL);
+
+ // TODO(kelvinp): Moves all app remoting specific logic into
Jamie 2015/03/18 01:03:56 s/Moves/Move/
kelvinp 2015/03/18 18:44:22 Done.
+ // remoting.AppRemotingView.
+ this.connectedView_ = new remoting.DesktopConnectedView(
+ document.getElementById('client-container'), connectionInfo,
+ this.getDefaultRemapKeys());
};
/**
@@ -251,6 +263,9 @@ remoting.AppRemoting.prototype.handleDisconnected = function() {
base.dispose(this.pingTimer_);
this.pingTimer_ = null;
+ base.dispose(this.connectedView_);
+ this.connectedView_ = null;
+
chrome.app.window.current().close();
};
@@ -276,15 +291,25 @@ remoting.AppRemoting.prototype.handleVideoStreamingStarted = function() {
remoting.LoadingWindow.close();
};
+
+/** @return {Array<string>} */
+remoting.AppRemoting.prototype.getExtensionTypes = function() {
+ return ['openURL', 'onWindowRemoved', 'onWindowAdded',
+ 'onAllWindowsMinimized', 'setKeyboardLayouts', 'pingResponse'];
+};
+
/**
- * Called when an extension message needs to be handled.
- *
- * @param {string} type The type of the extension message.
+ * @param {function(string,string)} sendMessageToHost Callback to send a message
+ * to the host.
+ */
+remoting.AppRemoting.prototype.startExtension = function(sendMessageToHost) {
+};
+
+/**
+ * @param {string} type The message type.
* @param {Object} message The parsed extension message data.
- * @return {boolean} True if the extension message was recognized.
*/
-remoting.AppRemoting.prototype.handleExtensionMessage = function(
- type, message) {
+remoting.AppRemoting.prototype.onExtensionMessage = function(type, message) {
switch (type) {
case 'openURL':
« no previous file with comments | « no previous file | remoting/webapp/base/js/application.js » ('j') | remoting/webapp/crd/js/client_session.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698