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

Side by Side Diff: chrome/browser/autofill/autofill_scanner.h

Issue 11415221: Add support for autofilling radio buttons and checkboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix browser tests (added more data in .out files, skip checkable elements when trying to parse with… Created 8 years 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 (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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 12
13 class AutofillField; 13 class AutofillField;
14 14
15 // A helper class for parsing a stream of |AutofillField|'s with lookahead. 15 // A helper class for parsing a stream of |AutofillField|'s with lookahead.
16 // Ignores checkable AutofillFields as they interfere when parsers assume
17 // correct context (Eg., while parsing address, "Is PO box" checkbox
18 // interferes with correctly understanding ADDRESS_LINE2).
Ilya Sherman 2012/12/15 01:08:36 Rather than changing the scanner class, please cha
Raman Kakilate 2012/12/17 20:11:01 Done.
16 class AutofillScanner { 19 class AutofillScanner {
17 public: 20 public:
18 explicit AutofillScanner(const std::vector<const AutofillField*>& fields); 21 explicit AutofillScanner(const std::vector<const AutofillField*>& fields);
19 ~AutofillScanner(); 22 ~AutofillScanner();
20 23
21 // Advances the cursor by one step, if possible. 24 // Advances the cursor by one step, if possible.
22 void Advance(); 25 void Advance();
23 26
24 // Returns the current field in the stream, or |NULL| if there are no more 27 // Returns the current field in the stream, or |NULL| if there are no more
25 // fields in the stream. 28 // fields in the stream.
26 const AutofillField* Cursor() const; 29 const AutofillField* Cursor();
27 30
28 // Returns |true| if the cursor has reached the end of the stream. 31 // Returns |true| if the cursor has reached the end of the stream.
29 bool IsEnd() const; 32 bool IsEnd();
30 33
31 // Restores the most recently saved cursor. See also |SaveCursor()|. 34 // Restores the most recently saved cursor. See also |SaveCursor()|.
32 void Rewind(); 35 void Rewind();
33 36
34 // Repositions the cursor to the specified |index|. See also |SaveCursor()|. 37 // Repositions the cursor to the specified |index|. See also |SaveCursor()|.
35 void RewindTo(size_t index); 38 void RewindTo(size_t index);
36 39
37 // Saves and returns the current cursor position. See also |Rewind()| and 40 // Saves and returns the current cursor position. See also |Rewind()| and
38 // |RewindTo()|. 41 // |RewindTo()|.
39 size_t SaveCursor(); 42 size_t SaveCursor();
40 43
41 private: 44 private:
42 // Indicates the current position in the stream, represented as a vector. 45 // Indicates the current position in the stream, represented as a vector.
43 std::vector<const AutofillField*>::const_iterator cursor_; 46 std::vector<const AutofillField*>::const_iterator cursor_;
44 47
45 // The most recently saved cursor. 48 // The most recently saved cursor.
46 std::vector<const AutofillField*>::const_iterator saved_cursor_; 49 std::vector<const AutofillField*>::const_iterator saved_cursor_;
47 50
48 // The beginning pointer for the stream. 51 // The beginning pointer for the stream.
49 const std::vector<const AutofillField*>::const_iterator begin_; 52 const std::vector<const AutofillField*>::const_iterator begin_;
50 53
51 // The past-the-end pointer for the stream. 54 // The past-the-end pointer for the stream.
52 const std::vector<const AutofillField*>::const_iterator end_; 55 const std::vector<const AutofillField*>::const_iterator end_;
53 56
57 // Skip all clickable fields.
58 void SkipClickables();
59
54 DISALLOW_COPY_AND_ASSIGN(AutofillScanner); 60 DISALLOW_COPY_AND_ASSIGN(AutofillScanner);
55 }; 61 };
56 62
57 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ 63 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698