Move Ash-specific vector icons to ash/common/resources
Adds the initial plumbing needed in order to move
Ash-specific .icon files out of ui/gfx/vector_icons
and into ash/common/resources/vector_icons. As a
result, these icons will only be included when the
'ash' component is built.
Previously, the icon file foo_bar.icon would be
identified in code as the enum value
gfx::VectorIconId::FOO_BAR. For Ash-specific icons,
foo_bar.icon is now identified in code as the
constant ash::kFooBarIcon, which maps to a
VectorIcon struct (also introduced in this CL).
The eventual goal is for all icons to be identified
in this manner, and for the gfx::VectorIconId struct
to be removed.
BUG=626786
TEST=manual
Review-Url: https://codereview.chromium.org/2251643011
Cr-Commit-Position: refs/heads/master@{#415782}
diff --git a/ui/gfx/paint_vector_icon.h b/ui/gfx/paint_vector_icon.h
index d069c89..0b84d85 100644
--- a/ui/gfx/paint_vector_icon.h
+++ b/ui/gfx/paint_vector_icon.h
@@ -12,8 +12,11 @@
namespace gfx {
class Canvas;
+struct VectorIcon;
enum class VectorIconId;
+GFX_EXPORT extern const VectorIcon kNoneIcon;
+
// Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size|
// is the length of a single edge of the square icon, in device independent
// pixels. |color| is used as the fill.
@@ -21,16 +24,24 @@
VectorIconId id,
int dip_size,
SkColor color);
+GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
+ const VectorIcon& icon,
+ int dip_size,
+ SkColor color);
// Creates an ImageSkia which will render the icon on demand. The size will come
// from the .icon file (the 1x version, if multiple versions exist).
GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id,
SkColor color);
+GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color);
// As above, but creates the image at the given size.
GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id,
int dip_size,
SkColor color);
+GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon& icon,
+ int dip_size,
+ SkColor color);
// As above, but also paints a badge defined by |badge_id| on top of the icon.
// The badge uses the same canvas size and default color as the icon.
@@ -38,6 +49,10 @@
int dip_size,
SkColor color,
VectorIconId badge_id);
+GFX_EXPORT ImageSkia CreateVectorIconWithBadge(const VectorIcon& icon,
+ int dip_size,
+ SkColor color,
+ const VectorIcon& badge_icon);
#if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION)
// Takes a string of the format expected of .icon files and renders onto