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

Unified Diff: chrome/browser/ui/views/bar_control_button.cc

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the *InkDropControllerFactory* tests to work with the hover timer. Created 5 years, 1 month 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: chrome/browser/ui/views/bar_control_button.cc
diff --git a/chrome/browser/ui/views/bar_control_button.cc b/chrome/browser/ui/views/bar_control_button.cc
index 0e4336d5533964aabfe476257ce75bcf48ac4f9f..1b57d5e8738feb38d38f1247490a344e9b2bf50a 100644
--- a/chrome/browser/ui/views/bar_control_button.cc
+++ b/chrome/browser/ui/views/bar_control_button.cc
@@ -23,7 +23,7 @@ BarControlButton::BarControlButton(views::ButtonListener* listener)
id_(gfx::VectorIconId::VECTOR_ICON_NONE),
ink_drop_animation_controller_(
views::InkDropAnimationControllerFactory::
- CreateInkDropAnimationController(this)) {
+ CreateInkDropAnimationController(this, this)) {
const int kInkDropLargeSize = 32;
const int kInkDropLargeCornerRadius = 4;
const int kInkDropSmallSize = 24;
@@ -129,9 +129,25 @@ void BarControlButton::OnMouseReleased(const ui::MouseEvent& event) {
ImageButton::OnMouseReleased(event);
}
+void BarControlButton::OnMouseEntered(const ui::MouseEvent& event) {
+ UpdateInkDropHoverState();
+}
+
+void BarControlButton::OnMouseExited(const ui::MouseEvent& event) {
+ UpdateInkDropHoverState();
+}
+
void BarControlButton::NotifyClick(const ui::Event& event) {
ink_drop_animation_controller_->AnimateToState(
views::InkDropState::QUICK_ACTION);
ImageButton::NotifyClick(event);
}
+
+void BarControlButton::OnEnabledChanged() {
+ UpdateInkDropHoverState();
+}
+
+void BarControlButton::UpdateInkDropHoverState() {
+ ink_drop_animation_controller_->SetHovered(ShouldShowInkDropHover());
+}

Powered by Google App Engine
This is Rietveld 408576698