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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class representing the application's context menu. 7 * Class representing the application's context menu.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * @param {remoting.ContextMenuAdapter} adapter 16 * @param {remoting.ContextMenuAdapter} adapter
17 * @param {remoting.ClientPlugin} plugin
17 * @constructor 18 * @constructor
18 */ 19 */
19 remoting.ApplicationContextMenu = function(adapter) { 20 remoting.ApplicationContextMenu = function(adapter, plugin) {
20 /** @private {remoting.ContextMenuAdapter} */ 21 /** @private {remoting.ContextMenuAdapter} */
21 this.adapter_ = adapter; 22 this.adapter_ = adapter;
22 23
23 this.adapter_.create( 24 this.adapter_.create(
24 remoting.ApplicationContextMenu.kSendFeedbackId, 25 remoting.ApplicationContextMenu.kSendFeedbackId,
25 l10n.getTranslationOrError(/*i18n-content*/'SEND_FEEDBACK'), 26 l10n.getTranslationOrError(/*i18n-content*/'SEND_FEEDBACK'),
26 false); 27 false);
27 this.adapter_.create( 28 this.adapter_.create(
28 remoting.ApplicationContextMenu.kShowStatsId, 29 remoting.ApplicationContextMenu.kShowStatsId,
29 l10n.getTranslationOrError(/*i18n-content*/'SHOW_STATS'), 30 l10n.getTranslationOrError(/*i18n-content*/'SHOW_STATS'),
30 true); 31 true);
32
33 // TODO(kelvinp):Unhook this event on shutdown.
Jamie 2015/04/15 17:02:47 I don't think this is necessary. If an in-DOM cont
kelvinp 2015/04/15 18:37:50 I think we should still clean up event listeners o
Jamie 2015/04/15 18:40:47 Acknowledged.
31 this.adapter_.addListener(this.onClicked_.bind(this)); 34 this.adapter_.addListener(this.onClicked_.bind(this));
32 35
33 /** @private {string} */ 36 /** @private {string} */
34 this.hostId_ = ''; 37 this.hostId_ = '';
38
39 /** @private */
40 this.stats_ = new remoting.ConnectionStats(
41 document.getElementById('statistics'), plugin);
Jamie 2015/04/15 17:02:47 You're never calling dispose() on this. Does that
kelvinp 2015/04/15 18:37:50 Good catch. Done.
35 }; 42 };
36 43
37 /** 44 /**
38 * @param {string} hostId 45 * @param {string} hostId
39 */ 46 */
40 remoting.ApplicationContextMenu.prototype.setHostId = function(hostId) { 47 remoting.ApplicationContextMenu.prototype.setHostId = function(hostId) {
41 this.hostId_ = hostId; 48 this.hostId_ = hostId;
42 } 49 };
43 50
44 /** 51 /**
45 * Add an indication of the connection RTT to the 'Show statistics' menu item. 52 * Add an indication of the connection RTT to the 'Show statistics' menu item.
46 * 53 *
47 * @param {number} rttMs The RTT of the connection, in ms. 54 * @param {number} rttMs The RTT of the connection, in ms.
48 */ 55 */
49 remoting.ApplicationContextMenu.prototype.updateConnectionRTT = 56 remoting.ApplicationContextMenu.prototype.updateConnectionRTT =
50 function(rttMs) { 57 function(rttMs) {
51 var rttText = 58 var rttText =
52 rttMs < 50 ? /*i18n-content*/'CONNECTION_QUALITY_GOOD' : 59 rttMs < 50 ? /*i18n-content*/'CONNECTION_QUALITY_GOOD' :
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 }; 92 };
86 consentWindow.contentWindow.postMessage(message, '*'); 93 consentWindow.contentWindow.postMessage(message, '*');
87 }; 94 };
88 consentWindow.contentWindow.addEventListener('load', onLoad, false); 95 consentWindow.contentWindow.addEventListener('load', onLoad, false);
89 }; 96 };
90 chrome.app.window.create( 97 chrome.app.window.create(
91 'feedback_consent.html', windowAttributes, onCreate); 98 'feedback_consent.html', windowAttributes, onCreate);
92 break; 99 break;
93 100
94 case remoting.ApplicationContextMenu.kShowStatsId: 101 case remoting.ApplicationContextMenu.kShowStatsId:
95 if (remoting.stats) { 102 this.stats_.show(info.checked);
96 remoting.stats.show(info.checked);
97 }
98 break; 103 break;
99 } 104 }
100 }; 105 };
101 106
102 107
103 /** @type {string} */ 108 /** @type {string} */
104 remoting.ApplicationContextMenu.kSendFeedbackId = 'send-feedback'; 109 remoting.ApplicationContextMenu.kSendFeedbackId = 'send-feedback';
105 110
106 /** @type {string} */ 111 /** @type {string} */
107 remoting.ApplicationContextMenu.kShowStatsId = 'show-stats'; 112 remoting.ApplicationContextMenu.kShowStatsId = 'show-stats';
OLDNEW
« 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