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

Unified Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2001843002: Use ink drop hover for focus states on toolbar buttons and location (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 7 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/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index faf32b07d816bab75fed2fe7b3ae2dd0148570d4..8bb6270599d8d82110462277d73d38bd914dc05f 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -6,6 +6,7 @@
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/size_conversions.h"
+#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_hover.h"
#include "ui/views/animation/square_ink_drop_ripple.h"
@@ -62,6 +63,18 @@ std::unique_ptr<InkDropHover> InkDropHostView::CreateInkDropHover() const {
return hover;
}
+void InkDropHostView::OnFocus() {
+ views::View::OnFocus();
+ if (ink_drop_delegate() && ShouldShowInkDropForFocus())
+ ink_drop_delegate()->GetInkDrop()->SnapToHovered(true);
+}
+
+void InkDropHostView::OnBlur() {
+ views::View::OnBlur();
+ if (ink_drop_delegate() && ShouldShowInkDropForFocus())
+ ink_drop_delegate()->GetInkDrop()->SnapToHovered(false);
+}
+
gfx::Point InkDropHostView::GetInkDropCenter() const {
return GetLocalBounds().CenterPoint();
}
@@ -71,4 +84,8 @@ SkColor InkDropHostView::GetInkDropBaseColor() const {
return gfx::kPlaceholderColor;
}
+bool InkDropHostView::ShouldShowInkDropForFocus() const {
+ return false;
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698