Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / manifest_handlers / icons_handler.h
blob2303755465996ec67e720f6a8298342b7ce3a78e
1 // Copyright (c) 2013 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 CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_ICONS_HANDLER_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_ICONS_HANDLER_H_
8 #include <string>
10 #include "chrome/common/extensions/extension_icon_set.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/extension_resource.h"
13 #include "extensions/common/manifest_handler.h"
15 namespace extensions {
17 struct IconsInfo : public Extension::ManifestData {
18 // Max size (both dimensions) for browser and page actions.
19 static const int kPageActionIconMaxSize;
20 static const int kBrowserActionIconMaxSize;
22 // The icons for the extension.
23 ExtensionIconSet icons;
25 // Return the icon set for the given |extension|.
26 static const ExtensionIconSet& GetIcons(const Extension* extension);
28 // Returns the default extension/app icon (for extensions or apps that don't
29 // have one).
30 static const gfx::ImageSkia& GetDefaultExtensionIcon();
31 static const gfx::ImageSkia& GetDefaultAppIcon();
33 // Get an extension icon as a resource or URL.
34 static ExtensionResource GetIconResource(
35 const Extension* extension,
36 int size,
37 ExtensionIconSet::MatchType match_type);
38 static GURL GetIconURL(const Extension* extension,
39 int size,
40 ExtensionIconSet::MatchType match_type);
43 // Parses the "icons" manifest key.
44 class IconsHandler : public ManifestHandler {
45 public:
46 IconsHandler();
47 virtual ~IconsHandler();
49 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE;
50 virtual bool Validate(const Extension* extension,
51 std::string* error,
52 std::vector<InstallWarning>* warnings) const OVERRIDE;
54 private:
55 virtual const std::vector<std::string> Keys() const OVERRIDE;
58 } // namespace extensions
60 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_ICONS_HANDLER_H_