| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_ICONS_HANDLER_H_ | |
| 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_ICONS_HANDLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 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" | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 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; | |
| 21 | |
| 22 // The icons for the extension. | |
| 23 ExtensionIconSet icons; | |
| 24 | |
| 25 // Return the icon set for the given |extension|. | |
| 26 static const ExtensionIconSet& GetIcons(const Extension* extension); | |
| 27 | |
| 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(); | |
| 32 | |
| 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); | |
| 41 }; | |
| 42 | |
| 43 // Parses the "icons" manifest key. | |
| 44 class IconsHandler : public ManifestHandler { | |
| 45 public: | |
| 46 IconsHandler(); | |
| 47 virtual ~IconsHandler(); | |
| 48 | |
| 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; | |
| 53 | |
| 54 private: | |
| 55 virtual const std::vector<std::string> Keys() const OVERRIDE; | |
| 56 }; | |
| 57 | |
| 58 } // namespace extensions | |
| 59 | |
| 60 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_ICONS_HANDLER_H_ | |
| OLD | NEW |