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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed pkasting@'s comments from patch set 13. 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/toolbar/toolbar_button.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index 33cfcd013c9dc9d0e64e3a372ebb59925614c3ab..95d9ebf0eed0cea2196e100265920aad144e2551 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -34,7 +34,7 @@ ToolbarButton::ToolbarButton(views::ButtonListener* listener,
y_position_on_lbuttondown_(0),
ink_drop_animation_controller_(
views::InkDropAnimationControllerFactory::
- CreateInkDropAnimationController(this)),
+ CreateInkDropAnimationController(this, this)),
show_menu_factory_(this) {
set_context_menu_controller(this);
@@ -151,12 +151,18 @@ void ToolbarButton::OnMouseReleased(const ui::MouseEvent& event) {
void ToolbarButton::OnMouseCaptureLost() {
}
+void ToolbarButton::OnMouseEntered(const ui::MouseEvent& event) {
+ UpdateInkDropHoverState();
+}
+
void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) {
// Starting a drag results in a MouseExited, we need to ignore it.
// A right click release triggers an exit event. We want to
// remain in a PUSHED state until the drop down menu closes.
if (state_ != STATE_DISABLED && !InDrag() && state_ != STATE_PRESSED)
SetState(STATE_NORMAL);
+
+ UpdateInkDropHoverState();
}
void ToolbarButton::OnGestureEvent(ui::GestureEvent* event) {
@@ -214,6 +220,10 @@ ToolbarButton::CreateDefaultBorder() const {
return border.Pass();
}
+void ToolbarButton::OnEnabledChanged() {
+ UpdateInkDropHoverState();
+}
+
void ToolbarButton::ShowContextMenuForView(View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
@@ -346,6 +356,10 @@ gfx::Point ToolbarButton::CalculateInkDropCenter() const {
return GetLocalBounds().CenterPoint();
}
+void ToolbarButton::UpdateInkDropHoverState() {
+ ink_drop_animation_controller_->SetHovered(ShouldShowInkDropHover());
+}
+
const char* ToolbarButton::GetClassName() const {
return "ToolbarButton";
}

Powered by Google App Engine
This is Rietveld 408576698