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

Unified Diff: extensions/common/extension_urls.cc

Issue 2506713002: Avoid parsing the webstore base url so much. (Closed)
Patch Set: don't assume cmd line urls canonical 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
Index: extensions/common/extension_urls.cc
diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc
index 0235621c76fe9a981de848c4470b72d9696e4b05..e60cf1494b1a9ffffeb7e7a75b68d15096355445 100644
--- a/extensions/common/extension_urls.cc
+++ b/extensions/common/extension_urls.cc
@@ -33,35 +33,36 @@ const char kChromeWebstoreBaseURL[] = "https://chrome.google.com/webstore";
const char kChromeWebstoreUpdateURL[] =
"https://clients2.google.com/service/update2/crx";
-std::string GetWebstoreLaunchURL() {
+GURL GetWebstoreLaunchURL() {
extensions::ExtensionsClient* client = extensions::ExtensionsClient::Get();
if (client)
return client->GetWebstoreBaseURL();
- return kChromeWebstoreBaseURL;
+ return GURL(kChromeWebstoreBaseURL);
}
std::string GetWebstoreExtensionsCategoryURL() {
- return GetWebstoreLaunchURL() + "/category/extensions";
+ return GetWebstoreLaunchURL().spec() + "/category/extensions";
Devlin 2016/11/16 19:11:52 Can we a) Add a TODO to convert these to return GU
Charlie Harrison 2016/11/16 21:45:19 Done, though using Resolve() is more expensive, be
}
std::string GetWebstoreItemDetailURLPrefix() {
- return GetWebstoreLaunchURL() + "/detail/";
+ return GetWebstoreLaunchURL().spec() + "/detail/";
}
GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) {
- return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id);
+ return GURL(GetWebstoreLaunchURL().spec() + "/inlineinstall/detail/" +
+ extension_id);
}
GURL GetWebstoreJsonSearchUrl(const std::string& query,
const std::string& host_language_code) {
- GURL url(GetWebstoreLaunchURL() + "/jsonsearch");
+ GURL url(GetWebstoreLaunchURL().spec() + "/jsonsearch");
url = net::AppendQueryParameter(url, "q", query);
url = net::AppendQueryParameter(url, "hl", host_language_code);
return url;
}
GURL GetWebstoreSearchPageUrl(const std::string& query) {
- return GURL(GetWebstoreLaunchURL() + "/search/" +
+ return GURL(GetWebstoreLaunchURL().spec() + "/search/" +
net::EscapeQueryParamValue(query, false));
}
@@ -75,7 +76,7 @@ GURL GetWebstoreUpdateUrl() {
GURL GetWebstoreReportAbuseUrl(const std::string& extension_id,
const std::string& referrer_id) {
return GURL(base::StringPrintf("%s/report/%s?utm_source=%s",
- GetWebstoreLaunchURL().c_str(),
+ GetWebstoreLaunchURL().spec().c_str(),
extension_id.c_str(), referrer_id.c_str()));
}

Powered by Google App Engine
This is Rietveld 408576698