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

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

Issue 1089493002: [Webapp Refactor] Re-add remoting.ConnectionStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 years, 8 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/app_remoting/js/app_connected_view.js ('k') | remoting/webapp/crd/html/window_frame.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/app_remoting/js/application_context_menu.js
diff --git a/remoting/webapp/app_remoting/js/application_context_menu.js b/remoting/webapp/app_remoting/js/application_context_menu.js
index 2ba7937dae0f313d29db0f792db6c8240cc7ef80..ae1b4b0923a140b0046070ed2f318f02f395a60c 100644
--- a/remoting/webapp/app_remoting/js/application_context_menu.js
+++ b/remoting/webapp/app_remoting/js/application_context_menu.js
@@ -14,9 +14,11 @@ var remoting = remoting || {};
/**
* @param {remoting.ContextMenuAdapter} adapter
+ * @param {remoting.ClientPlugin} plugin
* @constructor
+ * @implements {base.Disposable}
*/
-remoting.ApplicationContextMenu = function(adapter) {
+remoting.ApplicationContextMenu = function(adapter, plugin) {
/** @private {remoting.ContextMenuAdapter} */
this.adapter_ = adapter;
@@ -28,10 +30,21 @@ remoting.ApplicationContextMenu = function(adapter) {
remoting.ApplicationContextMenu.kShowStatsId,
l10n.getTranslationOrError(/*i18n-content*/'SHOW_STATS'),
true);
+
+ // TODO(kelvinp):Unhook this event on shutdown.
this.adapter_.addListener(this.onClicked_.bind(this));
/** @private {string} */
this.hostId_ = '';
+
+ /** @private */
+ this.stats_ = new remoting.ConnectionStats(
+ document.getElementById('statistics'), plugin);
+};
+
+remoting.ApplicationContextMenu.prototype.dispose = function() {
+ base.dispose(this.stats_);
+ this.stats_ = null;
};
/**
@@ -39,7 +52,7 @@ remoting.ApplicationContextMenu = function(adapter) {
*/
remoting.ApplicationContextMenu.prototype.setHostId = function(hostId) {
this.hostId_ = hostId;
-}
+};
/**
* Add an indication of the connection RTT to the 'Show statistics' menu item.
@@ -81,7 +94,7 @@ remoting.ApplicationContextMenu.prototype.onClicked_ = function(info) {
var message = {
method: 'init',
hostId: that.hostId_,
- connectionStats: JSON.stringify(remoting.stats.mostRecent())
+ connectionStats: JSON.stringify(that.stats_.mostRecent())
};
consentWindow.contentWindow.postMessage(message, '*');
};
@@ -92,9 +105,7 @@ remoting.ApplicationContextMenu.prototype.onClicked_ = function(info) {
break;
case remoting.ApplicationContextMenu.kShowStatsId:
- if (remoting.stats) {
- remoting.stats.show(info.checked);
- }
+ this.stats_.show(info.checked);
break;
}
};
« no previous file with comments | « remoting/webapp/app_remoting/js/app_connected_view.js ('k') | remoting/webapp/crd/html/window_frame.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698