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

Unified Diff: ui/file_manager/file_manager/foreground/js/sort_menu_controller.js

Issue 1170913006: Add material design toggle ripple element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix format. Created 5 years, 6 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: ui/file_manager/file_manager/foreground/js/sort_menu_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/sort_menu_controller.js b/ui/file_manager/file_manager/foreground/js/sort_menu_controller.js
index 3a7907997b930eb2fc3ab6f8df56b64a60ff4e41..f9123bc5e4bd072b9c25b9f4c3afdc032f09bdd0 100644
--- a/ui/file_manager/file_manager/foreground/js/sort_menu_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/sort_menu_controller.js
@@ -4,11 +4,15 @@
/**
* @param {!cr.ui.MenuButton} sortButton
+ * @param {!FilesToggleRipple} toggleRipple
* @param {!FileListModel} fileListModel
* @constructor
* @struct
*/
-function SortMenuController(sortButton, fileListModel) {
+function SortMenuController(sortButton, toggleRipple, fileListModel) {
+ /** @private {!FilesToggleRipple} */
+ this.toggleRipple_ = toggleRipple;
+
/** @private {!FileListModel} */
this.fileListModel_ = fileListModel;
@@ -26,6 +30,7 @@ function SortMenuController(sortButton, fileListModel) {
sortButton.menu, '#sort-menu-sort-by-date');
sortButton.addEventListener('menushow', this.updateCheckmark_.bind(this));
+ sortButton.addEventListener('menuhide', this.onHideSortMenu_.bind(this));
};
/**
@@ -33,6 +38,7 @@ function SortMenuController(sortButton, fileListModel) {
* @private
*/
SortMenuController.prototype.updateCheckmark_ = function() {
+ this.toggleRipple_.activated = true;
var sortField = this.fileListModel_.sortStatus.field;
this.setCheckStatus_(this.sortByNameButton_, sortField === 'name');
@@ -43,6 +49,14 @@ SortMenuController.prototype.updateCheckmark_ = function() {
};
/**
+ * Handle hide event of sort menu button.
+ * @private
+ */
+SortMenuController.prototype.onHideSortMenu_ = function() {
+ this.toggleRipple_.activated = false;
+};
+
+/**
* Set attribute 'checked' for the menu item.
* @param {!HTMLElement} menuItem
* @param {boolean} checked True if the item should have 'checked' attribute.

Powered by Google App Engine
This is Rietveld 408576698