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 17 matching lines...) Expand all Loading... | |
28 #if defined(OS_IOS) | 28 #if defined(OS_IOS) |
29 const uint64 kEmbeddedPageVersionDefault = 1; | 29 const uint64 kEmbeddedPageVersionDefault = 1; |
30 #elif defined(OS_ANDROID) | 30 #elif defined(OS_ANDROID) |
31 const uint64 kEmbeddedPageVersionDefault = 1; | 31 const uint64 kEmbeddedPageVersionDefault = 1; |
32 // Use this variant to enable EmbeddedSearch SearchBox API in the results page. | 32 // Use this variant to enable EmbeddedSearch SearchBox API in the results page. |
33 const uint64 kEmbeddedSearchEnabledVersion = 2; | 33 const uint64 kEmbeddedSearchEnabledVersion = 2; |
34 #else | 34 #else |
35 const uint64 kEmbeddedPageVersionDefault = 2; | 35 const uint64 kEmbeddedPageVersionDefault = 2; |
36 #endif | 36 #endif |
37 | 37 |
38 const char kHideVerbatimFlagName[] = "hide_verbatim"; | |
Peter Kasting
2014/08/12 02:03:41
Nit: Define things in the most local scope possibl
hashimoto
2014/08/12 04:43:15
I guess authors of search.cc are putting these con
| |
39 | |
38 // Constants for the field trial name and group prefix. | 40 // Constants for the field trial name and group prefix. |
39 // Note in M30 and below this field trial was named "InstantExtended" and in | 41 // Note in M30 and below this field trial was named "InstantExtended" and in |
40 // M31 was renamed to EmbeddedSearch for clarity and cleanliness. Since we | 42 // M31 was renamed to EmbeddedSearch for clarity and cleanliness. Since we |
41 // can't easilly sync up Finch configs with the pushing of this change to | 43 // can't easilly sync up Finch configs with the pushing of this change to |
42 // Dev & Canary, for now the code accepts both names. | 44 // Dev & Canary, for now the code accepts both names. |
43 // TODO(dcblack): Remove the InstantExtended name once M31 hits the Beta | 45 // TODO(dcblack): Remove the InstantExtended name once M31 hits the Beta |
44 // channel. | 46 // channel. |
45 const char kInstantExtendedFieldTrialName[] = "InstantExtended"; | 47 const char kInstantExtendedFieldTrialName[] = "InstantExtended"; |
46 const char kEmbeddedSearchFieldTrialName[] = "EmbeddedSearch"; | 48 const char kEmbeddedSearchFieldTrialName[] = "EmbeddedSearch"; |
47 | 49 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 } | 138 } |
137 | 139 |
138 // Given a FieldTrialFlags object, returns the boolean value of the provided | 140 // Given a FieldTrialFlags object, returns the boolean value of the provided |
139 // flag. | 141 // flag. |
140 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 142 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
141 bool default_value, | 143 bool default_value, |
142 const FieldTrialFlags& flags) { | 144 const FieldTrialFlags& flags) { |
143 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 145 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
144 } | 146 } |
145 | 147 |
148 bool ShouldHideTopVerbatimMatch() { | |
149 FieldTrialFlags flags; | |
150 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( | |
151 kHideVerbatimFlagName, false, flags); | |
152 } | |
153 | |
146 } // namespace chrome | 154 } // namespace chrome |
OLD | NEW |