diff options
7 files changed, 30 insertions, 7 deletions
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<int, std::string>& icons = extension->icons(); + std::map<int, std::string>::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() { <div class="extension" jsselect="extensions"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> - <td width="62" align="center" valign="top"><img width="48" height="48" - src="../../app/theme/infobar_plugin.png" /></td> + <td width="62" align="center" valign="top"> + <span jsdisplay="icon" + ><img + jsvalues=".src:'chrome-extension://' + id + '/' + icon" + width="48" height="48" /> + </span> + <span jsdisplay="icon == ''" + ><img + width="48" height="48" + src="../../app/theme/infobar_plugin.png" /></span> + </td> <td valign="top"> <div> <span class="extension-name" diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index e6e5e14..17cd0dc 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -1127,8 +1127,7 @@ void Extension::SetBackgroundPageReady() { } ExtensionResource Extension::GetIconPath(Icons icon) { - std::map<int, std::string>::const_iterator iter = - icons_.find(Extension::EXTENSION_ICON_LARGE); + std::map<int, std::string>::const_iterator iter = icons_.find(icon); if (iter == icons_.end()) return ExtensionResource(); return GetResource(iter->second); diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 14258c9..38da546 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -224,7 +224,7 @@ class Extension { bool HasAccessToAllHosts() const; const GURL& update_url() const { return update_url_; } - const std::map<int, std::string>& icons() { return icons_; } + const std::map<int, std::string>& icons() const { return icons_; } // Returns the origin of this extension. This function takes a |registry_path| // so that the registry location can be overwritten during testing. diff --git a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json index 91d1ca8..940e026 100644 --- a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json +++ b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json @@ -5,6 +5,7 @@ "enabled": true, "description": "The first extension that I made.", "permissions": ["http://*.google.com/*", "https://*.google.com/*"], + "icon": "icon_128.png", "content_scripts": [ { "matches": ["file://*", "http://*.google.com/*", "https://*.google.com/*"], diff --git a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json index 807b5d0..66adbf0 100644 --- a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json +++ b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json @@ -5,6 +5,7 @@ "enabled": true, "description": "", "permissions": [], + "icon": "", "content_scripts": [], "views": [ { diff --git a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json index fef5a50..a6dd8fe 100644 --- a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json +++ b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json @@ -5,6 +5,7 @@ "enabled": true, "description": "", "permissions": [], + "icon": "", "content_scripts": [ { "matches": ["file://*"], |