Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: ui/views/animation/ink_drop_animation_controller_factory.cc

Issue 1298513003: Implemented prototype for new ink drop specs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from patch set 10. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_animation_controller_factory.h" 5 #include "ui/views/animation/ink_drop_animation_controller_factory.h"
6 6
7 #include "ui/base/resource/material_design/material_design_controller.h" 7 #include "ui/base/resource/material_design/material_design_controller.h"
8 #include "ui/gfx/geometry/rect.h" 8 #include "ui/gfx/geometry/rect.h"
9 #include "ui/gfx/geometry/size.h" 9 #include "ui/gfx/geometry/size.h"
10 #include "ui/views/animation/ink_drop_animation_controller.h" 10 #include "ui/views/animation/ink_drop_animation_controller.h"
11 #include "ui/views/animation/ink_drop_animation_controller_impl.h" 11 #include "ui/views/animation/ink_drop_animation_controller_impl.h"
12 #include "ui/views/views_export.h" 12 #include "ui/views/views_export.h"
13 13
14 namespace views { 14 namespace views {
15 15
16 namespace { 16 namespace {
17 17
18 // A stub implementation of an InkDropAnimationController that can be used when 18 // A stub implementation of an InkDropAnimationController that can be used when
19 // material design is not enabled. 19 // material design is not enabled.
20 class InkDropAnimationControllerStub 20 class InkDropAnimationControllerStub
21 : public InkDropAnimationController { 21 : public InkDropAnimationController {
22 public: 22 public:
23 explicit InkDropAnimationControllerStub(InkDropHost* ink_drop_host); 23 explicit InkDropAnimationControllerStub();
24 ~InkDropAnimationControllerStub() override; 24 ~InkDropAnimationControllerStub() override;
25 25
26 // InkDropAnimationController: 26 // InkDropAnimationController:
27 InkDropState GetInkDropState() const override;
27 void AnimateToState(InkDropState state) override; 28 void AnimateToState(InkDropState state) override;
28 void SetInkDropSize(const gfx::Size& size) override; 29 gfx::Size GetInkDropLargeSize() const override;
29 gfx::Rect GetInkDropBounds() const override; 30 void SetInkDropSize(const gfx::Size& large_size,
30 void SetInkDropBounds(const gfx::Rect& bounds) override; 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;
31 35
32 private: 36 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_;
36
37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub); 37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub);
38 }; 38 };
39 39
40 InkDropAnimationControllerStub::InkDropAnimationControllerStub( 40 InkDropAnimationControllerStub::InkDropAnimationControllerStub() {}
41 InkDropHost* ink_drop_host) {}
42 41
43 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {} 42 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {}
44 43
44 InkDropState InkDropAnimationControllerStub::GetInkDropState() const {
45 return InkDropState::HIDDEN;
46 }
47
45 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {} 48 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {}
46 49
47 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& size) { 50 gfx::Size InkDropAnimationControllerStub::GetInkDropLargeSize() const {
48 ink_drop_bounds_.set_size(size); 51 return gfx::Size();
49 } 52 }
50 53
51 gfx::Rect InkDropAnimationControllerStub::GetInkDropBounds() const { 54 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& large_size,
52 return ink_drop_bounds_; 55 int large_corner_radius,
53 } 56 const gfx::Size& small_size,
57 int small_corner_radius) {}
54 58
55 void InkDropAnimationControllerStub::SetInkDropBounds(const gfx::Rect& bounds) { 59 void InkDropAnimationControllerStub::SetInkDropCenter(
56 ink_drop_bounds_ = bounds; 60 const gfx::Point& center_point) {}
57 }
58 61
59 } // namespace 62 } // namespace
60 63
61 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {} 64 InkDropAnimationControllerFactory::InkDropAnimationControllerFactory() {}
62 65
63 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {} 66 InkDropAnimationControllerFactory::~InkDropAnimationControllerFactory() {}
64 67
65 scoped_ptr<InkDropAnimationController> 68 scoped_ptr<InkDropAnimationController>
66 InkDropAnimationControllerFactory::CreateInkDropAnimationController( 69 InkDropAnimationControllerFactory::CreateInkDropAnimationController(
67 InkDropHost* ink_drop_host) { 70 InkDropHost* ink_drop_host) {
68 #if defined(OS_CHROMEOS) 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.
69 if (ui::MaterialDesignController::IsModeMaterial()) { 74 if (ui::MaterialDesignController::IsModeMaterial()) {
70 return scoped_ptr<InkDropAnimationController>( 75 return scoped_ptr<InkDropAnimationController>(
71 new InkDropAnimationControllerImpl(ink_drop_host)); 76 new InkDropAnimationControllerImpl(ink_drop_host));
72 } else { 77 } else {
73 return scoped_ptr<InkDropAnimationController>( 78 return scoped_ptr<InkDropAnimationController>(
74 new InkDropAnimationControllerStub(ink_drop_host)); 79 new InkDropAnimationControllerStub());
75 } 80 }
76 #endif // defined(OS_CHROMEOS) 81 #endif // defined(OS_CHROMEOS)
77 82
78 return scoped_ptr<InkDropAnimationController>( 83 return scoped_ptr<InkDropAnimationController>(
79 new InkDropAnimationControllerStub(ink_drop_host)); 84 new InkDropAnimationControllerStub());
80 } 85 }
81 86
82 } // namespace views 87 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698