[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / common / icon_with_badge_image_source.h
blob3270ce3244dd5095f35c2f74c3f51a8d347d4c82
1 // Copyright (c) 2012 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 #ifndef CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_
6 #define CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_
8 #include <string>
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/gfx/image/canvas_image_source.h"
12 #include "ui/gfx/image/image.h"
14 namespace gfx {
15 class Size;
18 // CanvasImageSource for creating extension icon with a badge.
19 // TODO(devlin): This class and its buddy badge_util don't really belong in
20 // chrome/common/.
21 class IconWithBadgeImageSource : public gfx::CanvasImageSource {
22 public:
23 // The data representing a badge to be painted over the base image.
24 struct Badge {
25 Badge(std::string text, SkColor text_color, SkColor background_color);
26 ~Badge();
28 std::string text;
29 SkColor text_color;
30 SkColor background_color;
32 private:
33 DISALLOW_COPY_AND_ASSIGN(Badge);
36 explicit IconWithBadgeImageSource(const gfx::Size& size);
37 ~IconWithBadgeImageSource() override;
39 void SetIcon(const gfx::Image& icon);
40 void SetBadge(scoped_ptr<Badge> badge);
41 void set_grayscale(bool grayscale) { grayscale_ = grayscale; }
42 void set_paint_decoration(bool paint_decoration) {
43 paint_decoration_ = paint_decoration;
46 bool grayscale() const { return grayscale_; }
47 bool paint_decoration() const { return paint_decoration_; }
49 private:
50 // gfx::CanvasImageSource:
51 void Draw(gfx::Canvas* canvas) override;
53 // Paints a decoration over the base icon to indicate that the action wants to
54 // run.
55 void PaintDecoration(gfx::Canvas* canvas);
57 // The base icon to draw.
58 gfx::Image icon_;
60 // An optional badge to draw over the base icon.
61 scoped_ptr<Badge> badge_;
63 // Whether or not the icon should be grayscaled (e.g., to show it is
64 // disabled).
65 bool grayscale_;
67 // Whether or not to paint a decoration over the base icon to indicate the
68 // represented action wants to run.
69 bool paint_decoration_;
71 DISALLOW_COPY_AND_ASSIGN(IconWithBadgeImageSource);
74 #endif // CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_