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

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

Issue 1453193002: autofill: switch autofill_regexes to RE2 library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pattern - ASCII- std::string Created 5 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
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/form_field.h" 5 #include "components/autofill/core/browser/form_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 return false; 175 return false;
176 } 176 }
177 177
178 // static 178 // static
179 bool FormField::Match(const AutofillField* field, 179 bool FormField::Match(const AutofillField* field,
180 const base::string16& pattern, 180 const base::string16& pattern,
181 int match_type) { 181 int match_type) {
182 if ((match_type & FormField::MATCH_LABEL) && 182 if ((match_type & FormField::MATCH_LABEL) &&
183 MatchesPattern(field->label, pattern)) { 183 MatchesPattern(field->label, base::UTF16ToASCII(pattern))) {
Evan Stade 2015/11/25 19:33:01 Yes, Ilya's suggestion is good :) This code is not
Ilya Sherman 2015/11/25 22:18:14 Actually, there should not be any conversion here
tfarina 2015/11/26 00:56:34 Done. Though the changes are scaling.
184 return true; 184 return true;
185 } 185 }
186 186
187 if ((match_type & FormField::MATCH_NAME) && 187 if ((match_type & FormField::MATCH_NAME) &&
188 MatchesPattern(field->name, pattern)) { 188 MatchesPattern(field->name, base::UTF16ToASCII(pattern))) {
189 return true; 189 return true;
190 } 190 }
191 191
192 return false; 192 return false;
193 } 193 }
194 194
195 // static 195 // static
196 void FormField::ParseFormFieldsPass(ParseFunction parse, 196 void FormField::ParseFormFieldsPass(ParseFunction parse,
197 std::vector<AutofillField*>* fields, 197 std::vector<AutofillField*>* fields,
198 ServerFieldTypeMap* map) { 198 ServerFieldTypeMap* map) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if ((match_type & MATCH_PASSWORD) && type == "password") 236 if ((match_type & MATCH_PASSWORD) && type == "password")
237 return true; 237 return true;
238 238
239 if ((match_type & MATCH_NUMBER) && type == "number") 239 if ((match_type & MATCH_NUMBER) && type == "number")
240 return true; 240 return true;
241 241
242 return false; 242 return false;
243 } 243 }
244 244
245 } // namespace autofill 245 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card_field.cc ('k') | components/autofill/core/browser/validation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698