Chromium Code Reviews| 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 "ui/base/resource/material_design/material_design_controller.h" | |
| 8 #include "ui/gfx/geometry/rect.h" | |
| 9 #include "ui/gfx/geometry/size.h" | |
| 10 #include "ui/views/animation/ink_drop_animation_controller.h" | |
| 11 #include "ui/views/animation/ink_drop_animation_controller_impl.h" | |
| 12 #include "ui/views/views_export.h" | |
| 13 | |
| 14 namespace views { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 // A stub implementation of an InkDropAnimationController that can be used when | |
| 19 // material design is not enabled. | |
| 20 class VIEWS_EXPORT InkDropAnimationControllerStub | |
| 21 : public InkDropAnimationController { | |
|
jonross
2015/08/11 20:34:46
Why not just have InkDropAnimationController conta
bruthig
2015/08/12 15:26:40
Since InkDropAnimationController is purely virtual
| |
| 22 public: | |
| 23 explicit InkDropAnimationControllerStub(InkDropHost* ink_drop_host); | |
| 24 ~InkDropAnimationControllerStub() override; | |
| 25 | |
| 26 // InkDropAnimationController: | |
| 27 void AnimateToState(InkDropState state) override; | |
| 28 void SetInkDropSize(const gfx::Size& size) override; | |
| 29 gfx::Rect GetInkDropBounds() const override; | |
| 30 void SetInkDropBounds(const gfx::Rect& bounds) override; | |
| 31 | |
| 32 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_; | |
|
tdanderson
2015/08/11 19:07:41
Do you actually need to have this member in the st
bruthig
2015/08/12 15:26:40
I put this in, in case any of the InkDropHosts or
| |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub); | |
| 38 }; | |
| 39 | |
| 40 InkDropAnimationControllerStub::InkDropAnimationControllerStub( | |
| 41 InkDropHost* ink_drop_host) | |
| 42 : InkDropAnimationController(ink_drop_host) {} | |
| 43 | |
| 44 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {} | |
| 45 | |
| 46 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {} | |
| 47 | |
| 48 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& size) { | |
| 49 ink_drop_bounds_.set_size(size); | |
| 50 } | |
| 51 | |
| 52 gfx::Rect InkDropAnimationControllerStub::GetInkDropBounds() const { | |
| 53 return ink_drop_bounds_; | |
| 54 } | |
| 55 | |
| 56 void InkDropAnimationControllerStub::SetInkDropBounds(const gfx::Rect& bounds) { | |
| 57 ink_drop_bounds_ = bounds; | |
| 58 } | |
| 59 | |
| 60 } // namespace | |
| 61 | |
| 62 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {} | |
| 63 | |
| 64 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {} | |
| 65 | |
| 66 scoped_ptr<InkDropAnimationController> | |
| 67 InkDropAnimationControllerFactory::CreateInkDropAnimationController( | |
| 68 InkDropHost* ink_drop_host) { | |
| 69 if (ui::MaterialDesignController::IsModeMaterial()) { | |
| 70 return scoped_ptr<InkDropAnimationController>( | |
| 71 new InkDropAnimationControllerImpl(ink_drop_host)); | |
| 72 } else { | |
| 73 return scoped_ptr<InkDropAnimationController>( | |
| 74 new InkDropAnimationControllerStub(ink_drop_host)); | |
| 75 } | |
| 76 } | |
| 77 | |
| 78 } // namespace views | |
| OLD | NEW |