| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_FORM_GROUP_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ | 6 #define CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Returns a set of AutoFillFieldTypes for which this FormGroup has non-empty | 32 // Returns a set of AutoFillFieldTypes for which this FormGroup has non-empty |
| 33 // data. | 33 // data. |
| 34 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const = 0; | 34 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const = 0; |
| 35 | 35 |
| 36 // Returns the string that should be auto-filled into a text field given the | 36 // Returns the string that should be auto-filled into a text field given the |
| 37 // type of that field. | 37 // type of that field. |
| 38 virtual string16 GetFieldText(const AutoFillType& type) const = 0; | 38 virtual string16 GetFieldText(const AutoFillType& type) const = 0; |
| 39 | 39 |
| 40 // Returns the text for preview. | 40 // Returns the text for preview. |
| 41 virtual string16 GetPreviewText(const AutoFillType& type) const { | 41 virtual string16 GetPreviewText(const AutoFillType& type) const; |
| 42 return GetFieldText(type); | |
| 43 } | |
| 44 | 42 |
| 45 // Used to determine if the text being typed into a field matches the | 43 // Used to determine if the text being typed into a field matches the |
| 46 // information in this FormGroup object. This is used by the preview | 44 // information in this FormGroup object. This is used by the preview |
| 47 // functionality. |matched_text| will be populated with all of the possible | 45 // functionality. |matched_text| will be populated with all of the possible |
| 48 // matches given the type. This method is additive on |matched_text|. | 46 // matches given the type. This method is additive on |matched_text|. |
| 49 virtual void FindInfoMatches(const AutoFillType& type, | 47 virtual void FindInfoMatches(const AutoFillType& type, |
| 50 const string16& info, | 48 const string16& info, |
| 51 std::vector<string16>* matched_text) const = 0; | 49 std::vector<string16>* matched_text) const = 0; |
| 52 | 50 |
| 53 // Used to populate this FormGroup object with data. | 51 // Used to populate this FormGroup object with data. |
| 54 virtual void SetInfo(const AutoFillType& type, const string16& value) = 0; | 52 virtual void SetInfo(const AutoFillType& type, const string16& value) = 0; |
| 55 | 53 |
| 56 // Returns the label for this FormGroup item. This should be overridden for | 54 // Returns the label for this FormGroup item. This should be overridden for |
| 57 // form group items that implement a label. | 55 // form group items that implement a label. |
| 58 virtual const string16& Label() const { return EmptyString16(); } | 56 virtual const string16& Label() const; |
| 59 | 57 |
| 60 // Returns true if the field data in |form_group| does not match the field | 58 // Returns true if the field data in |form_group| does not match the field |
| 61 // data in this FormGroup. | 59 // data in this FormGroup. |
| 62 virtual bool operator!=(const FormGroup& form_group) const; | 60 virtual bool operator!=(const FormGroup& form_group) const; |
| 63 | 61 |
| 64 // Returns true if the data in this FormGroup is a subset of the data in | 62 // Returns true if the data in this FormGroup is a subset of the data in |
| 65 // |form_group|. | 63 // |form_group|. |
| 66 bool IsSubsetOf(const FormGroup& form_group) const; | 64 bool IsSubsetOf(const FormGroup& form_group) const; |
| 67 | 65 |
| 68 // Returns true if the values of the intersection of the available field types | 66 // Returns true if the values of the intersection of the available field types |
| 69 // are equal. If the intersection is empty, the method returns false. | 67 // are equal. If the intersection is empty, the method returns false. |
| 70 bool IntersectionOfTypesHasEqualValues(const FormGroup& form_group) const; | 68 bool IntersectionOfTypesHasEqualValues(const FormGroup& form_group) const; |
| 71 | 69 |
| 72 // Merges the field data in |form_group| with this FormGroup. | 70 // Merges the field data in |form_group| with this FormGroup. |
| 73 void MergeWith(const FormGroup& form_group); | 71 void MergeWith(const FormGroup& form_group); |
| 74 }; | 72 }; |
| 75 | 73 |
| 76 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ | 74 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ |
| OLD | NEW |