OLD | NEW |
---|---|
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 "chrome/browser/autofill/autofill_scanner.h" | 5 #include "chrome/browser/autofill/autofill_scanner.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/autofill/autofill_field.h" | 8 #include "chrome/browser/autofill/autofill_field.h" |
9 | 9 |
10 AutofillScanner::AutofillScanner(const std::vector<AutofillField*>& fields) | 10 AutofillScanner::AutofillScanner(const std::vector<AutofillField*>& fields) |
(...skipping 21 matching lines...) Expand all Loading... | |
32 bool AutofillScanner::IsEnd() const { | 32 bool AutofillScanner::IsEnd() const { |
33 return cursor_ == end_; | 33 return cursor_ == end_; |
34 } | 34 } |
35 | 35 |
36 void AutofillScanner::Rewind() { | 36 void AutofillScanner::Rewind() { |
37 DCHECK(!saved_cursors_.empty()); | 37 DCHECK(!saved_cursors_.empty()); |
38 cursor_ = saved_cursors_.back(); | 38 cursor_ = saved_cursors_.back(); |
39 saved_cursors_.pop_back(); | 39 saved_cursors_.pop_back(); |
40 } | 40 } |
41 | 41 |
42 void AutofillScanner::SaveCursor() { | 42 void AutofillScanner::RewindTo(size_t position) { |
43 saved_cursors_.resize(position); | |
44 cursor_ = saved_cursors_.back(); | |
45 saved_cursors_.pop_back(); | |
Ilya Sherman
2011/05/13 00:54:53
(See also the comment below)
Let's instead have t
| |
46 } | |
47 | |
48 size_t AutofillScanner::SaveCursor() { | |
43 saved_cursors_.push_back(cursor_); | 49 saved_cursors_.push_back(cursor_); |
50 size_t index = saved_cursors_.size(); | |
Ilya Sherman
2011/05/13 00:54:53
Let's instead have this be
size_t index = cursor_
| |
51 return index; | |
44 } | 52 } |
OLD | NEW |