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

Unified Diff: extensions/common/extension_urls.cc

Issue 2506713002: Avoid parsing the webstore base url so much. (Closed)
Patch Set: fix chromeos 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 | « extensions/common/extension_urls.h ('k') | extensions/common/extensions_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension_urls.cc
diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc
index 0235621c76fe9a981de848c4470b72d9696e4b05..2cddc33c5370cabaefab3302e1c9801797d54dd4 100644
--- a/extensions/common/extension_urls.cc
+++ b/extensions/common/extension_urls.cc
@@ -33,35 +33,40 @@ 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);
}
+// TODO(csharrison,devlin): Migrate the following methods to return
+// GURLs.
+// TODO(devlin): Try to use GURL methods like Resolve instead of string
+// concatenation.
std::string GetWebstoreExtensionsCategoryURL() {
- return GetWebstoreLaunchURL() + "/category/extensions";
+ return GetWebstoreLaunchURL().spec() + "/category/extensions";
}
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 +80,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()));
}
« no previous file with comments | « extensions/common/extension_urls.h ('k') | extensions/common/extensions_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698