summaryrefslogtreecommitdiffstats
path: root/extensions/common/manifest_handler_helpers.cc
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-12-04 12:10:03 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-04 20:11:15 +0000
commit39ea51bd9379fa9aaa974f8b91a559879175e681 (patch)
tree789faed502fbbca877688236cbf5b2780c254b51 /extensions/common/manifest_handler_helpers.cc
parent4e9a0f74389e0745855d939ac9ef900fbaa68fec (diff)
downloadchromium_src-39ea51bd9379fa9aaa974f8b91a559879175e681.zip
chromium_src-39ea51bd9379fa9aaa974f8b91a559879175e681.tar.gz
chromium_src-39ea51bd9379fa9aaa974f8b91a559879175e681.tar.bz2
Handle more scale factors for extension Browser Action icons
Also use 16x16 if provided in Material Design mode. Also, fix size of default icon (generated from extension's first letter) for MD. BUG=564926 Review URL: https://codereview.chromium.org/1492073003 Cr-Commit-Position: refs/heads/master@{#363278}
Diffstat (limited to 'extensions/common/manifest_handler_helpers.cc')
-rw-r--r--extensions/common/manifest_handler_helpers.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/extensions/common/manifest_handler_helpers.cc b/extensions/common/manifest_handler_helpers.cc
index d3dfea6..7186321 100644
--- a/extensions/common/manifest_handler_helpers.cc
+++ b/extensions/common/manifest_handler_helpers.cc
@@ -59,6 +59,27 @@ bool LoadIconsFromDictionary(const base::DictionaryValue* icons_value,
return true;
}
+bool LoadAllIconsFromDictionary(const base::DictionaryValue* icons_value,
+ ExtensionIconSet* icons,
+ base::string16* error) {
+ DCHECK(icons);
+ for (base::DictionaryValue::Iterator iterator(*icons_value);
+ !iterator.IsAtEnd(); iterator.Advance()) {
+ int size = 0;
+ std::string icon_path;
+ if (!base::StringToInt(iterator.key(), &size) ||
+ !iterator.value().GetAsString(&icon_path) ||
+ !NormalizeAndValidatePath(&icon_path)) {
+ *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidIconPath,
+ iterator.key());
+ return false;
+ }
+
+ icons->Add(size, icon_path);
+ }
+ return true;
+}
+
} // namespace manifest_handler_helpers
} // namespace extensions