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

Side by Side Diff: chrome/browser/search/search.cc

Issue 164493005: Move SearchTermsData::ForceInstantResultsParam() to chrome::ForceInstantResultsParam(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nits Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/search/search.h" 5 #include "chrome/browser/search/search.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return kEmbeddedPageVersionDefault; 363 return kEmbeddedPageVersionDefault;
364 } 364 }
365 365
366 std::string InstantExtendedEnabledParam(bool for_search) { 366 std::string InstantExtendedEnabledParam(bool for_search) {
367 if (for_search && !chrome::IsQueryExtractionEnabled()) 367 if (for_search && !chrome::IsQueryExtractionEnabled())
368 return std::string(); 368 return std::string();
369 return std::string(google_util::kInstantExtendedAPIParam) + "=" + 369 return std::string(google_util::kInstantExtendedAPIParam) + "=" +
370 base::Uint64ToString(EmbeddedSearchPageVersion()) + "&"; 370 base::Uint64ToString(EmbeddedSearchPageVersion()) + "&";
371 } 371 }
372 372
373 std::string ForceInstantResultsParam(bool for_prerender) {
374 return (for_prerender || !IsInstantExtendedAPIEnabled()) ?
375 "ion=1&" : std::string();
376 }
377
373 bool IsQueryExtractionEnabled() { 378 bool IsQueryExtractionEnabled() {
374 #if defined(OS_IOS) || defined(OS_ANDROID) 379 #if defined(OS_IOS) || defined(OS_ANDROID)
375 return true; 380 return true;
376 #else 381 #else
377 if (!IsInstantExtendedAPIEnabled()) 382 if (!IsInstantExtendedAPIEnabled())
378 return false; 383 return false;
379 384
380 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 385 const CommandLine* command_line = CommandLine::ForCurrentProcess();
381 if (command_line->HasSwitch(switches::kEnableQueryExtraction)) 386 if (command_line->HasSwitch(switches::kEnableQueryExtraction))
382 return true; 387 return true;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 834
830 // Given a FieldTrialFlags object, returns the boolean value of the provided 835 // Given a FieldTrialFlags object, returns the boolean value of the provided
831 // flag. 836 // flag.
832 bool GetBoolValueForFlagWithDefault(const std::string& flag, 837 bool GetBoolValueForFlagWithDefault(const std::string& flag,
833 bool default_value, 838 bool default_value,
834 const FieldTrialFlags& flags) { 839 const FieldTrialFlags& flags) {
835 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); 840 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
836 } 841 }
837 842
838 } // namespace chrome 843 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698