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

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

Issue 2493053002: [extensions] Stop parsing webstore urls so much (Closed)
Patch Set: rdevlin review Created 4 years, 1 month 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
« no previous file with comments | « chrome/common/extensions/chrome_extensions_client.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/chrome_extensions_client.cc
diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc
index 2fe9459e2de6cd408837a4d51029828be1a3fff7..9a4a929ae7b1dddc2643342e158c230cbd045d26 100644
--- a/chrome/common/extensions/chrome_extensions_client.cc
+++ b/chrome/common/extensions/chrome_extensions_client.cc
@@ -281,12 +281,20 @@ std::string ChromeExtensionsClient::GetWebstoreBaseURL() const {
return gallery_prefix;
}
-std::string ChromeExtensionsClient::GetWebstoreUpdateURL() const {
+const GURL& ChromeExtensionsClient::GetWebstoreUpdateURL() const {
+ // Browser tests like to alter the command line at runtime with new update
+ // URLs. Just update the cached value of the update url (to avoid reparsing
+ // it) if the value has changed.
base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
- if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL))
- return cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL);
- else
- return extension_urls::GetDefaultWebstoreUpdateUrl().spec();
+ if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) {
+ std::string url =
+ cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL);
+ if (webstore_update_url_ != url)
+ webstore_update_url_ = GURL(url);
+ } else if (webstore_update_url_.is_empty()) {
+ webstore_update_url_ = GURL(extension_urls::GetDefaultWebstoreUpdateUrl());
+ }
+ return webstore_update_url_;
}
bool ChromeExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
« no previous file with comments | « chrome/common/extensions/chrome_extensions_client.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698