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

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: Changed the diff delta to depend on correct branch. Created 5 years, 2 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
« 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..97bf9360e96272cbccffa70001ca53b9c43f0bcc 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -144,6 +144,8 @@ void ToolbarButton::OnMouseReleased(const ui::MouseEvent& event) {
if (IsTriggerableEvent(event))
show_menu_factory_.InvalidateWeakPtrs();
+ UpdateInkDropHoverState();
Peter Kasting 2015/10/15 22:21:33 Why do you need this?
bruthig 2015/10/16 14:57:21 It is needed for the following situation: 1.) Lef
Peter Kasting 2015/10/16 18:41:16 It sounds like a bug to me that OnMouseExited() is
bruthig 2015/11/02 16:42:31 I have changed the behavior such that the hover is
+
if (!HitTestPoint(event.location()))
ink_drop_animation_controller_->AnimateToState(views::InkDropState::HIDDEN);
}
@@ -151,7 +153,17 @@ void ToolbarButton::OnMouseReleased(const ui::MouseEvent& event) {
void ToolbarButton::OnMouseCaptureLost() {
}
+void ToolbarButton::OnMouseEntered(const ui::MouseEvent& event) {
+ UpdateInkDropHoverState();
+}
+
+void ToolbarButton::OnMouseMoved(const ui::MouseEvent& event) {
Peter Kasting 2015/10/15 22:21:33 Why do you need this override if you have the ente
bruthig 2015/10/16 14:57:21 This was necessary for the following situation: 1
Peter Kasting 2015/10/16 18:41:16 I don't reproduce the mouse pointer disappearing w
bruthig 2015/10/16 19:10:51 I just want to confirm that you are indeed using a
bruthig 2015/11/02 16:42:31 FTR This is still needed for the following scenari
+ UpdateInkDropHoverState();
+}
+
void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) {
+ UpdateInkDropHoverState();
+
// 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 +226,10 @@ ToolbarButton::CreateDefaultBorder() const {
return border.Pass();
}
+void ToolbarButton::OnEnabledChanged() {
+ UpdateInkDropHoverState();
+}
+
void ToolbarButton::ShowContextMenuForView(View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
@@ -329,6 +345,7 @@ void ToolbarButton::ShowDropDownMenu(ui::MenuSourceType source_type) {
ink_drop_animation_controller_->AnimateToState(
views::InkDropState::DEACTIVATED);
+ UpdateInkDropHoverState();
Peter Kasting 2015/10/15 22:21:33 Why do you need this?
bruthig 2015/10/16 14:57:21 Similar reason to why I needed it in ToolbarButton
Peter Kasting 2015/10/16 18:41:16 Same reply as above.
bruthig 2015/11/02 16:42:31 This has been removed since the hover is turned of
menu_showing_ = false;
@@ -346,6 +363,10 @@ gfx::Point ToolbarButton::CalculateInkDropCenter() const {
return GetLocalBounds().CenterPoint();
}
+void ToolbarButton::UpdateInkDropHoverState() {
+ ink_drop_animation_controller_->SetHovered((enabled() && IsMouseHovered()));
Peter Kasting 2015/10/15 22:21:33 Too many parens
bruthig 2015/10/16 14:57:21 Done.
+}
+
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