 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| 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..f078087b4dd08b4e06cf7c2f5babd806658afd4f 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" | 
| @@ -30,9 +31,11 @@ gfx::Size CalculateLargeInkDropSize(const gfx::Size small_size) { | 
| const int InkDropHostView::kInkDropSmallCornerRadius = 2; | 
| InkDropHostView::InkDropHostView() | 
| - : ink_drop_size_(kInkDropSize, kInkDropSize) {} | 
| + : ink_drop_size_(kInkDropSize, kInkDropSize), destroying_(false) {} | 
| -InkDropHostView::~InkDropHostView() {} | 
| +InkDropHostView::~InkDropHostView() { | 
| + destroying_ = true; | 
| +} | 
| void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 
| SetPaintToLayer(true); | 
| @@ -42,6 +45,11 @@ void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 
| } | 
| void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 
| + // No need to do anything when called during shutdown, and if a derived | 
| 
bruthig
2016/05/26 00:40:52
Can add the following TODO here?
TODO(bruthig): F
 
Evan Stade
2016/05/26 18:45:01
Done.
 | 
| + // class has overridden Add/RemoveInkDropLayer, running this implementation | 
| + // would be wrong. | 
| + if (destroying_) | 
| + return; | 
| layer()->Remove(ink_drop_layer); | 
| SetPaintToLayer(false); | 
| } | 
| @@ -62,6 +70,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()->SetFocused(true); | 
| +} | 
| + | 
| +void InkDropHostView::OnBlur() { | 
| + views::View::OnBlur(); | 
| + if (ink_drop_delegate() && ShouldShowInkDropForFocus()) | 
| + ink_drop_delegate()->GetInkDrop()->SetFocused(false); | 
| +} | 
| + | 
| gfx::Point InkDropHostView::GetInkDropCenter() const { | 
| return GetLocalBounds().CenterPoint(); | 
| } | 
| @@ -71,4 +91,8 @@ SkColor InkDropHostView::GetInkDropBaseColor() const { | 
| return gfx::kPlaceholderColor; | 
| } | 
| +bool InkDropHostView::ShouldShowInkDropForFocus() const { | 
| + return false; | 
| +} | 
| + | 
| } // namespace views |