diff options
author | estade <estade@chromium.org> | 2015-12-04 12:10:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-04 20:11:15 +0000 |
commit | 39ea51bd9379fa9aaa974f8b91a559879175e681 (patch) | |
tree | 789faed502fbbca877688236cbf5b2780c254b51 /extensions/common/manifest_handler_helpers.cc | |
parent | 4e9a0f74389e0745855d939ac9ef900fbaa68fec (diff) | |
download | chromium_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.cc | 21 |
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 |