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_AUTOFILL_PROFILE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 AutoFillProfile(const string16& label, int unique_id); | 23 AutoFillProfile(const string16& label, int unique_id); |
24 // For use in STL containers. | 24 // For use in STL containers. |
25 AutoFillProfile(); | 25 AutoFillProfile(); |
26 AutoFillProfile(const AutoFillProfile&); | 26 AutoFillProfile(const AutoFillProfile&); |
27 virtual ~AutoFillProfile(); | 27 virtual ~AutoFillProfile(); |
28 | 28 |
29 // FormGroup implementation: | 29 // FormGroup implementation: |
30 virtual void GetPossibleFieldTypes(const string16& text, | 30 virtual void GetPossibleFieldTypes(const string16& text, |
31 FieldTypeSet* possible_types) const; | 31 FieldTypeSet* possible_types) const; |
| 32 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; |
32 virtual string16 GetFieldText(const AutoFillType& type) const; | 33 virtual string16 GetFieldText(const AutoFillType& type) const; |
33 // Returns true if the info matches the profile data corresponding to type. | 34 // Returns true if the info matches the profile data corresponding to type. |
34 // If the type is UNKNOWN_TYPE then info will be matched against all of the | 35 // If the type is UNKNOWN_TYPE then info will be matched against all of the |
35 // profile data. | 36 // profile data. |
36 virtual void FindInfoMatches(const AutoFillType& type, | 37 virtual void FindInfoMatches(const AutoFillType& type, |
37 const string16& info, | 38 const string16& info, |
38 std::vector<string16>* matched_text) const; | 39 std::vector<string16>* matched_text) const; |
39 virtual void SetInfo(const AutoFillType& type, const string16& value); | 40 virtual void SetInfo(const AutoFillType& type, const string16& value); |
40 // Returns a copy of the profile it is called on. The caller is responsible | 41 // Returns a copy of the profile it is called on. The caller is responsible |
41 // for deleting profile when they are done with it. | 42 // for deleting profile when they are done with it. |
42 virtual FormGroup* Clone() const; | 43 virtual FormGroup* Clone() const; |
43 virtual const string16& Label() const { return label_; } | 44 virtual const string16& Label() const { return label_; } |
44 | 45 |
45 void set_unique_id(int id) { unique_id_ = id; } | 46 void set_unique_id(int id) { unique_id_ = id; } |
46 int unique_id() const { return unique_id_; } | 47 int unique_id() const { return unique_id_; } |
47 | 48 |
| 49 // Returns true if the data in this profile is a subset of the data in |
| 50 // |profile|. |
| 51 bool IsSubsetOf(const AutoFillProfile& profile) const; |
| 52 |
| 53 // Returns true if the values of the intersection of the available field types |
| 54 // are equal. If the intersection is empty, the method returns false. |
| 55 bool IntersectionOfTypesHasEqualValues(const AutoFillProfile& profile) const; |
| 56 |
| 57 // Merges the profile data in |profile| with this profile. |
| 58 void MergeWith(const AutoFillProfile& profile); |
| 59 |
48 // Profile summary string for UI. | 60 // Profile summary string for UI. |
49 // Constructs a summary string based on NAME_FIRST, NAME_LAST, and | 61 // Constructs a summary string based on NAME_FIRST, NAME_LAST, and |
50 // ADDRESS_HOME_LINE1 fields of the profile. The summary string is of the | 62 // ADDRESS_HOME_LINE1 fields of the profile. The summary string is of the |
51 // form: | 63 // form: |
52 // L"<first_name> <last_name>, <address_line_1>" | 64 // L"<first_name> <last_name>, <address_line_1>" |
53 // but may omit any or all of the fields if they are not present in the | 65 // but may omit any or all of the fields if they are not present in the |
54 // profile. | 66 // profile. |
55 // The form of the string is governed by generated resources. | 67 // The form of the string is governed by generated resources. |
56 string16 PreviewSummary() const; | 68 string16 PreviewSummary() const; |
57 | 69 |
(...skipping 15 matching lines...) Expand all Loading... |
73 int unique_id_; | 85 int unique_id_; |
74 | 86 |
75 // Personal information for this profile. | 87 // Personal information for this profile. |
76 FormGroupMap personal_info_; | 88 FormGroupMap personal_info_; |
77 }; | 89 }; |
78 | 90 |
79 // So we can compare AutoFillProfiles with EXPECT_EQ(). | 91 // So we can compare AutoFillProfiles with EXPECT_EQ(). |
80 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); | 92 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); |
81 | 93 |
82 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ | 94 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ |
OLD | NEW |