summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/manifest_handlers/theme_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/manifest_handlers/theme_handler.cc')
-rw-r--r--chrome/common/extensions/manifest_handlers/theme_handler.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/common/extensions/manifest_handlers/theme_handler.cc b/chrome/common/extensions/manifest_handlers/theme_handler.cc
index ec2842f..e9a9a1e 100644
--- a/chrome/common/extensions/manifest_handlers/theme_handler.cc
+++ b/chrome/common/extensions/manifest_handlers/theme_handler.cc
@@ -30,7 +30,24 @@ bool LoadImages(const DictionaryValue* theme_value,
// Validate that the images are all strings.
for (DictionaryValue::Iterator iter(*images_value); !iter.IsAtEnd();
iter.Advance()) {
- if (!iter.value().IsType(Value::TYPE_STRING)) {
+ // The value may be a dictionary of scales and files paths.
+ // Or the value may be a file path, in which case a scale
+ // of 100% is assumed.
+ if (iter.value().IsType(Value::TYPE_DICTIONARY)) {
+ const DictionaryValue* inner_value = NULL;
+ if (iter.value().GetAsDictionary(&inner_value)) {
+ for (DictionaryValue::Iterator inner_iter(*inner_value);
+ !inner_iter.IsAtEnd(); inner_iter.Advance()) {
+ if (!inner_iter.value().IsType(Value::TYPE_STRING)) {
+ *error = ASCIIToUTF16(errors::kInvalidThemeImages);
+ return false;
+ }
+ }
+ } else {
+ *error = ASCIIToUTF16(errors::kInvalidThemeImages);
+ return false;
+ }
+ } else if (!iter.value().IsType(Value::TYPE_STRING)) {
*error = ASCIIToUTF16(errors::kInvalidThemeImages);
return false;
}