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

Unified Diff: remoting/webapp/menu_button.js

Issue 339613003: Remove the blue tool-bar for apps v2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added New Connection to options menu. Created 6 years, 5 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
Index: remoting/webapp/menu_button.js
diff --git a/remoting/webapp/menu_button.js b/remoting/webapp/menu_button.js
index b38ad6b7acd022789e6ad2fb18bea700c7bf6388..b41d69a3680d81f7a0b8e65ace3bc8677d496724 100644
--- a/remoting/webapp/menu_button.js
+++ b/remoting/webapp/menu_button.js
@@ -18,8 +18,10 @@ var remoting = remoting || {};
* elements comprising the menu. It should have the "menu-button" class.
* @param {function():void=} opt_onShow Optional callback invoked before the
* menu is shown.
+ * @param {function():void=} opt_onHide Optional callback after before the
+ * menu is hidden.
*/
-remoting.MenuButton = function(container, opt_onShow) {
+remoting.MenuButton = function(container, opt_onShow, opt_onHide) {
/**
* @type {HTMLElement}
* @private
@@ -39,6 +41,12 @@ remoting.MenuButton = function(container, opt_onShow) {
*/
this.onShow_ = opt_onShow;
+ /**
+ * @type {undefined|function():void}
+ * @private
+ */
+ this.onHide_ = opt_onHide;
+
/** @type {remoting.MenuButton} */
var that = this;
@@ -48,7 +56,10 @@ remoting.MenuButton = function(container, opt_onShow) {
*/
var closeHandler = function(event) {
that.button_.classList.remove(remoting.MenuButton.BUTTON_ACTIVE_CLASS_);
- document.body.removeEventListener('click', closeHandler, true);
+ document.body.removeEventListener('click', closeHandler, false);
+ if (that.onHide_) {
+ that.onHide_();
+ }
};
/**
@@ -83,15 +94,15 @@ remoting.MenuButton.prototype.menu = function() {
/**
* Set or unset the selected state of an <li> menu item.
- * @param {HTMLElement} item The menu item to update.
+ * @param {Element} item The menu item to update.
* @param {boolean} selected True to select the item, false to deselect it.
* @return {void} Nothing.
*/
remoting.MenuButton.select = function(item, selected) {
if (selected) {
- item.classList.add('selected');
+ /** @type {DOMTokenList} */(item.classList).add('selected');
} else {
- item.classList.remove('selected');
+ /** @type {DOMTokenList} */(item.classList).remove('selected');
}
};

Powered by Google App Engine
This is Rietveld 408576698