Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Unified Diff: chrome/common/extensions/extension.cc

Issue 2855009: Only allow installation of extensions/apps with gallery update url via download from gallery (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: name change Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index a5780c242a6f6b0a5bfa29c74dd748a2d06a28ac..7539f7f35b35c12ef29730ff0c9e414bec0e95f1 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1488,12 +1488,20 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
return true;
}
+// static
+std::string Extension::ChromeStoreURL() {
+ std::string gallery_prefix = extension_urls::kGalleryBrowsePrefix;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL))
+ gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAppsGalleryURL);
+ return gallery_prefix;
+}
+
GURL Extension::GalleryUrl() const {
if (!update_url_.DomainIs("google.com"))
return GURL();
- GURL url(std::string(extension_urls::kGalleryBrowsePrefix) +
- std::string("/detail/") + id_);
+ GURL url(ChromeStoreURL() + std::string("/detail/") + id_);
return url;
}
@@ -1645,7 +1653,7 @@ bool Extension::CanExecuteScriptOnHost(const GURL& url,
std::string* error) const {
// No extensions are allowed to execute script on the gallery because that
// would allow extensions to manipulate their own install pages.
- if (url.host() == GURL(extension_urls::kGalleryBrowsePrefix).host()) {
+ if (url.host() == GURL(ChromeStoreURL()).host()) {
if (error)
*error = errors::kCannotScriptGallery;
return false;

Powered by Google App Engine
This is Rietveld 408576698