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

Side by Side Diff: components/autofill/core/browser/credit_card_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/credit_card_field.h" 5 #include "components/autofill/core/browser/credit_card_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/memory/scoped_ptr.h"
11 #include "base/stl_util.h" 12 #include "base/stl_util.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "components/autofill/core/browser/autofill_field.h" 18 #include "components/autofill/core/browser/autofill_field.h"
18 #include "components/autofill/core/browser/autofill_regex_constants.h" 19 #include "components/autofill/core/browser/autofill_regex_constants.h"
19 #include "components/autofill/core/browser/autofill_scanner.h" 20 #include "components/autofill/core/browser/autofill_scanner.h"
20 #include "components/autofill/core/browser/field_types.h" 21 #include "components/autofill/core/browser/field_types.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 69 }
69 default: 70 default:
70 NOTREACHED(); 71 NOTREACHED();
71 return false; 72 return false;
72 } 73 }
73 } 74 }
74 75
75 } // namespace 76 } // namespace
76 77
77 // static 78 // static
78 scoped_ptr<FormField> CreditCardField::Parse(AutofillScanner* scanner) { 79 std::unique_ptr<FormField> CreditCardField::Parse(AutofillScanner* scanner) {
79 if (scanner->IsEnd()) 80 if (scanner->IsEnd())
80 return nullptr; 81 return nullptr;
81 82
82 scoped_ptr<CreditCardField> credit_card_field(new CreditCardField); 83 std::unique_ptr<CreditCardField> credit_card_field(new CreditCardField);
83 size_t saved_cursor = scanner->SaveCursor(); 84 size_t saved_cursor = scanner->SaveCursor();
84 85
85 // Credit card fields can appear in many different orders. 86 // Credit card fields can appear in many different orders.
86 // We loop until no more credit card related fields are found, see |break| at 87 // We loop until no more credit card related fields are found, see |break| at
87 // the bottom of the loop. 88 // the bottom of the loop.
88 for (int fields = 0; !scanner->IsEnd(); ++fields) { 89 for (int fields = 0; !scanner->IsEnd(); ++fields) {
89 // Ignore gift card fields. 90 // Ignore gift card fields.
90 if (IsGiftCardField(scanner)) 91 if (IsGiftCardField(scanner))
91 break; 92 break;
92 93
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 : ((expiration_year_ && expiration_year_->max_length == 2) 504 : ((expiration_year_ && expiration_year_->max_length == 2)
504 ? CREDIT_CARD_EXP_2_DIGIT_YEAR 505 ? CREDIT_CARD_EXP_2_DIGIT_YEAR
505 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); 506 : CREDIT_CARD_EXP_4_DIGIT_YEAR));
506 } 507 }
507 508
508 bool CreditCardField::HasExpiration() const { 509 bool CreditCardField::HasExpiration() const {
509 return expiration_date_ || (expiration_month_ && expiration_year_); 510 return expiration_date_ || (expiration_month_ && expiration_year_);
510 } 511 }
511 512
512 } // namespace autofill 513 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card_field.h ('k') | components/autofill/core/browser/credit_card_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698