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_PERSONAL_DATA_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // AutoFillDialogObserver implementation: | 49 // AutoFillDialogObserver implementation: |
50 virtual void OnAutoFillDialogApply(std::vector<AutoFillProfile>* profiles, | 50 virtual void OnAutoFillDialogApply(std::vector<AutoFillProfile>* profiles, |
51 std::vector<CreditCard>* credit_cards); | 51 std::vector<CreditCard>* credit_cards); |
52 | 52 |
53 // Sets the listener to be notified of PersonalDataManager events. | 53 // Sets the listener to be notified of PersonalDataManager events. |
54 virtual void SetObserver(PersonalDataManager::Observer* observer); | 54 virtual void SetObserver(PersonalDataManager::Observer* observer); |
55 | 55 |
56 // Removes |observer| as the observer of this PersonalDataManager. | 56 // Removes |observer| as the observer of this PersonalDataManager. |
57 virtual void RemoveObserver(PersonalDataManager::Observer* observer); | 57 virtual void RemoveObserver(PersonalDataManager::Observer* observer); |
58 | 58 |
59 // If AutoFill is able to determine the field types of a significant number | 59 // If AutoFill is able to determine the field types of a significant number of |
60 // of field types that contain information in the FormStructures and the user | 60 // field types that contain information in the FormStructures a profile will |
61 // has not previously been prompted, the user will be asked if he would like | 61 // be created with all of the information from recognized fields. Returns |
62 // to import the data. If the user selects yes, a profile will be created | 62 // whether a profile was created. |
63 // with all of the information from recognized fields. | |
64 bool ImportFormData(const std::vector<FormStructure*>& form_structures, | 63 bool ImportFormData(const std::vector<FormStructure*>& form_structures, |
65 AutoFillManager* autofill_manager); | 64 AutoFillManager* autofill_manager); |
66 | 65 |
67 // Gets |imported_profile_| and |imported_credit_card_| and returns their | 66 // Gets |imported_profile_| and |imported_credit_card_| and returns their |
68 // values in |profile| and |credit_card| parameters respectively. One or | 67 // values in |profile| and |credit_card| parameters respectively. One or |
69 // both may return NULL. The objects returned are owned by the | 68 // both may return NULL. The objects returned are owned by the |
70 // PersonalDataManager, so should be considered weak references by caller. | 69 // PersonalDataManager, so should be considered weak references by caller. |
71 // TODO(dhollowa) Now that we aren't immediately saving the imported form | 70 // TODO(dhollowa) Now that we aren't immediately saving the imported form |
72 // data, we should store the profile and CC in the AFM instead of the PDM. | 71 // data, we should store the profile and CC in the AFM instead of the PDM. |
73 void GetImportedFormData(AutoFillProfile** profile, CreditCard** credit_card); | 72 void GetImportedFormData(AutoFillProfile** profile, CreditCard** credit_card); |
74 | 73 |
| 74 // Saves a credit card value detected in |ImportedFormData|. |
| 75 void SaveImportedCreditCard(); |
| 76 |
75 // Sets |web_profiles_| to the contents of |profiles| and updates the web | 77 // Sets |web_profiles_| to the contents of |profiles| and updates the web |
76 // database by adding, updating and removing profiles. Sets the unique ID of | 78 // database by adding, updating and removing profiles. Sets the unique ID of |
77 // newly-added profiles. | 79 // newly-added profiles. |
78 // | 80 // |
79 // The relationship between this and Refresh is subtle. | 81 // The relationship between this and Refresh is subtle. |
80 // A call to SetProfile could include out-of-date data that may conflict | 82 // A call to SetProfile could include out-of-date data that may conflict |
81 // if we didn't refresh-to-latest before an AutoFill window was opened for | 83 // if we didn't refresh-to-latest before an AutoFill window was opened for |
82 // editing. SetProfile is implemented to make a "best effort" to apply the | 84 // editing. SetProfile is implemented to make a "best effort" to apply the |
83 // changes, but in extremely rare edge cases it is possible not all of the | 85 // changes, but in extremely rare edge cases it is possible not all of the |
84 // updates in |profiles| make it to the DB. This is why SetProfiles will | 86 // updates in |profiles| make it to the DB. This is why SetProfiles will |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void CancelPendingQuery(WebDataService::Handle* handle); | 184 void CancelPendingQuery(WebDataService::Handle* handle); |
183 | 185 |
184 // Ensures that all profile labels are unique by appending an increasing digit | 186 // Ensures that all profile labels are unique by appending an increasing digit |
185 // to the end of non-unique labels. | 187 // to the end of non-unique labels. |
186 // TODO(jhawkins): Create a new interface for labeled entities and turn these | 188 // TODO(jhawkins): Create a new interface for labeled entities and turn these |
187 // two methods into one. | 189 // two methods into one. |
188 void SetUniqueProfileLabels(std::vector<AutoFillProfile>* profiles); | 190 void SetUniqueProfileLabels(std::vector<AutoFillProfile>* profiles); |
189 void SetUniqueCreditCardLabels(std::vector<CreditCard>* credit_cards); | 191 void SetUniqueCreditCardLabels(std::vector<CreditCard>* credit_cards); |
190 | 192 |
191 // Saves |imported_profile_| to the WebDB if it exists. | 193 // Saves |imported_profile_| to the WebDB if it exists. |
192 // TODO(jhawkins): SaveImportedCreditCard. | |
193 void SaveImportedProfile(); | 194 void SaveImportedProfile(); |
194 | 195 |
195 // The profile hosting this PersonalDataManager. | 196 // The profile hosting this PersonalDataManager. |
196 Profile* profile_; | 197 Profile* profile_; |
197 | 198 |
198 // True if personal data has been loaded from the web database. | 199 // True if personal data has been loaded from the web database. |
199 bool is_data_loaded_; | 200 bool is_data_loaded_; |
200 | 201 |
201 // The set of already created unique profile IDs, used to create a new unique | 202 // The set of already created unique profile IDs, used to create a new unique |
202 // profile ID. | 203 // profile ID. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 WebDataService::Handle pending_profiles_query_; | 240 WebDataService::Handle pending_profiles_query_; |
240 WebDataService::Handle pending_creditcards_query_; | 241 WebDataService::Handle pending_creditcards_query_; |
241 | 242 |
242 // The observers. This can be empty. | 243 // The observers. This can be empty. |
243 std::vector<PersonalDataManager::Observer*> observers_; | 244 std::vector<PersonalDataManager::Observer*> observers_; |
244 | 245 |
245 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 246 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
246 }; | 247 }; |
247 | 248 |
248 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ | 249 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
OLD | NEW |