| 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.h" | 12 #include "ui/views/animation/ink_drop.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 namespace test { | 18 namespace test { |
| 19 class InkDropHostViewTestApi; | 19 class InkDropHostViewTestApi; |
| 20 } // namespace test | 20 } // namespace test |
| 21 | 21 |
| 22 class InkDropRipple; | 22 class InkDropRipple; |
| 23 class InkDropHighlight; | 23 class InkDropHighlight; |
| 24 | 24 |
| 25 // A view that provides InkDropHost functionality. | 25 // A view that provides InkDropHost functionality. |
| 26 class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { | 26 class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { |
| 27 public: | 27 public: |
| 28 // Overridden from views::InkDropHost: | 28 // Overridden from InkDropHost: |
| 29 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 29 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 30 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 30 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 31 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 31 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
| 32 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; | 32 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; |
| 33 | 33 |
| 34 void set_ink_drop_size(const gfx::Size& size) { ink_drop_size_ = size; } | 34 void set_ink_drop_size(const gfx::Size& size) { ink_drop_size_ = size; } |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 InkDropHostView(); | 37 InkDropHostView(); |
| 38 ~InkDropHostView() override; | 38 ~InkDropHostView() override; |
| 39 | 39 |
| 40 static const int kInkDropSmallCornerRadius; | 40 static const int kInkDropSmallCornerRadius; |
| 41 | 41 |
| 42 // View: | 42 // View: |
| 43 void VisibilityChanged(View* starting_from, bool is_visible) override; |
| 43 void OnFocus() override; | 44 void OnFocus() override; |
| 44 void OnBlur() override; | 45 void OnBlur() override; |
| 45 void OnMouseEvent(ui::MouseEvent* event) override; | 46 void OnMouseEvent(ui::MouseEvent* event) override; |
| 46 | 47 |
| 47 // Overrideable methods to allow views to provide minor tweaks to the default | 48 // Overrideable methods to allow views to provide minor tweaks to the default |
| 48 // ink drop. | 49 // ink drop. |
| 49 virtual gfx::Point GetInkDropCenter() const; | 50 virtual gfx::Point GetInkDropCenter() const; |
| 50 virtual SkColor GetInkDropBaseColor() const; | 51 virtual SkColor GetInkDropBaseColor() const; |
| 51 | 52 |
| 52 // Should return true if the ink drop is also used to depict focus. | 53 // Should return true if the ink drop is also used to depict focus. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 78 | 79 |
| 79 gfx::Size ink_drop_size_; | 80 gfx::Size ink_drop_size_; |
| 80 | 81 |
| 81 bool destroying_; | 82 bool destroying_; |
| 82 | 83 |
| 83 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 84 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 84 }; | 85 }; |
| 85 } // namespace views | 86 } // namespace views |
| 86 | 87 |
| 87 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 88 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |