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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Returns true if the info matches the profile data corresponding to type. | 39 // Returns true if the info matches the profile data corresponding to type. |
40 // If the type is UNKNOWN_TYPE then info will be matched against all of the | 40 // If the type is UNKNOWN_TYPE then info will be matched against all of the |
41 // profile data. | 41 // profile data. |
42 virtual void FindInfoMatches(const AutoFillType& type, | 42 virtual void FindInfoMatches(const AutoFillType& type, |
43 const string16& info, | 43 const string16& info, |
44 std::vector<string16>* matched_text) const; | 44 std::vector<string16>* matched_text) const; |
45 virtual void SetInfo(const AutoFillType& type, const string16& value); | 45 virtual void SetInfo(const AutoFillType& type, const string16& value); |
46 // Returns a copy of the profile it is called on. The caller is responsible | 46 // Returns a copy of the profile it is called on. The caller is responsible |
47 // for deleting profile when they are done with it. | 47 // for deleting profile when they are done with it. |
48 virtual FormGroup* Clone() const; | 48 virtual FormGroup* Clone() const; |
| 49 // The user-visible label of the profile, generated in relation to other |
| 50 // profiles. Shows at least 2 fields that differentiate profile from other |
| 51 // profiles. See AdjustInferredLabels() further down for more description. |
49 virtual const string16& Label() const; | 52 virtual const string16& Label() const; |
50 | 53 |
51 int unique_id() const { return unique_id_; } | 54 int unique_id() const { return unique_id_; } |
52 void set_unique_id(int id) { unique_id_ = id; } | 55 void set_unique_id(int id) { unique_id_ = id; } |
53 | 56 |
54 // This guid is the primary identifier for |AutoFillProfile| objects. | 57 // This guid is the primary identifier for |AutoFillProfile| objects. |
55 const std::string guid() const { return guid_; } | 58 const std::string guid() const { return guid_; } |
56 void set_guid(const std::string& guid) { guid_ = guid; } | 59 void set_guid(const std::string& guid) { guid_ = guid; } |
57 | 60 |
58 // Profile summary string for UI. | |
59 // Constructs a summary string based on NAME_FIRST, NAME_LAST, and | |
60 // ADDRESS_HOME_LINE1 fields of the profile. The summary string is of the | |
61 // form: | |
62 // L"<first_name> <last_name>, <address_line_1>" | |
63 // but may omit any or all of the fields if they are not present in the | |
64 // profile. | |
65 // The form of the string is governed by generated resources. | |
66 string16 PreviewSummary() const; | |
67 | |
68 // Adjusts the labels according to profile data. | 61 // Adjusts the labels according to profile data. |
69 // Labels contain minimal different combination of: | 62 // Labels contain minimal different combination of: |
70 // 1. Full name. | 63 // 1. Full name. |
71 // 2. Address. | 64 // 2. Address. |
72 // 3. E-mail. | 65 // 3. E-mail. |
73 // 4. Phone. | 66 // 4. Phone. |
74 // 5. Fax. | 67 // 5. Fax. |
75 // 6. Company name. | 68 // 6. Company name. |
76 // Profile labels are changed accordingly to these rules. | 69 // Profile labels are changed accordingly to these rules. |
77 // Returns true if any of the profiles were updated. | 70 // Returns true if any of the profiles were updated. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 std::string guid_; | 124 std::string guid_; |
132 | 125 |
133 // Personal information for this profile. | 126 // Personal information for this profile. |
134 FormGroupMap personal_info_; | 127 FormGroupMap personal_info_; |
135 }; | 128 }; |
136 | 129 |
137 // So we can compare AutoFillProfiles with EXPECT_EQ(). | 130 // So we can compare AutoFillProfiles with EXPECT_EQ(). |
138 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); | 131 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); |
139 | 132 |
140 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ | 133 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ |
OLD | NEW |