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 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 <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "chrome/browser/autofill/form_group.h" | 14 #include "chrome/browser/autofill/form_group.h" |
15 | 15 |
16 class Address; | |
17 typedef std::map<FieldTypeGroup, FormGroup*> FormGroupMap; | 16 typedef std::map<FieldTypeGroup, FormGroup*> FormGroupMap; |
18 | 17 |
19 // A collection of FormGroups stored in a profile. AutoFillProfile also | 18 // A collection of FormGroups stored in a profile. AutoFillProfile also |
20 // implements the FormGroup interface so that owners of this object can request | 19 // implements the FormGroup interface so that owners of this object can request |
21 // form information from the profile, and the profile will delegate the request | 20 // form information from the profile, and the profile will delegate the request |
22 // to the requested form group type. | 21 // to the requested form group type. |
23 class AutoFillProfile : public FormGroup { | 22 class AutoFillProfile : public FormGroup { |
24 public: | 23 public: |
25 explicit AutoFillProfile(const std::string& guid); | 24 explicit AutoFillProfile(const std::string& guid); |
26 | 25 |
(...skipping 13 matching lines...) Expand all Loading... | |
40 virtual void FindInfoMatches(const AutoFillType& type, | 39 virtual void FindInfoMatches(const AutoFillType& type, |
41 const string16& info, | 40 const string16& info, |
42 std::vector<string16>* matched_text) const; | 41 std::vector<string16>* matched_text) const; |
43 virtual void SetInfo(const AutoFillType& type, const string16& value); | 42 virtual void SetInfo(const AutoFillType& type, const string16& value); |
44 // Returns a copy of the profile it is called on. The caller is responsible | 43 // Returns a copy of the profile it is called on. The caller is responsible |
45 // for deleting profile when they are done with it. | 44 // for deleting profile when they are done with it. |
46 virtual FormGroup* Clone() const; | 45 virtual FormGroup* Clone() const; |
47 // The user-visible label of the profile, generated in relation to other | 46 // The user-visible label of the profile, generated in relation to other |
48 // profiles. Shows at least 2 fields that differentiate profile from other | 47 // profiles. Shows at least 2 fields that differentiate profile from other |
49 // profiles. See AdjustInferredLabels() further down for more description. | 48 // profiles. See AdjustInferredLabels() further down for more description. |
50 virtual const string16 Label() const; | 49 virtual string16 Label() const; |
dhollowa
2011/02/17 00:55:28
Please put the |const| designation back. See item
Ilya Sherman
2011/02/17 23:09:11
Done.
| |
51 | 50 |
52 // This guid is the primary identifier for |AutoFillProfile| objects. | 51 // This guid is the primary identifier for |AutoFillProfile| objects. |
53 const std::string guid() const { return guid_; } | 52 const std::string guid() const { return guid_; } |
54 void set_guid(const std::string& guid) { guid_ = guid; } | 53 void set_guid(const std::string& guid) { guid_ = guid; } |
55 | 54 |
55 // Accessors for the stored address's country code. | |
56 std::string CountryCode() const; | |
dhollowa
2011/02/17 00:55:28
const std::string CountryCode() const;
Ilya Sherman
2011/02/17 23:09:11
Done.
| |
57 void SetCountryCode(const std::string& country_code); | |
58 | |
56 // Adjusts the labels according to profile data. | 59 // Adjusts the labels according to profile data. |
57 // Labels contain minimal different combination of: | 60 // Labels contain minimal different combination of: |
58 // 1. Full name. | 61 // 1. Full name. |
59 // 2. Address. | 62 // 2. Address. |
60 // 3. E-mail. | 63 // 3. E-mail. |
61 // 4. Phone. | 64 // 4. Phone. |
62 // 5. Fax. | 65 // 5. Fax. |
63 // 6. Company name. | 66 // 6. Company name. |
64 // Profile labels are changed accordingly to these rules. | 67 // Profile labels are changed accordingly to these rules. |
65 // Returns true if any of the profiles were updated. | 68 // Returns true if any of the profiles were updated. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 std::string guid_; | 140 std::string guid_; |
138 | 141 |
139 // Personal information for this profile. | 142 // Personal information for this profile. |
140 FormGroupMap personal_info_; | 143 FormGroupMap personal_info_; |
141 }; | 144 }; |
142 | 145 |
143 // So we can compare AutoFillProfiles with EXPECT_EQ(). | 146 // So we can compare AutoFillProfiles with EXPECT_EQ(). |
144 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); | 147 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); |
145 | 148 |
146 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ | 149 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ |
OLD | NEW |