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

Unified Diff: components/search/search.cc

Issue 2651763002: Cleanup in components/search and chrome/browser/search (Closed)
Patch Set: for each Created 3 years, 11 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
« no previous file with comments | « components/search/search.h ('k') | components/search/search_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/search/search.cc
diff --git a/components/search/search.cc b/components/search/search.cc
index 213f2dcc4cf90d819bdb751d87fc6223620a9368..41d9fc96b3cef1e5c1ee80cb81a0dbc95d6daf07 100644
--- a/components/search/search.cc
+++ b/components/search/search.cc
@@ -99,40 +99,22 @@ bool GetFieldTrialInfo(FieldTrialFlags* flags) {
return true;
}
-// Given a FieldTrialFlags object, returns the string value of the provided
-// flag.
-std::string GetStringValueForFlagWithDefault(const std::string& flag,
- const std::string& default_value,
- const FieldTrialFlags& flags) {
- FieldTrialFlags::const_iterator i;
- for (i = flags.begin(); i != flags.end(); i++) {
- if (i->first == flag)
- return i->second;
- }
- return default_value;
-}
-
// Given a FieldTrialFlags object, returns the uint64_t value of the provided
// flag.
uint64_t GetUInt64ValueForFlagWithDefault(const std::string& flag,
uint64_t default_value,
const FieldTrialFlags& flags) {
- uint64_t value;
- std::string str_value =
- GetStringValueForFlagWithDefault(flag, std::string(), flags);
- if (base::StringToUint64(str_value, &value))
- return value;
+ for (const std::pair<std::string, std::string>& flag_and_value : flags) {
+ if (flag_and_value.first == flag) {
+ const std::string& str_value = flag_and_value.second;
+ uint64_t value;
+ if (base::StringToUint64(str_value, &value))
+ return value;
+ }
+ }
return default_value;
}
-// Given a FieldTrialFlags object, returns the boolean value of the provided
-// flag.
-bool GetBoolValueForFlagWithDefault(const std::string& flag,
- bool default_value,
- const FieldTrialFlags& flags) {
- return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
-}
-
std::string InstantExtendedEnabledParam() {
return std::string(google_util::kInstantExtendedAPIParam) + "=" +
base::Uint64ToString(EmbeddedSearchPageVersion()) + "&";
@@ -143,21 +125,4 @@ std::string ForceInstantResultsParam(bool for_prerender) {
: std::string();
}
-bool ShouldPrefetchSearchResults() {
- return IsInstantExtendedAPIEnabled();
-}
-
-bool ShouldReuseInstantSearchBasePage() {
- return IsInstantExtendedAPIEnabled();
-}
-
-// |url| should either have a secure scheme or have a non-HTTPS base URL that
-// the user specified using --google-base-url. (This allows testers to use
-// --google-base-url to point at non-HTTPS servers, which eases testing.)
-bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url) {
- return template_url->HasSearchTermsReplacementKey(url) &&
- (url.SchemeIsCryptographic() ||
- google_util::StartsWithCommandLineGoogleBaseURL(url));
-}
-
} // namespace search
« no previous file with comments | « components/search/search.h ('k') | components/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698