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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |