| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/animation/ink_drop_animation_controller_factory.h" | |
| 6 | |
| 7 #include "base/macros.h" | |
| 8 #include "ui/base/material_design/material_design_controller.h" | |
| 9 #include "ui/gfx/geometry/rect.h" | |
| 10 #include "ui/gfx/geometry/size.h" | |
| 11 #include "ui/views/animation/ink_drop_animation_controller.h" | |
| 12 #include "ui/views/animation/ink_drop_animation_controller_impl.h" | |
| 13 #include "ui/views/views_export.h" | |
| 14 | |
| 15 namespace views { | |
| 16 | |
| 17 namespace { | |
| 18 | |
| 19 // A stub implementation of an InkDropAnimationController that can be used when | |
| 20 // material design is not enabled. | |
| 21 class InkDropAnimationControllerStub | |
| 22 : public InkDropAnimationController { | |
| 23 public: | |
| 24 explicit InkDropAnimationControllerStub(); | |
| 25 ~InkDropAnimationControllerStub() override; | |
| 26 | |
| 27 // InkDropAnimationController: | |
| 28 InkDropState GetTargetInkDropState() const override; | |
| 29 bool IsVisible() const override; | |
| 30 void AnimateToState(InkDropState state) override; | |
| 31 void SnapToActivated() override; | |
| 32 void SetHovered(bool is_hovered) override; | |
| 33 | |
| 34 private: | |
| 35 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub); | |
| 36 }; | |
| 37 | |
| 38 InkDropAnimationControllerStub::InkDropAnimationControllerStub() {} | |
| 39 | |
| 40 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {} | |
| 41 | |
| 42 InkDropState InkDropAnimationControllerStub::GetTargetInkDropState() const { | |
| 43 return InkDropState::HIDDEN; | |
| 44 } | |
| 45 | |
| 46 bool InkDropAnimationControllerStub::IsVisible() const { | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {} | |
| 51 | |
| 52 void InkDropAnimationControllerStub::SnapToActivated() {} | |
| 53 | |
| 54 void InkDropAnimationControllerStub::SetHovered(bool is_hovered) {} | |
| 55 | |
| 56 } // namespace | |
| 57 | |
| 58 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {} | |
| 59 | |
| 60 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {} | |
| 61 | |
| 62 std::unique_ptr<InkDropAnimationController> | |
| 63 InkDropAnimationControllerFactory::CreateInkDropAnimationController( | |
| 64 InkDropHost* ink_drop_host) { | |
| 65 if (ui::MaterialDesignController::IsModeMaterial()) { | |
| 66 return std::unique_ptr<InkDropAnimationController>( | |
| 67 new InkDropAnimationControllerImpl(ink_drop_host)); | |
| 68 } | |
| 69 | |
| 70 return std::unique_ptr<InkDropAnimationController>( | |
| 71 new InkDropAnimationControllerStub()); | |
| 72 } | |
| 73 | |
| 74 } // namespace views | |
| OLD | NEW |