summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 23:20:42 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 23:20:42 +0000
commitf2286c23e17c0012d53800a5ef28975b6e22393a (patch)
tree3d2be6292abfa9e8b605d600a0b2f07cc92c9669 /chrome
parent4200a20809504434ab46abf92cd23568b9e2e72f (diff)
downloadchromium_src-f2286c23e17c0012d53800a5ef28975b6e22393a.zip
chromium_src-f2286c23e17c0012d53800a5ef28975b6e22393a.tar.gz
chromium_src-f2286c23e17c0012d53800a5ef28975b6e22393a.tar.bz2
Link the name of the extension on the management page to the
gallery page, if the extension is from the gallery. BUG=29739 TEST=Install a gallery extension and a third-party extension and make sure the gallery extension name is a link (whereas the third party extension name is static text). Review URL: http://codereview.chromium.org/1792006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_context_menu_model.cc7
-rw-r--r--chrome/browser/extensions/extensions_ui.cc7
-rw-r--r--chrome/browser/resources/extensions_ui.html6
-rw-r--r--chrome/common/extensions/extension.cc18
-rw-r--r--chrome/common/extensions/extension.h4
5 files changed, 31 insertions, 11 deletions
diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc
index 0878de9..a13361c 100644
--- a/chrome/browser/extensions/extension_context_menu_model.cc
+++ b/chrome/browser/extensions/extension_context_menu_model.cc
@@ -74,7 +74,7 @@ bool ExtensionContextMenuModel::IsCommandIdEnabled(int command_id) const {
// hosting the extension. For other 3rd party extensions we don't have a
// homepage url, so we just disable this menu item on those cases, at least
// for now.
- return extension_->update_url().DomainIs("google.com");
+ return extension_->GalleryUrl().is_valid();
} else if (command_id == INSPECT_POPUP) {
TabContents* contents = browser_->GetSelectedTabContents();
if (!contents)
@@ -93,9 +93,8 @@ bool ExtensionContextMenuModel::GetAcceleratorForCommandId(
void ExtensionContextMenuModel::ExecuteCommand(int command_id) {
switch (command_id) {
case NAME: {
- GURL url(std::string(extension_urls::kGalleryBrowsePrefix) +
- std::string("/detail/") + extension_->id());
- browser_->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
+ browser_->OpenURL(extension_->GalleryUrl(), GURL(),
+ NEW_FOREGROUND_TAB, PageTransition::LINK);
break;
}
case CONFIGURE:
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 75b54e6..9565d69 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -752,7 +752,7 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
if (!extension->options_url().is_empty())
extension_data->SetString(L"options_url", extension->options_url().spec());
- // Add list of content_script detail DictionaryValues
+ // Add list of content_script detail DictionaryValues.
ListValue *content_script_list = new ListValue();
UserScriptList content_scripts = extension->content_scripts();
for (UserScriptList::const_iterator script = content_scripts.begin();
@@ -762,7 +762,7 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
}
extension_data->Set(L"content_scripts", content_script_list);
- // Add permissions
+ // Add permissions.
ListValue *permission_list = new ListValue;
std::vector<URLPattern> permissions = extension->host_permissions();
for (std::vector<URLPattern>::iterator permission = permissions.begin();
@@ -778,7 +778,7 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
iter != pages.end(); ++iter) {
DictionaryValue* view_value = new DictionaryValue;
view_value->SetString(L"path",
- iter->url.path().substr(1, std::string::npos)); // no leading slash
+ iter->url.path().substr(1, std::string::npos)); // No leading slash.
view_value->SetInteger(L"renderViewId", iter->render_view_id);
view_value->SetInteger(L"renderProcessId", iter->render_process_id);
views->Append(view_value);
@@ -786,6 +786,7 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
extension_data->Set(L"views", views);
extension_data->SetBoolean(L"hasPopupAction",
extension->browser_action() || extension->page_action());
+ extension_data->SetString(L"galleryUrl", extension->GalleryUrl().spec());
return extension_data;
}
diff --git a/chrome/browser/resources/extensions_ui.html b/chrome/browser/resources/extensions_ui.html
index 42691d2..081db53 100644
--- a/chrome/browser/resources/extensions_ui.html
+++ b/chrome/browser/resources/extensions_ui.html
@@ -804,8 +804,14 @@ document.addEventListener('DOMContentLoaded', requestExtensionsData);
</td>
<td valign="top">
<div>
+ <a jsdisplay="galleryUrl.length > 0"
+ jsvalues=".href:galleryUrl">
<span class="extension-name"
jscontent="name">EXTENSION NAME</span>
+ </a>
+ <span class="extension-name"
+ jsdisplay="galleryUrl.length == 0"
+ jscontent="name">EXTENSION NAME</span>
- <span i18n-content="extensionVersion">VERSION</span>
<span jscontent="version">x.x.x.x</span>
<span jsdisplay="!enabled"
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 8e9d711..80a489b 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1447,16 +1447,26 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
return true;
}
+GURL Extension::GalleryUrl() const {
+ if (!update_url_.DomainIs("google.com"))
+ return GURL();
+
+ GURL url(std::string(extension_urls::kGalleryBrowsePrefix) +
+ std::string("/detail/") + id_);
+
+ return url;
+}
+
std::set<FilePath> Extension::GetBrowserImages() {
std::set<FilePath> image_paths;
- // extension icons
+ // Extension icons.
for (std::map<int, std::string>::iterator iter = icons_.begin();
iter != icons_.end(); ++iter) {
image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second)));
}
- // theme images
+ // Theme images.
DictionaryValue* theme_images = GetThemeImages();
if (theme_images) {
for (DictionaryValue::key_iterator it = theme_images->begin_keys();
@@ -1467,7 +1477,7 @@ std::set<FilePath> Extension::GetBrowserImages() {
}
}
- // page action icons
+ // Page action icons.
if (page_action_.get()) {
std::vector<std::string>* icon_paths = page_action_->icon_paths();
for (std::vector<std::string>::iterator iter = icon_paths->begin();
@@ -1476,7 +1486,7 @@ std::set<FilePath> Extension::GetBrowserImages() {
}
}
- // browser action icons
+ // Browser action icons.
if (browser_action_.get()) {
std::vector<std::string>* icon_paths = browser_action_->icon_paths();
for (std::vector<std::string>::iterator iter = icon_paths->begin();
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index f3b4ff3..f8dcd9b 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -276,6 +276,10 @@ class Extension {
const GURL& update_url() const { return update_url_; }
const std::map<int, std::string>& icons() const { return icons_; }
+ // Returns the Google Gallery URL for this extension, if one exists. For
+ // third-party extensions, this returns a blank GURL.
+ GURL GalleryUrl() const;
+
// Theme-related.
DictionaryValue* GetThemeImages() const { return theme_images_.get(); }
DictionaryValue* GetThemeColors() const { return theme_colors_.get(); }