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_PERSONAL_DATA_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void AddCreditCard(const CreditCard& credit_card); | 102 void AddCreditCard(const CreditCard& credit_card); |
103 | 103 |
104 // Updates |credit_card| which already exists in the web database. | 104 // Updates |credit_card| which already exists in the web database. |
105 void UpdateCreditCard(const CreditCard& credit_card); | 105 void UpdateCreditCard(const CreditCard& credit_card); |
106 | 106 |
107 // Returns the credit card with the specified |guid|, or NULL if there is | 107 // Returns the credit card with the specified |guid|, or NULL if there is |
108 // no credit card with the specified |guid|. | 108 // no credit card with the specified |guid|. |
109 CreditCard* GetCreditCardByGUID(const std::string& guid); | 109 CreditCard* GetCreditCardByGUID(const std::string& guid); |
110 | 110 |
111 // Gets the field types availabe in the stored address and credit card data. | 111 // Gets the field types availabe in the stored address and credit card data. |
112 void GetNonEmptyTypes(FieldTypeSet* non_empty_types); | 112 void GetNonEmptyTypes(ServerFieldTypeSet* non_empty_types); |
113 | 113 |
114 // Returns true if the credit card information is stored with a password. | 114 // Returns true if the credit card information is stored with a password. |
115 bool HasPassword(); | 115 bool HasPassword(); |
116 | 116 |
117 // Returns whether the personal data has been loaded from the web database. | 117 // Returns whether the personal data has been loaded from the web database. |
118 virtual bool IsDataLoaded() const; | 118 virtual bool IsDataLoaded() const; |
119 | 119 |
120 // This PersonalDataManager owns these profiles and credit cards. Their | 120 // This PersonalDataManager owns these profiles and credit cards. Their |
121 // lifetime is until the web database is updated with new profile and credit | 121 // lifetime is until the web database is updated with new profile and credit |
122 // card information, respectively. |GetProfiles()| returns both web and | 122 // card information, respectively. |GetProfiles()| returns both web and |
123 // auxiliary profiles. |web_profiles()| returns only web profiles. | 123 // auxiliary profiles. |web_profiles()| returns only web profiles. |
124 virtual const std::vector<AutofillProfile*>& GetProfiles(); | 124 virtual const std::vector<AutofillProfile*>& GetProfiles(); |
125 virtual const std::vector<AutofillProfile*>& web_profiles() const; | 125 virtual const std::vector<AutofillProfile*>& web_profiles() const; |
126 virtual const std::vector<CreditCard*>& GetCreditCards() const; | 126 virtual const std::vector<CreditCard*>& GetCreditCards() const; |
127 | 127 |
128 // Loads profiles that can suggest data for |type|. |field_contents| is the | 128 // Loads profiles that can suggest data for |type|. |field_contents| is the |
129 // part the user has already typed. |field_is_autofilled| is true if the field | 129 // part the user has already typed. |field_is_autofilled| is true if the field |
130 // has already been autofilled. |other_field_types| represents the rest of | 130 // has already been autofilled. |other_field_types| represents the rest of |
131 // form. Identifying info is loaded into the last four outparams. | 131 // form. Identifying info is loaded into the last four outparams. |
132 void GetProfileSuggestions( | 132 void GetProfileSuggestions( |
133 AutofillFieldType type, | 133 const AutofillType& type, |
134 const base::string16& field_contents, | 134 const base::string16& field_contents, |
135 bool field_is_autofilled, | 135 bool field_is_autofilled, |
136 std::vector<AutofillFieldType> other_field_types, | 136 std::vector<ServerFieldType> other_field_types, |
137 std::vector<base::string16>* values, | 137 std::vector<base::string16>* values, |
138 std::vector<base::string16>* labels, | 138 std::vector<base::string16>* labels, |
139 std::vector<base::string16>* icons, | 139 std::vector<base::string16>* icons, |
140 std::vector<GUIDPair>* guid_pairs); | 140 std::vector<GUIDPair>* guid_pairs); |
141 | 141 |
142 // Gets credit cards that can suggest data for |type|. See | 142 // Gets credit cards that can suggest data for |type|. See |
143 // GetProfileSuggestions for argument descriptions. The variant in each | 143 // GetProfileSuggestions for argument descriptions. The variant in each |
144 // GUID pair should be ignored. | 144 // GUID pair should be ignored. |
145 void GetCreditCardSuggestions( | 145 void GetCreditCardSuggestions( |
146 AutofillFieldType type, | 146 const AutofillType& type, |
147 const base::string16& field_contents, | 147 const base::string16& field_contents, |
148 std::vector<base::string16>* values, | 148 std::vector<base::string16>* values, |
149 std::vector<base::string16>* labels, | 149 std::vector<base::string16>* labels, |
150 std::vector<base::string16>* icons, | 150 std::vector<base::string16>* icons, |
151 std::vector<GUIDPair>* guid_pairs); | 151 std::vector<GUIDPair>* guid_pairs); |
152 | 152 |
153 // Re-loads profiles and credit cards from the WebDatabase asynchronously. | 153 // Re-loads profiles and credit cards from the WebDatabase asynchronously. |
154 // In the general case, this is a no-op and will re-create the same | 154 // In the general case, this is a no-op and will re-create the same |
155 // in-memory model as existed prior to the call. If any change occurred to | 155 // in-memory model as existed prior to the call. If any change occurred to |
156 // profiles in the WebDatabase directly, as is the case if the browser sync | 156 // profiles in the WebDatabase directly, as is the case if the browser sync |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 // Whether we have already logged the number of profiles this session. | 283 // Whether we have already logged the number of profiles this session. |
284 mutable bool has_logged_profile_count_; | 284 mutable bool has_logged_profile_count_; |
285 | 285 |
286 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 286 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
287 }; | 287 }; |
288 | 288 |
289 } // namespace autofill | 289 } // namespace autofill |
290 | 290 |
291 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 291 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
OLD | NEW |