OLD | NEW |
---|---|
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 return kEmbeddedPageVersionDefault; | 364 return kEmbeddedPageVersionDefault; |
365 } | 365 } |
366 | 366 |
367 std::string InstantExtendedEnabledParam(bool for_search) { | 367 std::string InstantExtendedEnabledParam(bool for_search) { |
368 if (for_search && !chrome::IsQueryExtractionEnabled()) | 368 if (for_search && !chrome::IsQueryExtractionEnabled()) |
369 return std::string(); | 369 return std::string(); |
370 return std::string(google_util::kInstantExtendedAPIParam) + "=" + | 370 return std::string(google_util::kInstantExtendedAPIParam) + "=" + |
371 base::Uint64ToString(EmbeddedSearchPageVersion()) + "&"; | 371 base::Uint64ToString(EmbeddedSearchPageVersion()) + "&"; |
372 } | 372 } |
373 | 373 |
374 std::string ForceInstantResultsParam(bool for_prerender) { | |
375 return (for_prerender || !IsInstantExtendedAPIEnabled()) ? "ion=1&" : | |
Peter Kasting
2014/02/14 05:30:00
Nit: Break after '?' instead
kmadhusu
2014/02/14 18:24:04
Done.
| |
376 std::string(); | |
377 } | |
378 | |
374 bool IsQueryExtractionEnabled() { | 379 bool IsQueryExtractionEnabled() { |
375 #if defined(OS_IOS) || defined(OS_ANDROID) | 380 #if defined(OS_IOS) || defined(OS_ANDROID) |
376 return true; | 381 return true; |
377 #else | 382 #else |
378 if (!IsInstantExtendedAPIEnabled()) | 383 if (!IsInstantExtendedAPIEnabled()) |
379 return false; | 384 return false; |
380 | 385 |
381 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 386 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
382 if (command_line->HasSwitch(switches::kEnableQueryExtraction)) | 387 if (command_line->HasSwitch(switches::kEnableQueryExtraction)) |
383 return true; | 388 return true; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
825 | 830 |
826 // Given a FieldTrialFlags object, returns the boolean value of the provided | 831 // Given a FieldTrialFlags object, returns the boolean value of the provided |
827 // flag. | 832 // flag. |
828 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 833 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
829 bool default_value, | 834 bool default_value, |
830 const FieldTrialFlags& flags) { | 835 const FieldTrialFlags& flags) { |
831 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 836 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
832 } | 837 } |
833 | 838 |
834 } // namespace chrome | 839 } // namespace chrome |
OLD | NEW |