| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 virtual void RemoveObserver(PersonalDataManagerObserver* observer); | 72 virtual void RemoveObserver(PersonalDataManagerObserver* observer); |
| 73 | 73 |
| 74 // Scans the given |form| for importable Autofill data. If the form includes | 74 // Scans the given |form| for importable Autofill data. If the form includes |
| 75 // sufficient address data, it is immediately imported. If the form includes | 75 // sufficient address data, it is immediately imported. If the form includes |
| 76 // sufficient credit card data, it is stored into |credit_card|, so that we | 76 // sufficient credit card data, it is stored into |credit_card|, so that we |
| 77 // can prompt the user whether to save this data. | 77 // can prompt the user whether to save this data. |
| 78 // Returns |true| if sufficient address or credit card data was found. | 78 // Returns |true| if sufficient address or credit card data was found. |
| 79 bool ImportFormData(const FormStructure& form, | 79 bool ImportFormData(const FormStructure& form, |
| 80 const CreditCard** credit_card); | 80 const CreditCard** credit_card); |
| 81 | 81 |
| 82 // Saves |imported_profile| to the WebDB if it exists. | 82 // Saves |imported_profile| to the WebDB if it exists. Returns the guid of |
| 83 virtual void SaveImportedProfile(const AutofillProfile& imported_profile); | 83 // the new or updated profile, or the empty string if no profile was saved. |
| 84 virtual std::string SaveImportedProfile( |
| 85 const AutofillProfile& imported_profile); |
| 84 | 86 |
| 85 // Saves a credit card value detected in |ImportedFormData|. | 87 // Saves a credit card value detected in |ImportedFormData|. Returns the guid |
| 86 virtual void SaveImportedCreditCard(const CreditCard& imported_credit_card); | 88 // of the new or updated card, or the empty string if no card was saved. |
| 89 virtual std::string SaveImportedCreditCard( |
| 90 const CreditCard& imported_credit_card); |
| 87 | 91 |
| 88 // Adds |profile| to the web database. | 92 // Adds |profile| to the web database. |
| 89 void AddProfile(const AutofillProfile& profile); | 93 void AddProfile(const AutofillProfile& profile); |
| 90 | 94 |
| 91 // Updates |profile| which already exists in the web database. | 95 // Updates |profile| which already exists in the web database. |
| 92 void UpdateProfile(const AutofillProfile& profile); | 96 void UpdateProfile(const AutofillProfile& profile); |
| 93 | 97 |
| 94 // Removes the profile or credit card represented by |guid|. | 98 // Removes the profile or credit card represented by |guid|. |
| 95 virtual void RemoveByGUID(const std::string& guid); | 99 virtual void RemoveByGUID(const std::string& guid); |
| 96 | 100 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 virtual void Refresh(); | 166 virtual void Refresh(); |
| 163 | 167 |
| 164 const std::string& app_locale() const { return app_locale_; } | 168 const std::string& app_locale() const { return app_locale_; } |
| 165 | 169 |
| 166 // Checks suitability of |profile| for adding to the user's set of profiles. | 170 // Checks suitability of |profile| for adding to the user's set of profiles. |
| 167 static bool IsValidLearnableProfile(const AutofillProfile& profile, | 171 static bool IsValidLearnableProfile(const AutofillProfile& profile, |
| 168 const std::string& app_locale); | 172 const std::string& app_locale); |
| 169 | 173 |
| 170 // Merges |new_profile| into one of the |existing_profiles| if possible; | 174 // Merges |new_profile| into one of the |existing_profiles| if possible; |
| 171 // otherwise appends |new_profile| to the end of that list. Fills | 175 // otherwise appends |new_profile| to the end of that list. Fills |
| 172 // |merged_profiles| with the result. | 176 // |merged_profiles| with the result. Returns the |guid| of the new or updated |
| 173 static bool MergeProfile( | 177 // profile. |
| 178 static std::string MergeProfile( |
| 174 const AutofillProfile& new_profile, | 179 const AutofillProfile& new_profile, |
| 175 const std::vector<AutofillProfile*>& existing_profiles, | 180 const std::vector<AutofillProfile*>& existing_profiles, |
| 176 const std::string& app_locale, | 181 const std::string& app_locale, |
| 177 std::vector<AutofillProfile>* merged_profiles); | 182 std::vector<AutofillProfile>* merged_profiles); |
| 178 | 183 |
| 179 protected: | 184 protected: |
| 180 // Only PersonalDataManagerFactory and certain tests can create instances of | 185 // Only PersonalDataManagerFactory and certain tests can create instances of |
| 181 // PersonalDataManager. | 186 // PersonalDataManager. |
| 182 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); | 187 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); |
| 183 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); | 188 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 289 |
| 285 // Whether we have already logged the number of profiles this session. | 290 // Whether we have already logged the number of profiles this session. |
| 286 mutable bool has_logged_profile_count_; | 291 mutable bool has_logged_profile_count_; |
| 287 | 292 |
| 288 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 293 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 289 }; | 294 }; |
| 290 | 295 |
| 291 } // namespace autofill | 296 } // namespace autofill |
| 292 | 297 |
| 293 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 298 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |