Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / ui / views / animation / ink_drop_delegate.h
blob04434f4a5c3ccd9da65179bbfb60a1bd00e7a35a
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 "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"
12 namespace ui {
13 class Layer;
14 } // namespace ui
16 namespace views {
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 {
21 public:
22 InkDropDelegate(ui::Layer* layer,
23 SkColor color,
24 int circle_radius,
25 int rounded_rect_corner_radius);
26 ~InkDropDelegate() override;
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;
33 bool should_render_circle() const { return should_render_circle_; }
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;
41 private:
42 // The ui::Layer being rendered to.
43 ui::Layer* layer_;
45 // The color to paint.
46 SkColor color_;
48 // When true renders a circle, otherwise renders a rounded rectangle.
49 bool should_render_circle_;
51 // The radius of the circle.
52 const int circle_radius_;
54 // The radius of the rounded rectangles corners.
55 const int rounded_rect_corner_radius_;
57 DISALLOW_COPY_AND_ASSIGN(InkDropDelegate);
60 } // namespace views