Chromium Code Reviews| Index: chrome/common/extensions/extension_icon_set.h |
| diff --git a/chrome/common/extensions/extension_icon_set.h b/chrome/common/extensions/extension_icon_set.h |
| index dc58813f27f03bda7afe3ab37e676276fe334fe7..9da1a558d1e401a9acc28feb7c33a427317ab9be 100644 |
| --- a/chrome/common/extensions/extension_icon_set.h |
| +++ b/chrome/common/extensions/extension_icon_set.h |
| @@ -11,9 +11,14 @@ |
| // Represents the set of icons for an extension. |
| class ExtensionIconSet { |
| public: |
| - // NOTE: If you change this list, you should also change kIconSizes in the cc |
| - // file. |
| - enum Icons { |
| + // TODO(tbarzic): add types for extension actions and script badges. |
| + enum IconSetType { |
| + ICON_SET_MANIFEST_ICONS |
| + }; |
| + |
| + // NOTE: If you change this list, you should also change kManifestIconSizes in |
| + // the cc file Icons { |
|
Aaron Boodman
2012/08/10 23:01:57
s/ file Icons {/./
tbarzic
2012/08/11 00:58:45
Done.
|
| + enum ExtensionIcons { |
| EXTENSION_ICON_GIGANTOR = 512, |
| EXTENSION_ICON_EXTRA_LARGE = 256, |
| EXTENSION_ICON_LARGE = 128, |
| @@ -32,14 +37,10 @@ class ExtensionIconSet { |
| MATCH_SMALLER |
| }; |
| - // Access to the underlying map from icon size->path. |
| - typedef std::map<Icons, std::string> IconMap; |
| - |
| - // Icon sizes used by the extension system. |
| - static const Icons kIconSizes[]; |
| - static const size_t kNumIconSizes; |
| + // Access to the underlying map from icon size->{path, bitmap}. |
| + typedef std::map<int, std::string> IconMap; |
| - ExtensionIconSet(); |
| + explicit ExtensionIconSet(IconSetType type); |
| ~ExtensionIconSet(); |
| const IconMap& map() const { return map_; } |
| @@ -47,19 +48,27 @@ class ExtensionIconSet { |
| // Remove all icons from the set. |
| void Clear(); |
| - // Add an icon to the set. If the specified size is already present, it is |
| - // overwritten. |
| - void Add(Icons size, const std::string& path); |
| + // Add an icon path to the set. If a path for the specified size is already |
| + // present, it is overwritten. |
| + void Add(int size, const std::string& path); |
| + // Gets path value of the icon found when searching for |size| using |
| + // |mathc_type|. |
| std::string Get(int size, MatchType match_type) const; |
| - // Returns true if the set contains the specified path. |
| + // Returns true iff the set contains the specified path. |
| bool ContainsPath(const std::string& path) const; |
| // Returns icon size if the set contains the specified path or 0 if not found. |
| - Icons GetIconSizeFromPath(const std::string& path) const; |
| + int GetIconSizeFromPath(const std::string& path) const; |
| + |
| + const int* const allowed_sizes() const { return allowed_sizes_; } |
| + |
| + size_t num_allowed_sizes() const { return num_allowed_sizes_; } |
| private: |
| + const int* allowed_sizes_; |
| + size_t num_allowed_sizes_; |
| IconMap map_; |
| }; |