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

Side by Side Diff: components/autofill/core/browser/autofill_field.cc

Issue 89243003: Move EmptyString, kWhitespace and the BOM to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/disks/disk_mount_manager.cc ('k') | content/browser/renderer_host/java/java_method.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/autofill/core/browser/autofill_field.h" 5 #include "components/autofill/core/browser/autofill_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sha1.h" 8 #include "base/sha1.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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 return false; 163 return false;
164 } 164 }
165 165
166 // Try to fill a credit card type |value| (Visa, MasterCard, etc.) into the 166 // Try to fill a credit card type |value| (Visa, MasterCard, etc.) into the
167 // given |field|. 167 // given |field|.
168 bool FillCreditCardTypeSelectControl(const base::string16& value, 168 bool FillCreditCardTypeSelectControl(const base::string16& value,
169 FormFieldData* field) { 169 FormFieldData* field) {
170 // Try stripping off spaces. 170 // Try stripping off spaces.
171 base::string16 value_stripped; 171 base::string16 value_stripped;
172 RemoveChars(StringToLowerASCII(value), kWhitespaceUTF16, &value_stripped); 172 RemoveChars(StringToLowerASCII(value), base::kWhitespaceUTF16,
173 &value_stripped);
173 174
174 for (size_t i = 0; i < field->option_values.size(); ++i) { 175 for (size_t i = 0; i < field->option_values.size(); ++i) {
175 base::string16 option_value_lowercase; 176 base::string16 option_value_lowercase;
176 RemoveChars(StringToLowerASCII(field->option_values[i]), kWhitespaceUTF16, 177 RemoveChars(StringToLowerASCII(field->option_values[i]),
177 &option_value_lowercase); 178 base::kWhitespaceUTF16, &option_value_lowercase);
178 base::string16 option_contents_lowercase; 179 base::string16 option_contents_lowercase;
179 RemoveChars(StringToLowerASCII(field->option_contents[i]), kWhitespaceUTF16, 180 RemoveChars(StringToLowerASCII(field->option_contents[i]),
180 &option_contents_lowercase); 181 base::kWhitespaceUTF16, &option_contents_lowercase);
181 182
182 // Perform a case-insensitive comparison; but fill the form with the 183 // Perform a case-insensitive comparison; but fill the form with the
183 // original text, not the lowercased version. 184 // original text, not the lowercased version.
184 if (value_stripped == option_value_lowercase || 185 if (value_stripped == option_value_lowercase ||
185 value_stripped == option_contents_lowercase) { 186 value_stripped == option_contents_lowercase) {
186 field->value = field->option_values[i]; 187 field->value = field->option_values[i];
187 return true; 188 return true;
188 } 189 }
189 } 190 }
190 191
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 FillSelectControl(type, value, app_locale, field_data); 400 FillSelectControl(type, value, app_locale, field_data);
400 else if (field_data->form_control_type == "month") 401 else if (field_data->form_control_type == "month")
401 FillMonthControl(value, field_data); 402 FillMonthControl(value, field_data);
402 else if (type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS) 403 else if (type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS)
403 FillStreetAddress(value, field_data); 404 FillStreetAddress(value, field_data);
404 else 405 else
405 field_data->value = value; 406 field_data->value = value;
406 } 407 }
407 408
408 } // namespace autofill 409 } // namespace autofill
OLDNEW
« no previous file with comments | « chromeos/disks/disk_mount_manager.cc ('k') | content/browser/renderer_host/java/java_method.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698