OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_CORE_BROWSER_AUTOFILL_PROFILE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <iosfwd> | 10 #include <iosfwd> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // implements the FormGroup interface so that owners of this object can request | 26 // implements the FormGroup interface so that owners of this object can request |
27 // form information from the profile, and the profile will delegate the request | 27 // form information from the profile, and the profile will delegate the request |
28 // to the requested form group type. | 28 // to the requested form group type. |
29 class AutofillProfile : public AutofillDataModel { | 29 class AutofillProfile : public AutofillDataModel { |
30 public: | 30 public: |
31 AutofillProfile(const std::string& guid, const std::string& origin); | 31 AutofillProfile(const std::string& guid, const std::string& origin); |
32 | 32 |
33 // For use in STL containers. | 33 // For use in STL containers. |
34 AutofillProfile(); | 34 AutofillProfile(); |
35 AutofillProfile(const AutofillProfile& profile); | 35 AutofillProfile(const AutofillProfile& profile); |
36 virtual ~AutofillProfile(); | 36 ~AutofillProfile() override; |
37 | 37 |
38 AutofillProfile& operator=(const AutofillProfile& profile); | 38 AutofillProfile& operator=(const AutofillProfile& profile); |
39 | 39 |
40 // FormGroup: | 40 // FormGroup: |
41 virtual void GetMatchingTypes( | 41 void GetMatchingTypes(const base::string16& text, |
42 const base::string16& text, | 42 const std::string& app_locale, |
43 const std::string& app_locale, | 43 ServerFieldTypeSet* matching_types) const override; |
44 ServerFieldTypeSet* matching_types) const override; | 44 base::string16 GetRawInfo(ServerFieldType type) const override; |
45 virtual base::string16 GetRawInfo(ServerFieldType type) const override; | 45 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
46 virtual void SetRawInfo(ServerFieldType type, | 46 base::string16 GetInfo(const AutofillType& type, |
47 const base::string16& value) override; | 47 const std::string& app_locale) const override; |
48 virtual base::string16 GetInfo(const AutofillType& type, | 48 bool SetInfo(const AutofillType& type, |
49 const std::string& app_locale) const override; | 49 const base::string16& value, |
50 virtual bool SetInfo(const AutofillType& type, | 50 const std::string& app_locale) override; |
51 const base::string16& value, | |
52 const std::string& app_locale) override; | |
53 | 51 |
54 // AutofillDataModel: | 52 // AutofillDataModel: |
55 virtual base::string16 GetInfoForVariant( | 53 base::string16 GetInfoForVariant( |
56 const AutofillType& type, | 54 const AutofillType& type, |
57 size_t variant, | 55 size_t variant, |
58 const std::string& app_locale) const override; | 56 const std::string& app_locale) const override; |
59 | 57 |
60 // Multi-value equivalents to |GetInfo| and |SetInfo|. | 58 // Multi-value equivalents to |GetInfo| and |SetInfo|. |
61 void SetRawMultiInfo(ServerFieldType type, | 59 void SetRawMultiInfo(ServerFieldType type, |
62 const std::vector<base::string16>& values); | 60 const std::vector<base::string16>& values); |
63 void GetRawMultiInfo(ServerFieldType type, | 61 void GetRawMultiInfo(ServerFieldType type, |
64 std::vector<base::string16>* values) const; | 62 std::vector<base::string16>* values) const; |
65 void SetMultiInfo(const AutofillType& type, | 63 void SetMultiInfo(const AutofillType& type, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 142 |
145 const std::string& language_code() const { return language_code_; } | 143 const std::string& language_code() const { return language_code_; } |
146 void set_language_code(const std::string& language_code) { | 144 void set_language_code(const std::string& language_code) { |
147 language_code_ = language_code; | 145 language_code_ = language_code; |
148 } | 146 } |
149 | 147 |
150 private: | 148 private: |
151 typedef std::vector<const FormGroup*> FormGroupList; | 149 typedef std::vector<const FormGroup*> FormGroupList; |
152 | 150 |
153 // FormGroup: | 151 // FormGroup: |
154 virtual void GetSupportedTypes( | 152 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
155 ServerFieldTypeSet* supported_types) const override; | |
156 | 153 |
157 // Shared implementation for GetRawMultiInfo() and GetMultiInfo(). Pass an | 154 // Shared implementation for GetRawMultiInfo() and GetMultiInfo(). Pass an |
158 // empty |app_locale| to get the raw info; otherwise, the returned info is | 155 // empty |app_locale| to get the raw info; otherwise, the returned info is |
159 // canonicalized according to the given |app_locale|, if appropriate. | 156 // canonicalized according to the given |app_locale|, if appropriate. |
160 void GetMultiInfoImpl(const AutofillType& type, | 157 void GetMultiInfoImpl(const AutofillType& type, |
161 const std::string& app_locale, | 158 const std::string& app_locale, |
162 std::vector<base::string16>* values) const; | 159 std::vector<base::string16>* values) const; |
163 | 160 |
164 // Builds inferred label from the first |num_fields_to_include| non-empty | 161 // Builds inferred label from the first |num_fields_to_include| non-empty |
165 // fields in |label_fields|. Uses as many fields as possible if there are not | 162 // fields in |label_fields|. Uses as many fields as possible if there are not |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // The BCP 47 language code that can be used to format |address_| for display. | 202 // The BCP 47 language code that can be used to format |address_| for display. |
206 std::string language_code_; | 203 std::string language_code_; |
207 }; | 204 }; |
208 | 205 |
209 // So we can compare AutofillProfiles with EXPECT_EQ(). | 206 // So we can compare AutofillProfiles with EXPECT_EQ(). |
210 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); | 207 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); |
211 | 208 |
212 } // namespace autofill | 209 } // namespace autofill |
213 | 210 |
214 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ | 211 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ |
OLD | NEW |