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

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

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed the diff delta to depend on correct branch. Created 5 years, 2 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(); 23 explicit InkDropAnimationControllerStub();
24 ~InkDropAnimationControllerStub() override; 24 ~InkDropAnimationControllerStub() override;
25 25
26 // InkDropAnimationController: 26 // InkDropAnimationController:
27 InkDropState GetInkDropState() const override; 27 InkDropState GetInkDropState() const override;
28 void AnimateToState(InkDropState state) override; 28 void AnimateToState(InkDropState state) override;
29 void SetHovered(bool is_hovered) override;
30 bool IsHovered() const override;
29 gfx::Size GetInkDropLargeSize() const override; 31 gfx::Size GetInkDropLargeSize() const override;
30 void SetInkDropSize(const gfx::Size& large_size, 32 void SetInkDropSize(const gfx::Size& large_size,
31 int large_corner_radius, 33 int large_corner_radius,
32 const gfx::Size& small_size, 34 const gfx::Size& small_size,
33 int small_corner_radius) override; 35 int small_corner_radius) override;
34 void SetInkDropCenter(const gfx::Point& center_point) override; 36 void SetInkDropCenter(const gfx::Point& center_point) override;
35 37
36 private: 38 private:
39 // Tracks whether the ink drop is hovered or not. This is used to ensure that
40 // this behaves like all other InkDropAnimationController implementations.
41 bool is_hovered_;
42
37 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub); 43 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerStub);
38 }; 44 };
39 45
40 InkDropAnimationControllerStub::InkDropAnimationControllerStub() {} 46 InkDropAnimationControllerStub::InkDropAnimationControllerStub()
47 : is_hovered_(false) {}
41 48
42 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {} 49 InkDropAnimationControllerStub::~InkDropAnimationControllerStub() {}
43 50
44 InkDropState InkDropAnimationControllerStub::GetInkDropState() const { 51 InkDropState InkDropAnimationControllerStub::GetInkDropState() const {
45 return InkDropState::HIDDEN; 52 return InkDropState::HIDDEN;
46 } 53 }
47 54
48 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {} 55 void InkDropAnimationControllerStub::AnimateToState(InkDropState state) {}
49 56
57 void InkDropAnimationControllerStub::SetHovered(bool is_hovered) {
58 is_hovered_ = is_hovered;
59 }
60
61 bool InkDropAnimationControllerStub::IsHovered() const {
62 return is_hovered_;
63 }
64
50 gfx::Size InkDropAnimationControllerStub::GetInkDropLargeSize() const { 65 gfx::Size InkDropAnimationControllerStub::GetInkDropLargeSize() const {
51 return gfx::Size(); 66 return gfx::Size();
52 } 67 }
53 68
54 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& large_size, 69 void InkDropAnimationControllerStub::SetInkDropSize(const gfx::Size& large_size,
55 int large_corner_radius, 70 int large_corner_radius,
56 const gfx::Size& small_size, 71 const gfx::Size& small_size,
57 int small_corner_radius) {} 72 int small_corner_radius) {}
58 73
59 void InkDropAnimationControllerStub::SetInkDropCenter( 74 void InkDropAnimationControllerStub::SetInkDropCenter(
(...skipping 11 matching lines...) Expand all
71 if (ui::MaterialDesignController::IsModeMaterial()) { 86 if (ui::MaterialDesignController::IsModeMaterial()) {
72 return scoped_ptr<InkDropAnimationController>( 87 return scoped_ptr<InkDropAnimationController>(
73 new InkDropAnimationControllerImpl(ink_drop_host)); 88 new InkDropAnimationControllerImpl(ink_drop_host));
74 } 89 }
75 90
76 return scoped_ptr<InkDropAnimationController>( 91 return scoped_ptr<InkDropAnimationController>(
77 new InkDropAnimationControllerStub()); 92 new InkDropAnimationControllerStub());
78 } 93 }
79 94
80 } // namespace views 95 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698