OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_DATA_MODEL_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_DATA_MODEL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "components/autofill/browser/field_types.h" |
| 11 #include "components/autofill/browser/form_group.h" |
| 12 |
| 13 namespace autofill { |
| 14 |
| 15 class AutofillField; |
| 16 struct FormFieldData; |
| 17 |
| 18 // This class is an interface for the primary data models that back Autofill. |
| 19 // The information in objects of this class is managed by the |
| 20 // PersonalDataManager. |
| 21 class AutofillDataModel : public FormGroup { |
| 22 public: |
| 23 explicit AutofillDataModel(const std::string& guid); |
| 24 virtual ~AutofillDataModel(); |
| 25 |
| 26 // Set |field_data|'s value based on |field| and contents of |this| (using |
| 27 // data variant |variant|). |
| 28 virtual void FillFormField(const AutofillField& field, |
| 29 size_t variant, |
| 30 const std::string& app_locale, |
| 31 FormFieldData* field_data) const = 0; |
| 32 |
| 33 // Fills in select control with data matching |type| from |this|. |
| 34 // Public for testing purposes. |
| 35 void FillSelectControl(AutofillFieldType type, |
| 36 const std::string& app_locale, |
| 37 FormFieldData* field_data) const; |
| 38 |
| 39 std::string guid() const { return guid_; } |
| 40 void set_guid(const std::string& guid) { guid_ = guid; } |
| 41 |
| 42 protected: |
| 43 // Fills in a select control for a country from data in |this|. Returns true |
| 44 // for success. |
| 45 virtual bool FillCountrySelectControl(const std::string& app_locale, |
| 46 FormFieldData* field_data) const; |
| 47 |
| 48 private: |
| 49 // A globally unique ID for this object. |
| 50 std::string guid_; |
| 51 }; |
| 52 |
| 53 } // namespace autofill |
| 54 |
| 55 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_DATA_MODEL_H_ |
OLD | NEW |