OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/string16.h" |
| 11 |
| 12 // This class is an interface for collections of form fields, grouped by type. |
| 13 // The information in objects of this class is managed by the |
| 14 // PersonalDataManager. |
| 15 class FormGroup { |
| 16 public: |
| 17 virtual ~FormGroup() {} |
| 18 |
| 19 // Returns a clone of this object. |
| 20 virtual FormGroup* Clone() const = 0; |
| 21 |
| 22 // Used to determine the type of a field based on the text that a user enters |
| 23 // into the field. The field types can then be reported back to the server. |
| 24 virtual void GetPossibleFieldTypes(const string16& text, |
| 25 FieldTypeSet* possible_types) const = 0; |
| 26 |
| 27 // Returns the string that should be autofilled into a text field given the |
| 28 // type of that field. |
| 29 virtual string16 GetFieldText(const AutoFillType& type) const = 0; |
| 30 |
| 31 // Returns the text for preview. |
| 32 virtual string16 GetPreviewText(const AutoFillType& type) const { |
| 33 return GetFieldText(type); |
| 34 } |
| 35 |
| 36 // Used to determine if the text being typed into a field matches the |
| 37 // information in this FormGroup object. This is used by the preview |
| 38 // functionality. |matched_text| will be populated with all of the possible |
| 39 // matches given the type. |
| 40 virtual void FindInfoMatches(const AutoFillType& type, |
| 41 const string16& info, |
| 42 std::vector<string16>* matched_text) const = 0; |
| 43 |
| 44 // Used to populate this FormGroup object with data. |
| 45 virtual void SetInfo(const AutoFillType& type, const string16& value) = 0; |
| 46 |
| 47 // Returns the label for this FormGroup item. This should be overridden for |
| 48 // form group items that implement a label. |
| 49 virtual string16 Label() const { return EmptyString(); } |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ |
OLD | NEW |