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

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

Issue 17392006: In components/autofill, move browser/ to core/browser/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to fix conflicts Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/autofill/browser/autofill_scanner.h"
6
7 #include "base/logging.h"
8 #include "components/autofill/browser/autofill_field.h"
9
10 namespace autofill {
11
12 AutofillScanner::AutofillScanner(
13 const std::vector<const AutofillField*>& fields)
14 : cursor_(fields.begin()),
15 saved_cursor_(fields.begin()),
16 begin_(fields.begin()),
17 end_(fields.end()) {
18 }
19
20 AutofillScanner::~AutofillScanner() {
21 }
22
23 void AutofillScanner::Advance() {
24 DCHECK(!IsEnd());
25 ++cursor_;
26 }
27
28 const AutofillField* AutofillScanner::Cursor() const {
29 if (IsEnd()) {
30 NOTREACHED();
31 return NULL;
32 }
33
34 return *cursor_;
35 }
36
37 bool AutofillScanner::IsEnd() const {
38 return cursor_ == end_;
39 }
40
41 void AutofillScanner::Rewind() {
42 DCHECK(saved_cursor_ != end_);
43 cursor_ = saved_cursor_;
44 saved_cursor_ = end_;
45 }
46
47 void AutofillScanner::RewindTo(size_t index) {
48 DCHECK(index < static_cast<size_t>(end_ - begin_));
49 cursor_ = begin_ + index;
50 saved_cursor_ = end_;
51 }
52
53 size_t AutofillScanner::SaveCursor() {
54 saved_cursor_ = cursor_;
55 return static_cast<size_t>(cursor_ - begin_);
56 }
57
58 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_scanner.h ('k') | components/autofill/browser/autofill_server_field_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698