| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_THEME_HANDLER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_THEME_HANDLER_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_THEME_HANDLER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_THEME_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
| 10 #include "extensions/common/manifest_handler.h" | 12 #include "extensions/common/manifest_handler.h" |
| 11 | 13 |
| 12 namespace base { | 14 namespace base { |
| 13 class DictionaryValue; | 15 class DictionaryValue; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace extensions { | 18 namespace extensions { |
| 17 | 19 |
| 18 // A structure to hold the parsed theme data. | 20 // A structure to hold the parsed theme data. |
| 19 struct ThemeInfo : public Extension::ManifestData { | 21 struct ThemeInfo : public Extension::ManifestData { |
| 20 // Define out of line constructor/destructor to please Clang. | 22 // Define out of line constructor/destructor to please Clang. |
| 21 ThemeInfo(); | 23 ThemeInfo(); |
| 22 ~ThemeInfo() override; | 24 ~ThemeInfo() override; |
| 23 | 25 |
| 24 static const base::DictionaryValue* GetImages(const Extension* extension); | 26 static const base::DictionaryValue* GetImages(const Extension* extension); |
| 25 static const base::DictionaryValue* GetColors(const Extension* extension); | 27 static const base::DictionaryValue* GetColors(const Extension* extension); |
| 26 static const base::DictionaryValue* GetTints(const Extension* extension); | 28 static const base::DictionaryValue* GetTints(const Extension* extension); |
| 27 static const base::DictionaryValue* GetDisplayProperties( | 29 static const base::DictionaryValue* GetDisplayProperties( |
| 28 const Extension* extension); | 30 const Extension* extension); |
| 29 | 31 |
| 30 // A map of resource id's to relative file paths. | 32 // A map of resource id's to relative file paths. |
| 31 scoped_ptr<base::DictionaryValue> theme_images_; | 33 std::unique_ptr<base::DictionaryValue> theme_images_; |
| 32 | 34 |
| 33 // A map of color names to colors. | 35 // A map of color names to colors. |
| 34 scoped_ptr<base::DictionaryValue> theme_colors_; | 36 std::unique_ptr<base::DictionaryValue> theme_colors_; |
| 35 | 37 |
| 36 // A map of color names to colors. | 38 // A map of color names to colors. |
| 37 scoped_ptr<base::DictionaryValue> theme_tints_; | 39 std::unique_ptr<base::DictionaryValue> theme_tints_; |
| 38 | 40 |
| 39 // A map of display properties. | 41 // A map of display properties. |
| 40 scoped_ptr<base::DictionaryValue> theme_display_properties_; | 42 std::unique_ptr<base::DictionaryValue> theme_display_properties_; |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 // Parses the "theme" manifest key. | 45 // Parses the "theme" manifest key. |
| 44 class ThemeHandler : public ManifestHandler { | 46 class ThemeHandler : public ManifestHandler { |
| 45 public: | 47 public: |
| 46 ThemeHandler(); | 48 ThemeHandler(); |
| 47 ~ThemeHandler() override; | 49 ~ThemeHandler() override; |
| 48 | 50 |
| 49 bool Parse(Extension* extension, base::string16* error) override; | 51 bool Parse(Extension* extension, base::string16* error) override; |
| 50 bool Validate(const Extension* extension, | 52 bool Validate(const Extension* extension, |
| 51 std::string* error, | 53 std::string* error, |
| 52 std::vector<InstallWarning>* warnings) const override; | 54 std::vector<InstallWarning>* warnings) const override; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 const std::vector<std::string> Keys() const override; | 57 const std::vector<std::string> Keys() const override; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(ThemeHandler); | 59 DISALLOW_COPY_AND_ASSIGN(ThemeHandler); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 } // namespace extensions | 62 } // namespace extensions |
| 61 | 63 |
| 62 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_THEME_HANDLER_H_ | 64 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_THEME_HANDLER_H_ |
| OLD | NEW |