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

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

Issue 381613005: [Autofill] Autofill fails to fill credit card number when split across fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated review inputs. Created 6 years, 3 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/autofill_scanner.h" 5 #include "components/autofill/core/browser/autofill_scanner.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/autofill/core/browser/autofill_field.h" 8 #include "components/autofill/core/browser/autofill_field.h"
9 9
10 namespace autofill { 10 namespace autofill {
11 11
12 AutofillScanner::AutofillScanner( 12 AutofillScanner::AutofillScanner(std::vector<AutofillField*>& fields)
13 const std::vector<const AutofillField*>& fields)
14 : cursor_(fields.begin()), 13 : cursor_(fields.begin()),
15 saved_cursor_(fields.begin()), 14 saved_cursor_(fields.begin()),
16 begin_(fields.begin()), 15 begin_(fields.begin()),
17 end_(fields.end()) { 16 end_(fields.end()) {
18 } 17 }
19 18
20 AutofillScanner::~AutofillScanner() { 19 AutofillScanner::~AutofillScanner() {
21 } 20 }
22 21
23 void AutofillScanner::Advance() { 22 void AutofillScanner::Advance() {
24 DCHECK(!IsEnd()); 23 DCHECK(!IsEnd());
25 ++cursor_; 24 ++cursor_;
26 } 25 }
27 26
28 const AutofillField* AutofillScanner::Cursor() const { 27 AutofillField* AutofillScanner::Cursor() const {
29 if (IsEnd()) { 28 if (IsEnd()) {
30 NOTREACHED(); 29 NOTREACHED();
31 return NULL; 30 return NULL;
32 } 31 }
33 32
34 return *cursor_; 33 return *cursor_;
35 } 34 }
36 35
37 bool AutofillScanner::IsEnd() const { 36 bool AutofillScanner::IsEnd() const {
38 return cursor_ == end_; 37 return cursor_ == end_;
(...skipping 10 matching lines...) Expand all
49 cursor_ = begin_ + index; 48 cursor_ = begin_ + index;
50 saved_cursor_ = end_; 49 saved_cursor_ = end_;
51 } 50 }
52 51
53 size_t AutofillScanner::SaveCursor() { 52 size_t AutofillScanner::SaveCursor() {
54 saved_cursor_ = cursor_; 53 saved_cursor_ = cursor_;
55 return static_cast<size_t>(cursor_ - begin_); 54 return static_cast<size_t>(cursor_ - begin_);
56 } 55 }
57 56
58 } // namespace autofill 57 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_scanner.h ('k') | components/autofill/core/browser/credit_card_field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698