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

Unified Diff: chrome/browser/ui/app_list/search/webstore/webstore_provider.cc

Issue 65163003: Move GetWebstoreLaunchURL and GetWebstoreItemDetailURLPrefix to extensions/common/extension_urls.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mt Created 7 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: chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
index b22b397bc19f959794e1c065d559c0312879d735..a831ca84646437676b69c6350c5174882e3e3acc 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
@@ -18,6 +18,8 @@
#include "chrome/browser/ui/app_list/search/search_webstore_result.h"
#include "chrome/browser/ui/app_list/search/webstore/webstore_result.h"
#include "chrome/common/extensions/extension_constants.h"
+#include "extensions/common/extension_urls.h"
+#include "net/base/url_util.h"
#include "url/gurl.h"
namespace app_list {
@@ -36,6 +38,19 @@ bool UseWebstoreSearch() {
return base::FieldTrialList::FindFullName(kFieldTrialName) == kEnable;
}
+// Returns the URL used to get webstore search results in JSON format. The URL
+// returns a JSON dictionary that has the search results (under "results").
+// Each entry in the array is a dictionary with data for an extension.
+// |query| is the user typed query string. |hl| is the host language code,
+// e.g. en_US. Both arguments will be escaped and added as a query parameter
+// to the returned web store json search URL.
+GURL GetWebstoreJsonSearchURL(const std::string& query, const std::string& hl) {
+ GURL url(extensions::GetWebstoreLaunchURL() + "/jsonsearch");
+ url = net::AppendQueryParameter(url, "q", query);
+ url = net::AppendQueryParameter(url, "hl", hl);
+ return url;
+}
+
} // namespace
WebstoreProvider::WebstoreProvider(Profile* profile,
@@ -90,7 +105,7 @@ void WebstoreProvider::StartQuery() {
if (!webstore_search_ || query_.empty())
return;
- webstore_search_->Start(extension_urls::GetWebstoreJsonSearchUrl(
+ webstore_search_->Start(GetWebstoreJsonSearchURL(
query_, g_browser_process->GetApplicationLocale()));
}

Powered by Google App Engine
This is Rietveld 408576698