| OLD | NEW |
| 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 "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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return EmbeddedSearchPageVersion() == kEmbeddedSearchEnabledVersion; | 60 return EmbeddedSearchPageVersion() == kEmbeddedSearchEnabledVersion; |
| 61 #else | 61 #else |
| 62 return true; | 62 return true; |
| 63 #endif // defined(OS_IOS) | 63 #endif // defined(OS_IOS) |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Determine what embedded search page version to request from the user's | 66 // Determine what embedded search page version to request from the user's |
| 67 // default search provider. If 0, the embedded search UI should not be enabled. | 67 // default search provider. If 0, the embedded search UI should not be enabled. |
| 68 uint64 EmbeddedSearchPageVersion() { | 68 uint64 EmbeddedSearchPageVersion() { |
| 69 #if defined(OS_ANDROID) | 69 #if defined(OS_ANDROID) |
| 70 if (CommandLine::ForCurrentProcess()->HasSwitch( | 70 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 71 switches::kEnableEmbeddedSearchAPI)) { | 71 switches::kEnableEmbeddedSearchAPI)) { |
| 72 return kEmbeddedSearchEnabledVersion; | 72 return kEmbeddedSearchEnabledVersion; |
| 73 } | 73 } |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 FieldTrialFlags flags; | 76 FieldTrialFlags flags; |
| 77 if (GetFieldTrialInfo(&flags)) { | 77 if (GetFieldTrialInfo(&flags)) { |
| 78 return GetUInt64ValueForFlagWithDefault(kEmbeddedPageVersionFlagName, | 78 return GetUInt64ValueForFlagWithDefault(kEmbeddedPageVersionFlagName, |
| 79 kEmbeddedPageVersionDefault, | 79 kEmbeddedPageVersionDefault, |
| 80 flags); | 80 flags); |
| 81 } | 81 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 145 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool ShouldHideTopVerbatimMatch() { | 148 bool ShouldHideTopVerbatimMatch() { |
| 149 FieldTrialFlags flags; | 149 FieldTrialFlags flags; |
| 150 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( | 150 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( |
| 151 kHideVerbatimFlagName, false, flags); | 151 kHideVerbatimFlagName, false, flags); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace chrome | 154 } // namespace chrome |
| OLD | NEW |