Chromium Code Reviews| 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 b999102c9fe82780c133755f5158d9a46ab26588..ae3e5c05ee1e9a6f6dd5b7db58f75d84856da9b3 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 |
|
Devlin
2016/11/11 23:11:30
:(
|
| + // 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 { |