Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: components/search/search.cc

Issue 1233043003: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 bool GetFieldTrialInfo(FieldTrialFlags* flags) { 83 bool GetFieldTrialInfo(FieldTrialFlags* flags) {
84 // Get the group name. If the EmbeddedSearch trial doesn't exist, look for 84 // Get the group name. If the EmbeddedSearch trial doesn't exist, look for
85 // the older InstantExtended name. 85 // the older InstantExtended name.
86 std::string group_name = base::FieldTrialList::FindFullName( 86 std::string group_name = base::FieldTrialList::FindFullName(
87 kEmbeddedSearchFieldTrialName); 87 kEmbeddedSearchFieldTrialName);
88 if (group_name.empty()) { 88 if (group_name.empty()) {
89 group_name = base::FieldTrialList::FindFullName( 89 group_name = base::FieldTrialList::FindFullName(
90 kInstantExtendedFieldTrialName); 90 kInstantExtendedFieldTrialName);
91 } 91 }
92 92
93 if (base::EndsWith(group_name, kDisablingSuffix, true)) 93 if (base::EndsWith(group_name, kDisablingSuffix,
94 base::CompareCase::SENSITIVE))
94 return false; 95 return false;
95 96
96 // We have a valid trial that isn't disabled. Extract the flags. 97 // We have a valid trial that isn't disabled. Extract the flags.
97 std::string group_prefix(group_name); 98 std::string group_prefix(group_name);
98 size_t first_space = group_name.find(" "); 99 size_t first_space = group_name.find(" ");
99 if (first_space != std::string::npos) { 100 if (first_space != std::string::npos) {
100 // There is a flags section of the group name. Split that out and parse it. 101 // There is a flags section of the group name. Split that out and parse it.
101 group_prefix = group_name.substr(0, first_space); 102 group_prefix = group_name.substr(0, first_space);
102 if (!base::SplitStringIntoKeyValuePairs(group_name.substr(first_space), 103 if (!base::SplitStringIntoKeyValuePairs(group_name.substr(first_space),
103 ':', ' ', flags)) { 104 ':', ' ', flags)) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 // Given a FieldTrialFlags object, returns the boolean value of the provided 139 // Given a FieldTrialFlags object, returns the boolean value of the provided
139 // flag. 140 // flag.
140 bool GetBoolValueForFlagWithDefault(const std::string& flag, 141 bool GetBoolValueForFlagWithDefault(const std::string& flag,
141 bool default_value, 142 bool default_value,
142 const FieldTrialFlags& flags) { 143 const FieldTrialFlags& flags) {
143 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); 144 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
144 } 145 }
145 146
146 } // namespace chrome 147 } // namespace chrome
OLDNEW
« no previous file with comments | « components/plugins/renderer/plugin_placeholder.cc ('k') | components/storage_monitor/volume_mount_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698