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

Side by Side Diff: ui/views/animation/ink_drop_animation_controller_impl.h

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 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/geometry/size.h" 10 #include "ui/gfx/geometry/size.h"
11 #include "ui/views/animation/ink_drop_animation_controller.h" 11 #include "ui/views/animation/ink_drop_animation_controller.h"
12 #include "ui/views/views_export.h" 12 #include "ui/views/views_export.h"
13 13
14 namespace views { 14 namespace views {
15 class InkDropAnimation; 15 class InkDropAnimation;
16 class InkDropHost; 16 class InkDropHost;
17 17
18 // Controls an ink drop animation which is hosted by an InkDropHost. 18 // A functional implementation of an InkDropAnimationController.
19 class VIEWS_EXPORT InkDropAnimationControllerImpl 19 class VIEWS_EXPORT InkDropAnimationControllerImpl
20 : public InkDropAnimationController { 20 : public InkDropAnimationController {
21 public: 21 public:
22 // Constructs an ink drop controller that will attach the ink drop to the 22 // Constructs an ink drop controller that will attach the ink drop to the
23 // given |ink_drop_host|. 23 // given |ink_drop_host|.
24 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); 24 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host);
25 ~InkDropAnimationControllerImpl() override; 25 ~InkDropAnimationControllerImpl() override;
26 26
27 // InkDropAnimationController: 27 // InkDropAnimationController:
28 InkDropState GetInkDropState() const override;
28 void AnimateToState(InkDropState state) override; 29 void AnimateToState(InkDropState state) override;
29 void SetInkDropSize(const gfx::Size& size) override; 30 gfx::Size GetInkDropLargeSize() const override;
30 gfx::Rect GetInkDropBounds() const override; 31 void SetInkDropSize(const gfx::Size& large_size,
31 void SetInkDropBounds(const gfx::Rect& bounds) override; 32 int large_corner_radius,
33 const gfx::Size& small_size,
34 int small_corner_radius) override;
35 void SetInkDropCenter(const gfx::Point& center_point) override;
32 36
33 private: 37 private:
38 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If
39 // |ink_drop_animation_| wasn't null then it will be removed from the
40 // |ink_drop_host_|.
41 void CreateInkDropAnimation();
42
34 // The host of the ink drop. 43 // The host of the ink drop.
35 InkDropHost* ink_drop_host_; 44 InkDropHost* ink_drop_host_;
36 45
37 // TODO(bruthig): It will be expensive to maintain InkDropAnimation instances 46 // Cached size for the ink drop's large size animations.
38 // when they are not actually being used. Consider creating InkDropAnimations 47 gfx::Size ink_drop_large_size_;
39 // on an as-needed basis and if construction is also expensive then consider 48
40 // creating an InkDropAnimationPool. See www.crbug.com/522175. 49 // Cached corner radius for the ink drop's large size animations.
50 int ink_drop_large_corner_radius_;
51
52 // Cached size for the ink drop's small size animations.
53 gfx::Size ink_drop_small_size_;
54
55 // Cached corner radius for the ink drop's small size animations.
56 int ink_drop_small_corner_radius_;
57
58 // Cached center point for the ink drop.
59 gfx::Point ink_drop_center_;
60
61 // The current InkDropAnimation. Created on demand using
62 // CreateInkDropAnimation().
41 scoped_ptr<InkDropAnimation> ink_drop_animation_; 63 scoped_ptr<InkDropAnimation> ink_drop_animation_;
42 64
43 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); 65 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl);
44 }; 66 };
45 67
46 } // namespace views 68 } // namespace views
47 69
48 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 70 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698