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

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

Issue 13888008: Fix for forms with more than three address lines getting partially Autofilled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « no previous file | components/autofill/browser/autofill_regex_constants.h » ('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 (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/address_field.h" 5 #include "components/autofill/browser/address_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Some pages have 3 address lines (eg SharperImageModifyAccount.html) 220 // Some pages have 3 address lines (eg SharperImageModifyAccount.html)
221 // Some pages even have 4 address lines (e.g. uk/ShoesDirect2.html)! 221 // Some pages even have 4 address lines (e.g. uk/ShoesDirect2.html)!
222 pattern = UTF8ToUTF16(autofill::kAddressLine2Re); 222 pattern = UTF8ToUTF16(autofill::kAddressLine2Re);
223 label_pattern = UTF8ToUTF16(autofill::kAddressLine2LabelRe); 223 label_pattern = UTF8ToUTF16(autofill::kAddressLine2LabelRe);
224 if (!ParseEmptyLabel(scanner, &address_field->address2_) && 224 if (!ParseEmptyLabel(scanner, &address_field->address2_) &&
225 !ParseField(scanner, pattern, &address_field->address2_)) { 225 !ParseField(scanner, pattern, &address_field->address2_)) {
226 ParseFieldSpecifics(scanner, label_pattern, MATCH_LABEL | MATCH_TEXT, 226 ParseFieldSpecifics(scanner, label_pattern, MATCH_LABEL | MATCH_TEXT,
227 &address_field->address2_); 227 &address_field->address2_);
228 } 228 }
229 229
230 // Try for a third line, which we will promptly discard. 230 // Try for surplus lines, which we will promptly discard.
231 if (address_field->address2_ != NULL) { 231 if (address_field->address2_ != NULL) {
232 pattern = UTF8ToUTF16(autofill::kAddressLine3Re); 232 do
233 ParseField(scanner, pattern, NULL); 233 pattern = UTF8ToUTF16(autofill::kAddressLinesExtraRe);
234 while (ParseField(scanner, pattern, NULL));
Ilya Sherman 2013/04/17 05:56:33 nit: Please write this as: pattern = UTF8ToUTF16(
Jim Blackler 2013/04/18 13:49:22 Oh yeah it seems I didn't study that closely what
234 } 235 }
235 236
236 return true; 237 return true;
237 } 238 }
238 239
239 // static 240 // static
240 bool AddressField::ParseCountry(AutofillScanner* scanner, 241 bool AddressField::ParseCountry(AutofillScanner* scanner,
241 AddressField* address_field) { 242 AddressField* address_field) {
242 // Parse a country. The occasional page (e.g. 243 // Parse a country. The occasional page (e.g.
243 // Travelocity_New Member Information1.html) calls this a "location". 244 // Travelocity_New Member Information1.html) calls this a "location".
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 if (bill == base::string16::npos && ship != base::string16::npos) 331 if (bill == base::string16::npos && ship != base::string16::npos)
331 return kShippingAddress; 332 return kShippingAddress;
332 333
333 if (bill > ship) 334 if (bill > ship)
334 return kBillingAddress; 335 return kBillingAddress;
335 336
336 return kShippingAddress; 337 return kShippingAddress;
337 } 338 }
338 339
339 } // namespace autofill 340 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/browser/autofill_regex_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698