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

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: macros.h Created 5 years, 1 month 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(base::UTF16ToASCII(field->label),
184 base::UTF16ToASCII(pattern))) {
184 return true; 185 return true;
185 } 186 }
186 187
187 if ((match_type & FormField::MATCH_NAME) && 188 if ((match_type & FormField::MATCH_NAME) &&
188 MatchesPattern(field->name, pattern)) { 189 MatchesPattern(base::UTF16ToASCII(field->name),
190 base::UTF16ToASCII(pattern))) {
189 return true; 191 return true;
190 } 192 }
191 193
192 return false; 194 return false;
193 } 195 }
194 196
195 // static 197 // static
196 void FormField::ParseFormFieldsPass(ParseFunction parse, 198 void FormField::ParseFormFieldsPass(ParseFunction parse,
197 std::vector<AutofillField*>* fields, 199 std::vector<AutofillField*>* fields,
198 ServerFieldTypeMap* map) { 200 ServerFieldTypeMap* map) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if ((match_type & MATCH_PASSWORD) && type == "password") 238 if ((match_type & MATCH_PASSWORD) && type == "password")
237 return true; 239 return true;
238 240
239 if ((match_type & MATCH_NUMBER) && type == "number") 241 if ((match_type & MATCH_NUMBER) && type == "number")
240 return true; 242 return true;
241 243
242 return false; 244 return false;
243 } 245 }
244 246
245 } // namespace autofill 247 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698