Update V8 to version 4.7.1.
[chromium-blink-merge.git] / ui / views / animation / ink_drop_animation_controller_factory.cc
blob6a476d91d5873841150993c3b4f8c2f86e05e9e4
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"
14 namespace views {
16 namespace {
18 // A stub implementation of an InkDropAnimationController that can be used when
19 // material design is not enabled.
20 class InkDropAnimationControllerStub
21 : public InkDropAnimationController {
22 public:
23 explicit InkDropAnimationControllerStub(InkDropHost* ink_drop_host);
24 ~InkDropAnimationControllerStub() override;
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;
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_;
37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub);
40 InkDropAnimationControllerStub::InkDropAnimationControllerStub(
41 InkDropHost* ink_drop_host) {}
43 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {}
45 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {}
47 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& size) {
48 ink_drop_bounds_.set_size(size);
51 gfx::Rect InkDropAnimationControllerStub::GetInkDropBounds() const {
52 return ink_drop_bounds_;
55 void InkDropAnimationControllerStub::SetInkDropBounds(const gfx::Rect& bounds) {
56 ink_drop_bounds_ = bounds;
59 } // namespace
61 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {}
63 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {}
65 scoped_ptr<InkDropAnimationController>
66 InkDropAnimationControllerFactory::CreateInkDropAnimationController(
67 InkDropHost* ink_drop_host) {
68 #if defined(OS_CHROMEOS)
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));
76 #endif // defined(OS_CHROMEOS)
78 return scoped_ptr<InkDropAnimationController>(
79 new InkDropAnimationControllerStub(ink_drop_host));
82 } // namespace views