| OLD | NEW |
| 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 COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Used to populate this FormGroup object with data. Canonicalizes the data | 56 // Used to populate this FormGroup object with data. Canonicalizes the data |
| 57 // according to the specified |app_locale| prior to storing, if appropriate. | 57 // according to the specified |app_locale| prior to storing, if appropriate. |
| 58 virtual bool SetInfo(AutofillFieldType type, | 58 virtual bool SetInfo(AutofillFieldType type, |
| 59 const string16& value, | 59 const string16& value, |
| 60 const std::string& app_locale); | 60 const std::string& app_locale); |
| 61 | 61 |
| 62 // Set |field_data|'s value based on |field| and contents of |this| (using | 62 // Set |field_data|'s value based on |field| and contents of |this| (using |
| 63 // data variant |variant|). It is an error to call the default implementation. | 63 // data variant |variant|). It is an error to call the default implementation. |
| 64 virtual void FillFormField(const AutofillField& field, | 64 virtual void FillFormField(const AutofillField& field, |
| 65 size_t variant, | 65 size_t variant, |
| 66 const std::string& app_locale, |
| 66 FormFieldData* field_data) const; | 67 FormFieldData* field_data) const; |
| 67 | 68 |
| 68 // Fills in select control with data matching |type| from |this|. | 69 // Fills in select control with data matching |type| from |this|. |
| 69 // Public for testing purposes. | 70 // Public for testing purposes. |
| 70 void FillSelectControl(AutofillFieldType type, | 71 void FillSelectControl(AutofillFieldType type, |
| 72 const std::string& app_locale, |
| 71 FormFieldData* field_data) const; | 73 FormFieldData* field_data) const; |
| 72 | 74 |
| 73 // Returns true if |value| is a valid US state name or abbreviation. It is | 75 // Returns true if |value| is a valid US state name or abbreviation. It is |
| 74 // case insensitive. Valid for US states only. | 76 // case insensitive. Valid for US states only. |
| 75 // TODO(estade): this is a crappy place for this function. | 77 // TODO(estade): this is a crappy place for this function. |
| 76 static bool IsValidState(const string16& value); | 78 static bool IsValidState(const string16& value); |
| 77 | 79 |
| 78 protected: | 80 protected: |
| 79 // AutofillProfile needs to call into GetSupportedTypes() for objects of | 81 // AutofillProfile needs to call into GetSupportedTypes() for objects of |
| 80 // non-AutofillProfile type, for which mere inheritance is insufficient. | 82 // non-AutofillProfile type, for which mere inheritance is insufficient. |
| 81 friend class AutofillProfile; | 83 friend class AutofillProfile; |
| 82 | 84 |
| 83 // Returns a set of AutofillFieldTypes for which this FormGroup can store | 85 // Returns a set of AutofillFieldTypes for which this FormGroup can store |
| 84 // data. This method is additive on |supported_types|. | 86 // data. This method is additive on |supported_types|. |
| 85 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0; | 87 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0; |
| 86 | 88 |
| 87 // Fills in a select control for a country from data in |this|. Returns true | 89 // Fills in a select control for a country from data in |this|. Returns true |
| 88 // for success. | 90 // for success. |
| 89 virtual bool FillCountrySelectControl(FormFieldData* field_data) const; | 91 virtual bool FillCountrySelectControl(const std::string& app_locale, |
| 92 FormFieldData* field_data) const; |
| 90 }; | 93 }; |
| 91 | 94 |
| 92 #endif // COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ | 95 #endif // COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ |
| OLD | NEW |