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

Side by Side Diff: components/search/search.cc

Issue 2520993004: Cleanup: Remove for_search param from search::InstantExtendedEnabledParam() (Closed)
Patch Set: fix Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/search/search.h" 5 #include "components/search/search.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 // Given a FieldTrialFlags object, returns the boolean value of the provided 153 // Given a FieldTrialFlags object, returns the boolean value of the provided
154 // flag. 154 // flag.
155 bool GetBoolValueForFlagWithDefault(const std::string& flag, 155 bool GetBoolValueForFlagWithDefault(const std::string& flag,
156 bool default_value, 156 bool default_value,
157 const FieldTrialFlags& flags) { 157 const FieldTrialFlags& flags) {
158 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); 158 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
159 } 159 }
160 160
161 std::string InstantExtendedEnabledParam(bool for_search) { 161 std::string InstantExtendedEnabledParam() {
162 // TODO(treib): Remove |for_search| and update callers that set it to true.
163 if (for_search)
164 return std::string();
165 return std::string(google_util::kInstantExtendedAPIParam) + "=" + 162 return std::string(google_util::kInstantExtendedAPIParam) + "=" +
166 base::Uint64ToString(EmbeddedSearchPageVersion()) + "&"; 163 base::Uint64ToString(EmbeddedSearchPageVersion()) + "&";
167 } 164 }
168 165
169 std::string ForceInstantResultsParam(bool for_prerender) { 166 std::string ForceInstantResultsParam(bool for_prerender) {
170 return (for_prerender || !IsInstantExtendedAPIEnabled()) ? "ion=1&" 167 return (for_prerender || !IsInstantExtendedAPIEnabled()) ? "ion=1&"
171 : std::string(); 168 : std::string();
172 } 169 }
173 170
174 bool ShouldPrefetchSearchResults() { 171 bool ShouldPrefetchSearchResults() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // |url| should either have a secure scheme or have a non-HTTPS base URL that 204 // |url| should either have a secure scheme or have a non-HTTPS base URL that
208 // the user specified using --google-base-url. (This allows testers to use 205 // the user specified using --google-base-url. (This allows testers to use
209 // --google-base-url to point at non-HTTPS servers, which eases testing.) 206 // --google-base-url to point at non-HTTPS servers, which eases testing.)
210 bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url) { 207 bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url) {
211 return template_url->HasSearchTermsReplacementKey(url) && 208 return template_url->HasSearchTermsReplacementKey(url) &&
212 (url.SchemeIsCryptographic() || 209 (url.SchemeIsCryptographic() ||
213 google_util::StartsWithCommandLineGoogleBaseURL(url)); 210 google_util::StartsWithCommandLineGoogleBaseURL(url));
214 } 211 }
215 212
216 } // namespace search 213 } // namespace search
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698