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

Unified Diff: chrome/browser/autofill/autofill_scanner.cc

Issue 7120005: Simplify Autofill Scanner semantics (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_scanner.h ('k') | chrome/browser/autofill/credit_card_field.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_scanner.cc
diff --git a/chrome/browser/autofill/autofill_scanner.cc b/chrome/browser/autofill/autofill_scanner.cc
index 1fd8a7ec9973ed44d0edd4e61f92a380e3cfc1ca..41aadc894f85a2dcaf3f99525f7e0c5fa9d30006 100644
--- a/chrome/browser/autofill/autofill_scanner.cc
+++ b/chrome/browser/autofill/autofill_scanner.cc
@@ -10,6 +10,8 @@
AutofillScanner::AutofillScanner(
const std::vector<const AutofillField*>& fields)
: cursor_(fields.begin()),
+ saved_cursor_(fields.begin()),
+ begin_(fields.begin()),
end_(fields.end()) {
}
@@ -35,11 +37,18 @@ bool AutofillScanner::IsEnd() const {
}
void AutofillScanner::Rewind() {
- DCHECK(!saved_cursors_.empty());
- cursor_ = saved_cursors_.back();
- saved_cursors_.pop_back();
+ DCHECK(saved_cursor_ != end_);
+ cursor_ = saved_cursor_;
+ saved_cursor_ = end_;
}
-void AutofillScanner::SaveCursor() {
- saved_cursors_.push_back(cursor_);
+void AutofillScanner::RewindTo(size_t index) {
+ DCHECK(index < static_cast<size_t>(end_ - begin_));
+ cursor_ = begin_ + index;
+ saved_cursor_ = end_;
+}
+
+size_t AutofillScanner::SaveCursor() {
+ saved_cursor_ = cursor_;
+ return static_cast<size_t>(cursor_ - begin_);
}
« no previous file with comments | « chrome/browser/autofill/autofill_scanner.h ('k') | chrome/browser/autofill/credit_card_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698