 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| OLD | NEW | 
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 
| 7 | 7 | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 | 9 | 
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" | 
| 11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" | 
| 12 #include "ui/views/animation/ink_drop_delegate.h" | |
| 12 #include "ui/views/animation/ink_drop_host.h" | 13 #include "ui/views/animation/ink_drop_host.h" | 
| 13 #include "ui/views/view.h" | 14 #include "ui/views/view.h" | 
| 14 | 15 | 
| 15 namespace views { | 16 namespace views { | 
| 16 | 17 | 
| 17 class InkDropRipple; | 18 class InkDropRipple; | 
| 18 class InkDropHover; | 19 class InkDropHover; | 
| 19 | 20 | 
| 20 // A view that provides InkDropHost functionality. | 21 // A view that provides InkDropHost functionality. | 
| 21 class VIEWS_EXPORT InkDropHostView : public views::View, public InkDropHost { | 22 class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { | 
| 22 public: | 23 public: | 
| 23 InkDropHostView(); | |
| 24 ~InkDropHostView() override; | |
| 25 | |
| 26 // Overridden from views::InkDropHost: | 24 // Overridden from views::InkDropHost: | 
| 27 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 25 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 
| 28 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 26 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 
| 29 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 27 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 
| 30 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; | 28 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; | 
| 31 | 29 | 
| 32 void set_ink_drop_size(const gfx::Size& size) { ink_drop_size_ = size; } | 30 void set_ink_drop_size(const gfx::Size& size) { ink_drop_size_ = size; } | 
| 33 | 31 | 
| 32 InkDropDelegate* ink_drop_delegate() { return ink_drop_delegate_.get(); } | |
| 33 | |
| 34 protected: | 34 protected: | 
| 35 InkDropHostView(); | |
| 36 ~InkDropHostView() override; | |
| 37 | |
| 35 static const int kInkDropSmallCornerRadius; | 38 static const int kInkDropSmallCornerRadius; | 
| 36 | 39 | 
| 40 // View | |
| 41 void OnFocus() override; | |
| 42 void OnBlur() override; | |
| 43 | |
| 37 // Overrideable methods to allow views to provide minor tweaks to the default | 44 // Overrideable methods to allow views to provide minor tweaks to the default | 
| 38 // ink drop. | 45 // ink drop. | 
| 39 virtual gfx::Point GetInkDropCenter() const; | 46 virtual gfx::Point GetInkDropCenter() const; | 
| 40 virtual SkColor GetInkDropBaseColor() const; | 47 virtual SkColor GetInkDropBaseColor() const; | 
| 41 | 48 | 
| 49 // Should return true if the ink drop is also used to depict focus. | |
| 50 virtual bool ShouldShowInkDropForFocus() const; | |
| 51 | |
| 52 void set_ink_drop_delegate(std::unique_ptr<InkDropDelegate> delegate) { | |
| 53 ink_drop_delegate_ = std::move(delegate); | |
| 54 } | |
| 55 | |
| 42 private: | 56 private: | 
| 57 std::unique_ptr<InkDropDelegate> ink_drop_delegate_; | |
| 43 gfx::Size ink_drop_size_; | 58 gfx::Size ink_drop_size_; | 
| 59 bool destroying_; | |
| 
bruthig
2016/05/26 00:40:52
Is it worth adding a note that |destroying_| is in
 
Evan Stade
2016/05/26 18:45:01
huh? I don't think it matters where destroying_ is
 | |
| 44 | 60 | 
| 45 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 61 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 
| 46 }; | 62 }; | 
| 47 } // namespace views | 63 } // namespace views | 
| 48 | 64 | 
| 49 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 65 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 
| OLD | NEW |