summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_scanner.h
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 00:10:51 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 00:10:51 +0000
commit45d2a8a014f1a36c710ced424fcf83c2900827d8 (patch)
treeca60e2227c68a1c662dfe218629c1638b61dde6a /chrome/browser/autofill/autofill_scanner.h
parente9832c0aa2567a84f5a49d120b7ed9acff39ed47 (diff)
downloadchromium_src-45d2a8a014f1a36c710ced424fcf83c2900827d8.zip
chromium_src-45d2a8a014f1a36c710ced424fcf83c2900827d8.tar.gz
chromium_src-45d2a8a014f1a36c710ced424fcf83c2900827d8.tar.bz2
Simplify Autofill Scanner semantics
SaveCursor() no longer provides stack semantics. Instead, it only saves the most recent cursor position. Clients who want to save multiple cursors can now capture the result of SaveCursor() and later explicitly RewindTo() saved positions. BUG=85142 TEST=unit_tests --gtest_filter=Autofill*:CreditCard*:FormField* Review URL: http://codereview.chromium.org/7120005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_scanner.h')
-rw-r--r--chrome/browser/autofill/autofill_scanner.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/autofill/autofill_scanner.h b/chrome/browser/autofill/autofill_scanner.h
index 789889b..562bab8 100644
--- a/chrome/browser/autofill/autofill_scanner.h
+++ b/chrome/browser/autofill/autofill_scanner.h
@@ -29,19 +29,25 @@ class AutofillScanner {
// Returns |true| if the cursor has reached the end of the stream.
bool IsEnd() const;
- // Returns the most recently saved cursor -- see also |SaveCursor()|.
+ // Restores the most recently saved cursor. See also |SaveCursor()|.
void Rewind();
- // Saves the current cursor position. Multiple cursor positions can be saved,
- // with stack ordering semantics. See also |Rewind()|.
- void SaveCursor();
+ // Repositions the cursor to the specified |index|. See also |SaveCursor()|.
+ void RewindTo(size_t index);
+
+ // Saves and returns the current cursor position. See also |Rewind()| and
+ // |RewindTo()|.
+ size_t SaveCursor();
private:
// Indicates the current position in the stream, represented as a vector.
std::vector<const AutofillField*>::const_iterator cursor_;
- // A stack of saved positions in the stream.
- std::vector<std::vector<const AutofillField*>::const_iterator> saved_cursors_;
+ // The most recently saved cursor.
+ std::vector<const AutofillField*>::const_iterator saved_cursor_;
+
+ // The beginning pointer for the stream.
+ const std::vector<const AutofillField*>::const_iterator begin_;
// The past-the-end pointer for the stream.
const std::vector<const AutofillField*>::const_iterator end_;