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_
10 #include "chrome/common/extensions/api/extension_action/action_info.h"
11 #include "ui/gfx/image/canvas_image_source.h"
12 #include "ui/gfx/image/image_skia.h"
18 // CanvasImageSource for creating extension icon with a badge.
19 class IconWithBadgeImageSource
20 : public gfx::CanvasImageSource {
22 IconWithBadgeImageSource(
23 const gfx::ImageSkia& icon,
24 const gfx::Size& icon_size,
25 const gfx::Size& spacing,
26 const std::string& text,
27 const SkColor& text_color,
28 const SkColor& background_color,
29 extensions::ActionInfo::Type action_type);
30 ~IconWithBadgeImageSource() override;
33 void Draw(gfx::Canvas* canvas) override;
35 // Browser action icon image.
38 // Extra spacing for badge compared to icon bounds.
41 // Text to be displayed on the badge.
44 // Color of badge text.
47 // Color of the badge.
48 SkColor background_color_;
50 // Type of extension action this is for.
51 extensions::ActionInfo::Type action_type_;
53 DISALLOW_COPY_AND_ASSIGN(IconWithBadgeImageSource);
56 #endif // CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_