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

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

Issue 1280953003: Enhance the material design ripple API so the ripple's state can be controlled by it's owning View. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed some comments from patch set 1. Created 5 years, 4 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
(Empty)
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.
4
5 #include "base/callback.h"
6 #include "base/macros.h"
7 #include "third_party/skia/include/core/SkColor.h"
8 #include "ui/compositor/layer_delegate.h"
9 #include "ui/compositor/paint_context.h"
10 #include "ui/gfx/geometry/rect.h"
11
12 namespace ui {
13 class Layer;
14 } // namespace ui
15
16 namespace views {
17
18 // Renders the visual feedback for an ink drop animation. Will render a circle
19 // if |circle_| is true, otherwise renders a rounded rectangle.
20 class InkDropDelegate : public ui::LayerDelegate {
tdanderson 2015/08/10 16:31:01 Would it ever be necessary to introduce subclasses
bruthig 2015/08/10 21:57:15 Perhaps why do you ask? If the states are the sam
tdanderson 2015/08/11 12:57:37 I don't see any problems, I was just curious. Look
21 public:
22 InkDropDelegate(ui::Layer* layer,
23 SkColor color,
24 int circle_radius,
25 int rounded_rect_corner_radius);
26 ~InkDropDelegate() override;
27
28 // Sets the visual style of the feedback.
29 void set_should_render_circle(bool should_render_circle) {
30 should_render_circle_ = should_render_circle;
31 }
32
33 bool should_render_circle() { return should_render_circle_; }
34
35 // ui::LayerDelegate:
36 void OnPaintLayer(const ui::PaintContext& context) override;
37 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
38 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
39 base::Closure PrepareForLayerBoundsChange() override;
40
41 private:
42 SkColor color() { return color_; }
43
44 ui::Layer* layer() { return layer_; }
tdanderson 2015/08/10 16:31:01 What's the point of having the private accessors c
bruthig 2015/08/10 21:57:15 Whoops, this was left over from experimental work
45
46 // The ui::Layer being rendered to.
47 ui::Layer* layer_;
48
49 // The color to paint.
50 SkColor color_;
51
52 // When true renders a circle, otherwise renders a rounded rectangle.
53 bool should_render_circle_;
54
55 // The radius of the circle.
56 const int circle_radius_;
57
58 // The radius of the rounded rectangles corners.
59 const int rounded_rect_corner_radius_;
60
61 DISALLOW_COPY_AND_ASSIGN(InkDropDelegate);
62 };
63
64 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698