1 // Copyright 2014 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 EXTENSIONS_COMMON_EXTENSION_ICON_SET_H_
6 #define EXTENSIONS_COMMON_EXTENSION_ICON_SET_H_
16 // Represents the set of icons for an extension.
17 class ExtensionIconSet
{
19 // Get an icon from the set, optionally falling back to a smaller or bigger
20 // size. MatchType is exclusive (do not OR them together).
27 // Access to the underlying map from icon size->{path, bitmap}.
28 typedef std::map
<int, std::string
> IconMap
;
33 const IconMap
& map() const { return map_
; }
34 bool empty() const { return map_
.empty(); }
36 // Remove all icons from the set.
39 // Add an icon path to the set. If a path for the specified size is already
40 // present, it is overwritten.
41 void Add(int size
, const std::string
& path
);
43 // Gets path value of the icon found when searching for |size| using
45 const std::string
& Get(int size
, MatchType match_type
) const;
47 // Returns true iff the set contains the specified path.
48 bool ContainsPath(const std::string
& path
) const;
50 // Returns icon size if the set contains the specified path or 0 if not found.
51 int GetIconSizeFromPath(const std::string
& path
) const;
53 // Add the paths of all icons in this set into |paths|, handling the
54 // conversion of (string) -> (base::FilePath). Note that these paths are not
55 // validated in any way, so they may be invalid paths or reference
57 void GetPaths(std::set
<base::FilePath
>* paths
) const;
63 #endif // EXTENSIONS_COMMON_EXTENSION_ICON_SET_H_