Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ui/views/animation/ink_drop_animation_controller_factory.h" | 5 #include "ui/views/animation/ink_drop_animation_controller_factory.h" |
| 6 | 6 |
| 7 #include "ui/base/resource/material_design/material_design_controller.h" | 7 #include "ui/base/resource/material_design/material_design_controller.h" |
| 8 #include "ui/gfx/geometry/rect.h" | 8 #include "ui/gfx/geometry/rect.h" |
| 9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 #include "ui/views/animation/ink_drop_animation_controller.h" | 10 #include "ui/views/animation/ink_drop_animation_controller.h" |
| 11 #include "ui/views/animation/ink_drop_animation_controller_impl.h" | 11 #include "ui/views/animation/ink_drop_animation_controller_impl.h" |
| 12 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // A stub implementation of an InkDropAnimationController that can be used when | 18 // A stub implementation of an InkDropAnimationController that can be used when |
| 19 // material design is not enabled. | 19 // material design is not enabled. |
| 20 class VIEWS_EXPORT InkDropAnimationControllerStub | 20 class VIEWS_EXPORT InkDropAnimationControllerStub |
|
jonross
2015/08/19 22:13:36
Thoughts on just having IDAC be this, instead of p
bruthig
2015/08/20 20:35:35
I'm of the opinion that I want to make it hard for
jonross
2015/08/21 15:14:48
I was mostly thinking of condensing the code. Wher
| |
| 21 : public InkDropAnimationController { | 21 : public InkDropAnimationController { |
| 22 public: | 22 public: |
| 23 explicit InkDropAnimationControllerStub(InkDropHost* ink_drop_host); | 23 explicit InkDropAnimationControllerStub(InkDropHost* ink_drop_host); |
| 24 ~InkDropAnimationControllerStub() override; | 24 ~InkDropAnimationControllerStub() override; |
| 25 | 25 |
| 26 // InkDropAnimationController: | 26 // InkDropAnimationController: |
| 27 InkDropState GetInkDropState() const override; | |
| 27 void AnimateToState(InkDropState state) override; | 28 void AnimateToState(InkDropState state) override; |
| 28 void SetInkDropSize(const gfx::Size& size) override; | 29 gfx::Size GetInkDropLargeSize() const override; |
| 29 gfx::Rect GetInkDropBounds() const override; | 30 void SetInkDropSize(const gfx::Size& large_size, |
| 30 void SetInkDropBounds(const gfx::Rect& bounds) override; | 31 int large_corner_radius, |
| 32 const gfx::Size& small_size, | |
| 33 int small_corner_radius) override; | |
| 34 gfx::Point GetInkDropOrigin() const override; | |
| 35 void SetInkDropOrigin(const gfx::Point& origin) override; | |
| 31 | 36 |
| 32 private: | 37 private: |
| 33 // The bounds of the ink drop layers. Defined in the coordinate space of the | |
| 34 // parent ui::Layer that the ink drop layers were added to. | |
| 35 gfx::Rect ink_drop_bounds_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub); | 38 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 InkDropAnimationControllerStub::InkDropAnimationControllerStub( | 41 InkDropAnimationControllerStub::InkDropAnimationControllerStub( |
| 41 InkDropHost* ink_drop_host) {} | 42 InkDropHost* ink_drop_host) {} |
| 42 | 43 |
| 43 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {} | 44 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {} |
| 44 | 45 |
| 46 InkDropState InkDropAnimationControllerStub::GetInkDropState() const { | |
| 47 return InkDropState::HIDDEN; | |
| 48 } | |
| 49 | |
| 45 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {} | 50 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {} |
| 46 | 51 |
| 47 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& size) { | 52 gfx::Size InkDropAnimationControllerStub::GetInkDropLargeSize() const { |
| 48 ink_drop_bounds_.set_size(size); | 53 return gfx::Size(); |
| 49 } | 54 } |
| 50 | 55 |
| 51 gfx::Rect InkDropAnimationControllerStub::GetInkDropBounds() const { | 56 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& large_size, |
| 52 return ink_drop_bounds_; | 57 int large_corner_radius, |
| 58 const gfx::Size& small_size, | |
| 59 int small_corner_radius) {} | |
| 60 | |
| 61 gfx::Point InkDropAnimationControllerStub::GetInkDropOrigin() const { | |
| 62 return gfx::Point(); | |
| 53 } | 63 } |
| 54 | 64 |
| 55 void InkDropAnimationControllerStub::SetInkDropBounds(const gfx::Rect& bounds) { | 65 void InkDropAnimationControllerStub::SetInkDropOrigin( |
| 56 ink_drop_bounds_ = bounds; | 66 const gfx::Point& origin) {} |
| 57 } | |
| 58 | 67 |
| 59 } // namespace | 68 } // namespace |
| 60 | 69 |
| 61 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {} | 70 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {} |
| 62 | 71 |
| 63 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {} | 72 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {} |
| 64 | 73 |
| 65 scoped_ptr<InkDropAnimationController> | 74 scoped_ptr<InkDropAnimationController> |
| 66 InkDropAnimationControllerFactory::CreateInkDropAnimationController( | 75 InkDropAnimationControllerFactory::CreateInkDropAnimationController( |
| 67 InkDropHost* ink_drop_host) { | 76 InkDropHost* ink_drop_host) { |
| 68 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
| 78 // The ink drop animation is only targeted at ChromeOS because there is | |
| 79 // concern it will conflict with OS level touch feedback in a bad way. | |
|
tdanderson
2015/08/19 22:11:19
Since this is behind a flag anyway, I don't think
bruthig
2015/08/20 20:35:35
This was the request of the designers. If we do c
| |
| 69 if (ui::MaterialDesignController::IsModeMaterial()) { | 80 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 70 return scoped_ptr<InkDropAnimationController>( | 81 return scoped_ptr<InkDropAnimationController>( |
| 71 new InkDropAnimationControllerImpl(ink_drop_host)); | 82 new InkDropAnimationControllerImpl(ink_drop_host)); |
| 72 } else { | 83 } else { |
| 73 return scoped_ptr<InkDropAnimationController>( | 84 return scoped_ptr<InkDropAnimationController>( |
| 74 new InkDropAnimationControllerStub(ink_drop_host)); | 85 new InkDropAnimationControllerStub(ink_drop_host)); |
| 75 } | 86 } |
| 76 #endif // defined(OS_CHROMEOS) | 87 #endif // defined(OS_CHROMEOS) |
| 77 | 88 |
| 78 return scoped_ptr<InkDropAnimationController>( | 89 return scoped_ptr<InkDropAnimationController>( |
| 79 new InkDropAnimationControllerStub(ink_drop_host)); | 90 new InkDropAnimationControllerStub(ink_drop_host)); |
| 80 } | 91 } |
| 81 | 92 |
| 82 } // namespace views | 93 } // namespace views |
| OLD | NEW |