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

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

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/form_field.h" 5 #include "components/autofill/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Credit card pass. 76 // Credit card pass.
77 ParseFormFieldsPass(CreditCardField::Parse, &remaining_fields, map); 77 ParseFormFieldsPass(CreditCardField::Parse, &remaining_fields, map);
78 78
79 // Name pass. 79 // Name pass.
80 ParseFormFieldsPass(NameField::Parse, &remaining_fields, map); 80 ParseFormFieldsPass(NameField::Parse, &remaining_fields, map);
81 } 81 }
82 82
83 // static 83 // static
84 bool FormField::ParseField(AutofillScanner* scanner, 84 bool FormField::ParseField(AutofillScanner* scanner,
85 const string16& pattern, 85 const base::string16& pattern,
86 const AutofillField** match) { 86 const AutofillField** match) {
87 return ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT, match); 87 return ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT, match);
88 } 88 }
89 89
90 // static 90 // static
91 bool FormField::ParseFieldSpecifics(AutofillScanner* scanner, 91 bool FormField::ParseFieldSpecifics(AutofillScanner* scanner,
92 const string16& pattern, 92 const base::string16& pattern,
93 int match_type, 93 int match_type,
94 const AutofillField** match) { 94 const AutofillField** match) {
95 if (scanner->IsEnd()) 95 if (scanner->IsEnd())
96 return false; 96 return false;
97 97
98 const AutofillField* field = scanner->Cursor(); 98 const AutofillField* field = scanner->Cursor();
99 99
100 if ((match_type & MATCH_TEXT) && IsTextField(field->form_control_type)) 100 if ((match_type & MATCH_TEXT) && IsTextField(field->form_control_type))
101 return MatchAndAdvance(scanner, pattern, match_type, match); 101 return MatchAndAdvance(scanner, pattern, match_type, match);
102 102
(...skipping 26 matching lines...) Expand all
129 FieldTypeMap* map) { 129 FieldTypeMap* map) {
130 // Several fields are optional. 130 // Several fields are optional.
131 if (!field) 131 if (!field)
132 return true; 132 return true;
133 133
134 return map->insert(make_pair(field->unique_name(), type)).second; 134 return map->insert(make_pair(field->unique_name(), type)).second;
135 } 135 }
136 136
137 // static. 137 // static.
138 bool FormField::MatchAndAdvance(AutofillScanner* scanner, 138 bool FormField::MatchAndAdvance(AutofillScanner* scanner,
139 const string16& pattern, 139 const base::string16& pattern,
140 int match_type, 140 int match_type,
141 const AutofillField** match) { 141 const AutofillField** match) {
142 const AutofillField* field = scanner->Cursor(); 142 const AutofillField* field = scanner->Cursor();
143 if (FormField::Match(field, pattern, match_type)) { 143 if (FormField::Match(field, pattern, match_type)) {
144 if (match) 144 if (match)
145 *match = field; 145 *match = field;
146 scanner->Advance(); 146 scanner->Advance();
147 return true; 147 return true;
148 } 148 }
149 149
150 return false; 150 return false;
151 } 151 }
152 152
153 // static 153 // static
154 bool FormField::Match(const AutofillField* field, 154 bool FormField::Match(const AutofillField* field,
155 const string16& pattern, 155 const base::string16& pattern,
156 int match_type) { 156 int match_type) {
157 if ((match_type & FormField::MATCH_LABEL) && 157 if ((match_type & FormField::MATCH_LABEL) &&
158 autofill::MatchesPattern(field->label, pattern)) { 158 autofill::MatchesPattern(field->label, pattern)) {
159 return true; 159 return true;
160 } 160 }
161 161
162 if ((match_type & FormField::MATCH_NAME) && 162 if ((match_type & FormField::MATCH_NAME) &&
163 autofill::MatchesPattern(field->name, pattern)) { 163 autofill::MatchesPattern(field->name, pattern)) {
164 return true; 164 return true;
165 } 165 }
(...skipping 22 matching lines...) Expand all
188 continue; 188 continue;
189 } 189 }
190 190
191 // Add entries into the map for each field type found in |form_field|. 191 // Add entries into the map for each field type found in |form_field|.
192 bool ok = form_field->ClassifyField(map); 192 bool ok = form_field->ClassifyField(map);
193 DCHECK(ok); 193 DCHECK(ok);
194 } 194 }
195 195
196 std::swap(*fields, remaining_fields); 196 std::swap(*fields, remaining_fields);
197 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698