| 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_delegate.h" |
| 13 #include "ui/views/animation/ink_drop_host.h" | 13 #include "ui/views/animation/ink_drop_host.h" |
| 14 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 | 17 |
| 18 class InkDropRipple; | 18 class InkDropRipple; |
| 19 class InkDropHover; | 19 class InkDropHover; |
| 20 | 20 |
| 21 // A view that provides InkDropHost functionality. | 21 // A view that provides InkDropHost functionality. |
| 22 class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { | 22 class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { |
| 23 public: | 23 public: |
| 24 // Overridden from views::InkDropHost: | 24 // Overridden from InkDropHost: |
| 25 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 25 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 26 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 26 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 27 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 27 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
| 28 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; | 28 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; |
| 29 | 29 |
| 30 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; } |
| 31 | 31 |
| 32 InkDropDelegate* ink_drop_delegate() { return ink_drop_delegate_.get(); } | 32 InkDropDelegate* ink_drop_delegate() { return ink_drop_delegate_.get(); } |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 InkDropHostView(); | 35 InkDropHostView(); |
| 36 ~InkDropHostView() override; | 36 ~InkDropHostView() override; |
| 37 | 37 |
| 38 static const int kInkDropSmallCornerRadius; | 38 static const int kInkDropSmallCornerRadius; |
| 39 | 39 |
| 40 // View | 40 // View |
| 41 void VisibilityChanged(View* starting_from, bool is_visible) override; |
| 41 void OnFocus() override; | 42 void OnFocus() override; |
| 42 void OnBlur() override; | 43 void OnBlur() override; |
| 43 | 44 |
| 44 // Overrideable methods to allow views to provide minor tweaks to the default | 45 // Overrideable methods to allow views to provide minor tweaks to the default |
| 45 // ink drop. | 46 // ink drop. |
| 46 virtual gfx::Point GetInkDropCenter() const; | 47 virtual gfx::Point GetInkDropCenter() const; |
| 47 virtual SkColor GetInkDropBaseColor() const; | 48 virtual SkColor GetInkDropBaseColor() const; |
| 48 | 49 |
| 49 // Should return true if the ink drop is also used to depict focus. | 50 // Should return true if the ink drop is also used to depict focus. |
| 50 virtual bool ShouldShowInkDropForFocus() const; | 51 virtual bool ShouldShowInkDropForFocus() const; |
| 51 | 52 |
| 52 void set_ink_drop_delegate(std::unique_ptr<InkDropDelegate> delegate) { | 53 void set_ink_drop_delegate(std::unique_ptr<InkDropDelegate> delegate) { |
| 53 ink_drop_delegate_ = std::move(delegate); | 54 ink_drop_delegate_ = std::move(delegate); |
| 54 } | 55 } |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 std::unique_ptr<InkDropDelegate> ink_drop_delegate_; | 58 std::unique_ptr<InkDropDelegate> ink_drop_delegate_; |
| 58 gfx::Size ink_drop_size_; | 59 gfx::Size ink_drop_size_; |
| 59 bool destroying_; | 60 bool destroying_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 62 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 62 }; | 63 }; |
| 63 } // namespace views | 64 } // namespace views |
| 64 | 65 |
| 65 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 66 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |