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

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: Review revisions. 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
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 pattern = UTF8ToUTF16(autofill::kAddressLinesExtraRe);
233 ParseField(scanner, pattern, NULL); 233 while (ParseField(scanner, pattern, NULL)) {
234 // Consumed a surplus line, try for another.
235 }
234 } 236 }
235 237
236 return true; 238 return true;
237 } 239 }
238 240
239 // static 241 // static
240 bool AddressField::ParseCountry(AutofillScanner* scanner, 242 bool AddressField::ParseCountry(AutofillScanner* scanner,
241 AddressField* address_field) { 243 AddressField* address_field) {
242 // Parse a country. The occasional page (e.g. 244 // Parse a country. The occasional page (e.g.
243 // Travelocity_New Member Information1.html) calls this a "location". 245 // 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) 332 if (bill == base::string16::npos && ship != base::string16::npos)
331 return kShippingAddress; 333 return kShippingAddress;
332 334
333 if (bill > ship) 335 if (bill > ship)
334 return kBillingAddress; 336 return kBillingAddress;
335 337
336 return kShippingAddress; 338 return kShippingAddress;
337 } 339 }
338 340
339 } // namespace autofill 341 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698