From 0cb5f50d4ca4adf74fc574b17c3f192cccb74fbe Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Wed, 21 Oct 2009 21:35:47 +0000 Subject: The Management UI now fetches the icon for each extension and shows it on the page. BUG=12119 TEST=Open chrome://extensions and all extensions that have an icon associated with them, should show the icon and those that don't have the generic plugin icon. Review URL: http://codereview.chromium.org/292048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29714 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/extensions_ui.cc | 14 ++++++++++++-- chrome/browser/resources/extensions_ui.html | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index d85d654..3936b69 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -418,9 +418,19 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue( extension_data->SetString(L"description", extension->description()); extension_data->SetString(L"version", extension->version()->GetString()); extension_data->SetBoolean(L"enabled", enabled); - if (!extension->options_url().is_empty()) { + if (!extension->options_url().is_empty()) extension_data->SetString(L"options_url", extension->options_url().spec()); - } + + // Try to fetch the medium sized icon, then (if missing) go for the large one. + const std::map& icons = extension->icons(); + std::map::const_iterator iter = + icons.find(Extension::EXTENSION_ICON_MEDIUM); + if (iter == icons.end()) + iter = icons.find(Extension::EXTENSION_ICON_LARGE); + if (iter != icons.end()) + extension_data->SetString(L"icon", iter->second); + else + extension_data->SetString(L"icon", ""); // Add list of content_script detail DictionaryValues ListValue *content_script_list = new ListValue(); diff --git a/chrome/browser/resources/extensions_ui.html b/chrome/browser/resources/extensions_ui.html index 978edfc..fc63035 100644 --- a/chrome/browser/resources/extensions_ui.html +++ b/chrome/browser/resources/extensions_ui.html @@ -229,6 +229,7 @@ var extensionDataFormat = { "version": "1.0.231", "enabled": "true", "options_url": "options.html", + "icon": "relative-path-to-icon.png", "content_scripts": [ { "js": ["script1_file1.js", "script1_file2.js"], @@ -264,6 +265,7 @@ var extensionDataFormat = { "description": "Extension long format description", "version": "1.0.231", "enabled": "true", + "icon": "", "content_scripts": [ { "js": ["script1_file1.js", "script1_file2.js"], @@ -574,8 +576,17 @@ function autoUpdate() {
- +
+ + + +