Chromium Code Reviews| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 uint64 EmbeddedSearchPageVersion() { | 355 uint64 EmbeddedSearchPageVersion() { |
| 356 FieldTrialFlags flags; | 356 FieldTrialFlags flags; |
| 357 if (GetFieldTrialInfo(&flags)) { | 357 if (GetFieldTrialInfo(&flags)) { |
| 358 return GetUInt64ValueForFlagWithDefault(kEmbeddedPageVersionFlagName, | 358 return GetUInt64ValueForFlagWithDefault(kEmbeddedPageVersionFlagName, |
| 359 kEmbeddedPageVersionDefault, | 359 kEmbeddedPageVersionDefault, |
| 360 flags); | 360 flags); |
| 361 } | 361 } |
| 362 return kEmbeddedPageVersionDefault; | 362 return kEmbeddedPageVersionDefault; |
| 363 } | 363 } |
| 364 | 364 |
| 365 std::string InstantExtendedEnabledParam(bool for_search) { | |
| 366 if (for_search && !chrome::IsQueryExtractionEnabled()) | |
| 367 return std::string(); | |
| 368 | |
| 369 uint64 instant_extended_api_version = EmbeddedSearchPageVersion(); | |
| 370 if (instant_extended_api_version) { | |
|
samarth
2014/02/07 00:25:31
Hmm I was going to say this should explicitly chec
kmadhusu
2014/02/07 00:44:05
True. Current version of EmbeddedSearchPageVersion
samarth
2014/02/07 17:50:00
espv:0 is explicitly not a supported config anymor
kmadhusu
2014/02/07 21:25:39
Removed the check.
| |
| 371 return std::string(google_util::kInstantExtendedAPIParam) + "=" + | |
| 372 base::Uint64ToString(instant_extended_api_version) + "&"; | |
| 373 } | |
| 374 return std::string(); | |
| 375 } | |
| 376 | |
| 365 bool IsQueryExtractionEnabled() { | 377 bool IsQueryExtractionEnabled() { |
| 366 #if defined(OS_IOS) || defined(OS_ANDROID) | 378 #if defined(OS_IOS) || defined(OS_ANDROID) |
| 367 return true; | 379 return true; |
| 368 #else | 380 #else |
| 369 if (!IsInstantExtendedAPIEnabled()) | 381 if (!IsInstantExtendedAPIEnabled()) |
| 370 return false; | 382 return false; |
| 371 | 383 |
| 372 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 384 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 373 if (command_line->HasSwitch(switches::kEnableQueryExtraction)) | 385 if (command_line->HasSwitch(switches::kEnableQueryExtraction)) |
| 374 return true; | 386 return true; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 776 | 788 |
| 777 // Given a FieldTrialFlags object, returns the boolean value of the provided | 789 // Given a FieldTrialFlags object, returns the boolean value of the provided |
| 778 // flag. | 790 // flag. |
| 779 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 791 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 780 bool default_value, | 792 bool default_value, |
| 781 const FieldTrialFlags& flags) { | 793 const FieldTrialFlags& flags) { |
| 782 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 794 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
| 783 } | 795 } |
| 784 | 796 |
| 785 } // namespace chrome | 797 } // namespace chrome |
| OLD | NEW |