| 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 <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual void RemoveObserver(PersonalDataManagerObserver* observer); | 98 virtual void RemoveObserver(PersonalDataManagerObserver* observer); |
| 99 | 99 |
| 100 // Scans the given |form| for importable Autofill data. If the form includes | 100 // Scans the given |form| for importable Autofill data. If the form includes |
| 101 // sufficient address data for a new profile, it is immediately imported. If | 101 // sufficient address data for a new profile, it is immediately imported. If |
| 102 // the form includes sufficient credit card data for a new credit card, it is | 102 // the form includes sufficient credit card data for a new credit card, it is |
| 103 // stored into |imported_credit_card| so that we can prompt the user whether | 103 // stored into |imported_credit_card| so that we can prompt the user whether |
| 104 // to save this data. If the form contains credit card data already present in | 104 // to save this data. If the form contains credit card data already present in |
| 105 // a local credit card entry *and* |should_return_local_card| is true, the | 105 // a local credit card entry *and* |should_return_local_card| is true, the |
| 106 // data is stored into |imported_credit_card| so that we can prompt the user | 106 // data is stored into |imported_credit_card| so that we can prompt the user |
| 107 // whether to upload it. | 107 // whether to upload it. |
| 108 // Returns |true| if sufficient address or credit card data was found. | 108 // |imported_credit_card_matches_masked_server_credit_card| is set to |true| |
| 109 bool ImportFormData(const FormStructure& form, | 109 // if the |TypeAndLastFourDigits| in |imported_credit_card| matches the |
| 110 bool should_return_local_card, | 110 // |TypeAndLastFourDigits| in a saved masked server card. Returns |true| if |
| 111 std::unique_ptr<CreditCard>* imported_credit_card); | 111 // sufficient address or credit card data was found. |
| 112 bool ImportFormData( |
| 113 const FormStructure& form, |
| 114 bool should_return_local_card, |
| 115 std::unique_ptr<CreditCard>* imported_credit_card, |
| 116 bool* imported_credit_card_matches_masked_server_credit_card); |
| 112 | 117 |
| 113 // Called to indicate |data_model| was used (to fill in a form). Updates | 118 // Called to indicate |data_model| was used (to fill in a form). Updates |
| 114 // the database accordingly. Can invalidate |data_model|, particularly if | 119 // the database accordingly. Can invalidate |data_model|, particularly if |
| 115 // it's a Mac address book entry. | 120 // it's a Mac address book entry. |
| 116 virtual void RecordUseOf(const AutofillDataModel& data_model); | 121 virtual void RecordUseOf(const AutofillDataModel& data_model); |
| 117 | 122 |
| 118 // Saves |imported_profile| to the WebDB if it exists. Returns the guid of | 123 // Saves |imported_profile| to the WebDB if it exists. Returns the guid of |
| 119 // the new or updated profile, or the empty string if no profile was saved. | 124 // the new or updated profile, or the empty string if no profile was saved. |
| 120 virtual std::string SaveImportedProfile( | 125 virtual std::string SaveImportedProfile( |
| 121 const AutofillProfile& imported_profile); | 126 const AutofillProfile& imported_profile); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 bool ImportAddressProfiles(const FormStructure& form); | 473 bool ImportAddressProfiles(const FormStructure& form); |
| 469 | 474 |
| 470 // Helper method for ImportAddressProfiles which only considers the fields for | 475 // Helper method for ImportAddressProfiles which only considers the fields for |
| 471 // a specified |section|. | 476 // a specified |section|. |
| 472 bool ImportAddressProfileForSection(const FormStructure& form, | 477 bool ImportAddressProfileForSection(const FormStructure& form, |
| 473 const std::string& section); | 478 const std::string& section); |
| 474 | 479 |
| 475 // Go through the |form| fields and attempt to extract a new credit card in | 480 // Go through the |form| fields and attempt to extract a new credit card in |
| 476 // |imported_credit_card|, or update an existing card. | 481 // |imported_credit_card|, or update an existing card. |
| 477 // |should_return_local_card| will indicate whether |imported_credit_card| is | 482 // |should_return_local_card| will indicate whether |imported_credit_card| is |
| 478 // filled even if an existing card was updated. Success is defined as having a | 483 // filled even if an existing card was updated. |
| 484 // |imported_credit_card_matches_masked_server_credit_card| will indicate |
| 485 // whether |imported_credit_card| is filled even if an existing masked server |
| 486 // card as the same |TypeAndLastFourDigits|. Success is defined as having a |
| 479 // new card to import, or having merged with an existing card. | 487 // new card to import, or having merged with an existing card. |
| 480 bool ImportCreditCard(const FormStructure& form, | 488 bool ImportCreditCard( |
| 481 bool should_return_local_card, | 489 const FormStructure& form, |
| 482 std::unique_ptr<CreditCard>* imported_credit_card); | 490 bool should_return_local_card, |
| 491 std::unique_ptr<CreditCard>* imported_credit_card, |
| 492 bool* imported_credit_card_matches_masked_server_credit_card); |
| 483 | 493 |
| 484 // Functionally equivalent to GetProfiles(), but also records metrics if | 494 // Functionally equivalent to GetProfiles(), but also records metrics if |
| 485 // |record_metrics| is true. Metrics should be recorded when the returned | 495 // |record_metrics| is true. Metrics should be recorded when the returned |
| 486 // profiles will be used to populate the fields shown in an Autofill popup. | 496 // profiles will be used to populate the fields shown in an Autofill popup. |
| 487 virtual const std::vector<AutofillProfile*>& GetProfiles( | 497 virtual const std::vector<AutofillProfile*>& GetProfiles( |
| 488 bool record_metrics) const; | 498 bool record_metrics) const; |
| 489 | 499 |
| 490 // Returns credit card suggestions based on the |cards_to_suggest| and the | 500 // Returns credit card suggestions based on the |cards_to_suggest| and the |
| 491 // |type| and |field_contents| of the credit card field. | 501 // |type| and |field_contents| of the credit card field. |
| 492 std::vector<Suggestion> GetSuggestionsForCards( | 502 std::vector<Suggestion> GetSuggestionsForCards( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // The context for the request to be used to fetch libaddressinput's address | 614 // The context for the request to be used to fetch libaddressinput's address |
| 605 // validation rules. | 615 // validation rules. |
| 606 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 616 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| 607 | 617 |
| 608 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 618 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 609 }; | 619 }; |
| 610 | 620 |
| 611 } // namespace autofill | 621 } // namespace autofill |
| 612 | 622 |
| 613 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 623 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |