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

Unified Diff: remoting/webapp/toolbar.js

Issue 594503004: Move ownership of the tool-bar's menu buttons into remoting.Toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove MenuButton changes (will follow up with a better fix. Created 6 years, 3 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/remoting.js ('k') | remoting/webapp/window_frame.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/toolbar.js
diff --git a/remoting/webapp/toolbar.js b/remoting/webapp/toolbar.js
index e75bef165daae68e0dc54b8ab5a7e218d56ec6aa..d6a6942249619aa50bba0ea071642b2492365234 100644
--- a/remoting/webapp/toolbar.js
+++ b/remoting/webapp/toolbar.js
@@ -42,18 +42,22 @@ remoting.Toolbar = function(toolbar) {
* @private
*/
this.stubRight_ = 0;
+
/**
- * @type {remoting.OptionsMenu}
+ * @type {remoting.MenuButton}
* @private
*/
- this.optionsMenu_ = new remoting.OptionsMenu(
- document.getElementById('send-ctrl-alt-del'),
- document.getElementById('send-print-screen'),
- document.getElementById('screen-resize-to-client'),
- document.getElementById('screen-shrink-to-fit'),
- document.getElementById('new-connection'),
- document.getElementById('toggle-full-screen'),
- null);
+ this.screenOptionsMenu_ = new remoting.MenuButton(
+ document.getElementById('screen-options-menu'),
+ this.onShowOptionsMenu_.bind(this));
+ /**
+ * @type {remoting.MenuButton}
+ * @private
+ */
+ this.sendKeysMenu_ = new remoting.MenuButton(
+ document.getElementById('send-keys-menu')
+ );
+
window.addEventListener('mousemove', remoting.Toolbar.onMouseMove, false);
window.addEventListener('resize', this.center.bind(this), false);
@@ -74,6 +78,21 @@ remoting.Toolbar = function(toolbar) {
this.toolbar_.addEventListener('mousemove', stopTimer, false);
};
+
+/**
+ * @return {remoting.OptionsMenu}
+ */
+remoting.Toolbar.prototype.createOptionsMenu = function() {
+ return new remoting.OptionsMenu(
+ document.getElementById('send-ctrl-alt-del'),
+ document.getElementById('send-print-screen'),
+ document.getElementById('screen-resize-to-client'),
+ document.getElementById('screen-shrink-to-fit'),
+ document.getElementById('new-connection'),
+ document.getElementById('toggle-full-screen'),
+ null);
+};
+
/**
* Preview the tool-bar functionality by showing it for 3s.
* @return {void} Nothing.
@@ -113,7 +132,6 @@ remoting.Toolbar.prototype.toggle = function() {
* there is no connection.
*/
remoting.Toolbar.prototype.setClientSession = function(clientSession) {
- this.optionsMenu_.setClientSession(clientSession);
var connectedTo = document.getElementById('connected-to');
connectedTo.innerText =
clientSession ? clientSession.getHostDisplayName() : "";
@@ -158,6 +176,16 @@ remoting.Toolbar.onMouseMove = function(event) {
}
};
+/**
+ * Updates the options menu to reflect the current scale-to-fit and full-screen
+ * settings.
+ * @return {void} Nothing.
+ * @private
+ */
+remoting.Toolbar.prototype.onShowOptionsMenu_ = function() {
+ remoting.optionsMenu.onShow();
+};
+
/** @type {remoting.Toolbar} */
remoting.toolbar = null;
« no previous file with comments | « remoting/webapp/remoting.js ('k') | remoting/webapp/window_frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698