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

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: 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_button.h ('k') | ui/views/animation/ink_drop_animation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f642a0ff3cca5a1ea1b5f5cf361aaaeeaf5b3910 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,7 +151,13 @@ 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) {
+ UpdateInkDropHoverState();
Peter Kasting 2015/11/11 22:08:24 Nit: It might be better to do this below the SetSt
bruthig 2015/11/12 18:21:08 It certainly would make more sense, good thinking!
+
// 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.
@@ -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";
}
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_button.h ('k') | ui/views/animation/ink_drop_animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698