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.
5 #include "ui/views/animation/ink_drop_animation_controller_factory.h"
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"
18 // A stub implementation of an InkDropAnimationController that can be used when
19 // material design is not enabled.
20 class InkDropAnimationControllerStub
21 : public InkDropAnimationController
{
23 explicit InkDropAnimationControllerStub();
24 ~InkDropAnimationControllerStub() override
;
26 // InkDropAnimationController:
27 InkDropState
GetInkDropState() const override
;
28 void AnimateToState(InkDropState state
) override
;
29 gfx::Size
GetInkDropLargeSize() const override
;
30 void SetInkDropSize(const gfx::Size
& large_size
,
31 int large_corner_radius
,
32 const gfx::Size
& small_size
,
33 int small_corner_radius
) override
;
34 void SetInkDropCenter(const gfx::Point
& center_point
) override
;
37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub
);
40 InkDropAnimationControllerStub::InkDropAnimationControllerStub() {}
42 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {}
44 InkDropState
InkDropAnimationControllerStub::GetInkDropState() const {
45 return InkDropState::HIDDEN
;
48 void InkDropAnimationControllerStub::AnimateToState(InkDropState state
) {}
50 gfx::Size
InkDropAnimationControllerStub::GetInkDropLargeSize() const {
54 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size
& large_size
,
55 int large_corner_radius
,
56 const gfx::Size
& small_size
,
57 int small_corner_radius
) {}
59 void InkDropAnimationControllerStub::SetInkDropCenter(
60 const gfx::Point
& center_point
) {}
64 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {}
66 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {}
68 scoped_ptr
<InkDropAnimationController
>
69 InkDropAnimationControllerFactory::CreateInkDropAnimationController(
70 InkDropHost
* ink_drop_host
) {
71 #if defined(OS_CHROMEOS)
72 // The ink drop animation is only targeted at ChromeOS because there is
73 // concern it will conflict with OS level touch feedback in a bad way.
74 if (ui::MaterialDesignController::IsModeMaterial()) {
75 return scoped_ptr
<InkDropAnimationController
>(
76 new InkDropAnimationControllerImpl(ink_drop_host
));
78 return scoped_ptr
<InkDropAnimationController
>(
79 new InkDropAnimationControllerStub());
81 #endif // defined(OS_CHROMEOS)
83 return scoped_ptr
<InkDropAnimationController
>(
84 new InkDropAnimationControllerStub());