| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_ | 5 #ifndef CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_ |
| 6 #define CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_ | 6 #define CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 11 #include "ui/gfx/image/canvas_image_source.h" | 11 #include "ui/gfx/image/canvas_image_source.h" |
| 12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Size; | 15 class Size; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // CanvasImageSource for creating extension icon with a badge. | 18 // CanvasImageSource for creating extension icon with a badge. |
| 19 class IconWithBadgeImageSource | 19 class IconWithBadgeImageSource |
| 20 : public gfx::CanvasImageSource { | 20 : public gfx::CanvasImageSource { |
| 21 public: | 21 public: |
| 22 IconWithBadgeImageSource( | 22 IconWithBadgeImageSource( |
| 23 const gfx::ImageSkia& icon, | 23 const gfx::ImageSkia& icon, |
| 24 const gfx::Size& icon_size, | 24 const gfx::Size& icon_size, |
| 25 const gfx::Size& spacing, | 25 const gfx::Size& spacing, |
| 26 const std::string& text, | 26 const std::string& text, |
| 27 const SkColor& text_color, | 27 const SkColor& text_color, |
| 28 const SkColor& background_color, | 28 const SkColor& background_color, |
| 29 extensions::Extension::ActionInfo::Type action_type); | 29 extensions::ActionInfo::Type action_type); |
| 30 virtual ~IconWithBadgeImageSource(); | 30 virtual ~IconWithBadgeImageSource(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 virtual void Draw(gfx::Canvas* canvas) OVERRIDE; | 33 virtual void Draw(gfx::Canvas* canvas) OVERRIDE; |
| 34 | 34 |
| 35 // Browser action icon image. | 35 // Browser action icon image. |
| 36 gfx::ImageSkia icon_; | 36 gfx::ImageSkia icon_; |
| 37 | 37 |
| 38 // Extra spacing for badge compared to icon bounds. | 38 // Extra spacing for badge compared to icon bounds. |
| 39 gfx::Size spacing_; | 39 gfx::Size spacing_; |
| 40 | 40 |
| 41 // Text to be displayed on the badge. | 41 // Text to be displayed on the badge. |
| 42 std::string text_; | 42 std::string text_; |
| 43 | 43 |
| 44 // Color of badge text. | 44 // Color of badge text. |
| 45 SkColor text_color_; | 45 SkColor text_color_; |
| 46 | 46 |
| 47 // Color of the badge. | 47 // Color of the badge. |
| 48 SkColor background_color_; | 48 SkColor background_color_; |
| 49 | 49 |
| 50 // Type of extension action this is for. | 50 // Type of extension action this is for. |
| 51 extensions::Extension::ActionInfo::Type action_type_; | 51 extensions::ActionInfo::Type action_type_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(IconWithBadgeImageSource); | 53 DISALLOW_COPY_AND_ASSIGN(IconWithBadgeImageSource); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 #endif // CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_ | 56 #endif // CHROME_COMMON_ICON_WITH_BADGE_IMAGE_SOURCE_H_ |
| OLD | NEW |