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

Unified Diff: components/suggestions/suggestions_service_impl.cc

Issue 2872573002: Use |min| param to query a variable number of suggestions (Closed)
Patch Set: Use format strings to concat parameters Created 3 years, 7 months 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: components/suggestions/suggestions_service_impl.cc
diff --git a/components/suggestions/suggestions_service_impl.cc b/components/suggestions/suggestions_service_impl.cc
index 5a013c8a58481ec29d51c111e457db7cafddd446..b47463a218b673ecf81c2e6976ea9ecc19401e3a 100644
--- a/components/suggestions/suggestions_service_impl.cc
+++ b/components/suggestions/suggestions_service_impl.cc
@@ -22,6 +22,7 @@
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "components/suggestions/blacklist_store.h"
+#include "components/suggestions/features.h"
#include "components/suggestions/image_manager.h"
#include "components/suggestions/suggestions_store.h"
#include "components/sync/driver/sync_service.h"
@@ -82,13 +83,15 @@ GURL GetGoogleBaseURL() {
// Format strings for the various suggestions URLs. They all have two string
// params: The Google base URL and the device type.
// TODO(mathp): Put this in TemplateURL.
-const char kSuggestionsURLFormat[] = "%schromesuggestions?t=%s";
+const char kSuggestionsURLFormat[] = "%schromesuggestions?%s";
const char kSuggestionsBlacklistURLPrefixFormat[] =
"%schromesuggestions/blacklist?t=%s&url=";
const char kSuggestionsBlacklistClearURLFormat[] =
"%schromesuggestions/blacklist/clear?t=%s";
const char kSuggestionsBlacklistURLParam[] = "url";
+const char kSuggestionsDeviceParam[] = "t=%s";
+const char kSuggestionsUseAllParam[] = "min=0";
Marc Treib 2017/05/10 10:08:02 The "0" should probably be configurable via a vari
fhorschig 2017/05/10 12:25:30 Hmm, okay. I currently see no application, though.
Marc Treib 2017/05/10 12:32:24 You never do, until you need it :D Seriously thoug
fhorschig 2017/05/10 12:45:34 It has direct a direct effect on the server-side.
#if defined(OS_ANDROID) || defined(OS_IOS)
const char kDeviceType[] = "2";
@@ -248,8 +251,12 @@ void SuggestionsServiceImpl::RegisterProfilePrefs(
// static
GURL SuggestionsServiceImpl::BuildSuggestionsURL() {
+ std::string query = base::StringPrintf(kSuggestionsDeviceParam, kDeviceType);
+ if (base::FeatureList::IsEnabled(kUseSuggestionsEvenIfFewFeature)) {
+ query = base::StringPrintf("%s&%s", query.c_str(), kSuggestionsUseAllParam);
Marc Treib 2017/05/10 10:08:02 nit: I find this a bit confusing. Maybe don't reus
fhorschig 2017/05/10 12:25:30 Done.
+ }
return GURL(base::StringPrintf(
- kSuggestionsURLFormat, GetGoogleBaseURL().spec().c_str(), kDeviceType));
+ kSuggestionsURLFormat, GetGoogleBaseURL().spec().c_str(), query.c_str()));
}
// static
« no previous file with comments | « components/suggestions/suggestions_service_impl.h ('k') | components/suggestions/suggestions_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698