| 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_factory.h" |
| 6 |
| 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" |
| 10 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/views/animation/ink_drop.h" |
| 13 #include "ui/views/animation/ink_drop_impl.h" |
| 14 #include "ui/views/views_export.h" |
| 15 |
| 16 namespace views { |
| 17 |
| 18 namespace { |
| 19 |
| 20 // A stub implementation of an InkDrop that can be used when material design is |
| 21 // not enabled. |
| 22 class InkDropStub : public InkDrop { |
| 23 public: |
| 24 explicit InkDropStub(); |
| 25 ~InkDropStub() override; |
| 26 |
| 27 // InkDrop: |
| 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(InkDropStub); |
| 36 }; |
| 37 |
| 38 InkDropStub::InkDropStub() {} |
| 39 |
| 40 InkDropStub::~InkDropStub() {} |
| 41 |
| 42 InkDropState InkDropStub::GetTargetInkDropState() const { |
| 43 return InkDropState::HIDDEN; |
| 44 } |
| 45 |
| 46 bool InkDropStub::IsVisible() const { |
| 47 return false; |
| 48 } |
| 49 |
| 50 void InkDropStub::AnimateToState(InkDropState state) {} |
| 51 |
| 52 void InkDropStub::SnapToActivated() {} |
| 53 |
| 54 void InkDropStub::SetHovered(bool is_hovered) {} |
| 55 |
| 56 } // namespace |
| 57 |
| 58 InkDropFactory::InkDropFactory() {} |
| 59 |
| 60 InkDropFactory::~InkDropFactory() {} |
| 61 |
| 62 std::unique_ptr<InkDrop> InkDropFactory::CreateInkDrop( |
| 63 InkDropHost* ink_drop_host) { |
| 64 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 65 return base::WrapUnique(new InkDropImpl(ink_drop_host)); |
| 66 } |
| 67 |
| 68 return base::WrapUnique(new InkDropStub()); |
| 69 } |
| 70 |
| 71 } // namespace views |
| OLD | NEW |