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

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

Issue 1859453002: components/autofill: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 4 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 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/address_field.h" 5 #include "components/autofill/core/browser/address_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
9 #include <memory>
8 #include <utility> 10 #include <utility>
9 11
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "components/autofill/core/browser/autofill_field.h" 16 #include "components/autofill/core/browser/autofill_field.h"
16 #include "components/autofill/core/browser/autofill_regex_constants.h" 17 #include "components/autofill/core/browser/autofill_regex_constants.h"
17 #include "components/autofill/core/browser/autofill_scanner.h" 18 #include "components/autofill/core/browser/autofill_scanner.h"
18 #include "components/autofill/core/browser/field_types.h" 19 #include "components/autofill/core/browser/field_types.h"
19 20
20 using base::UTF8ToUTF16; 21 using base::UTF8ToUTF16;
21 22
(...skipping 12 matching lines...) Expand all
34 // Some sites use type="tel" for zip fields (to get a numerical input). 35 // Some sites use type="tel" for zip fields (to get a numerical input).
35 // http://crbug.com/426958 36 // http://crbug.com/426958
36 const int AddressField::kZipCodeMatchType = 37 const int AddressField::kZipCodeMatchType =
37 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER; 38 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER;
38 39
39 // Select fields are allowed here. This occurs on top-100 site rediff.com. 40 // Select fields are allowed here. This occurs on top-100 site rediff.com.
40 const int AddressField::kCityMatchType = MATCH_DEFAULT | MATCH_SELECT; 41 const int AddressField::kCityMatchType = MATCH_DEFAULT | MATCH_SELECT;
41 42
42 const int AddressField::kStateMatchType = MATCH_DEFAULT | MATCH_SELECT; 43 const int AddressField::kStateMatchType = MATCH_DEFAULT | MATCH_SELECT;
43 44
44 scoped_ptr<FormField> AddressField::Parse(AutofillScanner* scanner) { 45 std::unique_ptr<FormField> AddressField::Parse(AutofillScanner* scanner) {
45 if (scanner->IsEnd()) 46 if (scanner->IsEnd())
46 return NULL; 47 return NULL;
47 48
48 scoped_ptr<AddressField> address_field(new AddressField); 49 std::unique_ptr<AddressField> address_field(new AddressField);
49 const AutofillField* const initial_field = scanner->Cursor(); 50 const AutofillField* const initial_field = scanner->Cursor();
50 size_t saved_cursor = scanner->SaveCursor(); 51 size_t saved_cursor = scanner->SaveCursor();
51 52
52 base::string16 attention_ignored = UTF8ToUTF16(kAttentionIgnoredRe); 53 base::string16 attention_ignored = UTF8ToUTF16(kAttentionIgnoredRe);
53 base::string16 region_ignored = UTF8ToUTF16(kRegionIgnoredRe); 54 base::string16 region_ignored = UTF8ToUTF16(kRegionIgnoredRe);
54 55
55 // Allow address fields to appear in any order. 56 // Allow address fields to appear in any order.
56 size_t begin_trailing_non_labeled_fields = 0; 57 size_t begin_trailing_non_labeled_fields = 0;
57 bool has_trailing_non_labeled_fields = false; 58 bool has_trailing_non_labeled_fields = false;
58 while (!scanner->IsEnd()) { 59 while (!scanner->IsEnd()) {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 AddressField::ParseNameLabelResult AddressField::ParseNameAndLabelForState( 414 AddressField::ParseNameLabelResult AddressField::ParseNameAndLabelForState(
414 AutofillScanner* scanner) { 415 AutofillScanner* scanner) {
415 if (state_) 416 if (state_)
416 return RESULT_MATCH_NONE; 417 return RESULT_MATCH_NONE;
417 418
418 return ParseNameAndLabelSeparately( 419 return ParseNameAndLabelSeparately(
419 scanner, UTF8ToUTF16(kStateRe), kStateMatchType, &state_); 420 scanner, UTF8ToUTF16(kStateRe), kStateMatchType, &state_);
420 } 421 }
421 422
422 } // namespace autofill 423 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/address_field.h ('k') | components/autofill/core/browser/address_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698