Adding Peter Thatcher to the owners file.
[chromium-blink-merge.git] / extensions / common / manifest_handlers / icons_handler.h
blob5c9186d0c15f787e058bc3e03b3683c50c6dd840
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_MANIFEST_HANDLERS_ICONS_HANDLER_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_ICONS_HANDLER_H_
8 #include <string>
10 #include "extensions/common/extension.h"
11 #include "extensions/common/extension_icon_set.h"
12 #include "extensions/common/extension_resource.h"
13 #include "extensions/common/manifest_handler.h"
15 class GURL;
17 namespace extensions {
19 struct IconsInfo : public Extension::ManifestData {
20 // The icons for the extension.
21 ExtensionIconSet icons;
23 // Return the icon set for the given |extension|.
24 static const ExtensionIconSet& GetIcons(const Extension* extension);
26 // Get an extension icon as a resource or URL.
27 static ExtensionResource GetIconResource(
28 const Extension* extension,
29 int size,
30 ExtensionIconSet::MatchType match_type);
31 static GURL GetIconURL(const Extension* extension,
32 int size,
33 ExtensionIconSet::MatchType match_type);
36 // Parses the "icons" manifest key.
37 class IconsHandler : public ManifestHandler {
38 public:
39 IconsHandler();
40 ~IconsHandler() override;
42 bool Parse(Extension* extension, base::string16* error) override;
43 bool Validate(const Extension* extension,
44 std::string* error,
45 std::vector<InstallWarning>* warnings) const override;
47 private:
48 const std::vector<std::string> Keys() const override;
51 } // namespace extensions
53 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_ICONS_HANDLER_H_