| 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_factory.h" | 5 #include "ui/views/animation/ink_drop_factory.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.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_impl.h" | 13 #include "ui/views/animation/ink_drop_impl.h" |
| 14 #include "ui/views/animation/ink_drop_stub.h" |
| 14 #include "ui/views/views_export.h" | 15 #include "ui/views/views_export.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 | 18 |
| 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 InkDropStub() {} | |
| 25 ~InkDropStub() override {} | |
| 26 | |
| 27 // InkDrop: | |
| 28 InkDropState GetTargetInkDropState() const override { | |
| 29 return InkDropState::HIDDEN; | |
| 30 } | |
| 31 bool IsVisible() const override { return false; } | |
| 32 void AnimateToState(InkDropState state) override {} | |
| 33 void SnapToActivated() override {} | |
| 34 void SetHovered(bool is_hovered) override {} | |
| 35 void SetFocused(bool is_hovered) override {} | |
| 36 | |
| 37 private: | |
| 38 DISALLOW_COPY_AND_ASSIGN(InkDropStub); | |
| 39 }; | |
| 40 | |
| 41 } // namespace | |
| 42 | |
| 43 InkDropFactory::InkDropFactory() {} | 19 InkDropFactory::InkDropFactory() {} |
| 44 | 20 |
| 45 InkDropFactory::~InkDropFactory() {} | 21 InkDropFactory::~InkDropFactory() {} |
| 46 | 22 |
| 47 std::unique_ptr<InkDrop> InkDropFactory::CreateInkDrop( | 23 std::unique_ptr<InkDrop> InkDropFactory::CreateInkDrop( |
| 48 InkDropHost* ink_drop_host) { | 24 InkDropHost* ink_drop_host) { |
| 49 if (ui::MaterialDesignController::IsModeMaterial()) { | 25 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 50 return base::WrapUnique(new InkDropImpl(ink_drop_host)); | 26 return base::WrapUnique(new InkDropImpl(ink_drop_host)); |
| 51 } | 27 } |
| 52 | 28 |
| 53 return base::WrapUnique(new InkDropStub()); | 29 return base::WrapUnique(new InkDropStub()); |
| 54 } | 30 } |
| 55 | 31 |
| 56 } // namespace views | 32 } // namespace views |
| OLD | NEW |