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 <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
16 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
17 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
18 #include "build/build_config.h" | 17 #include "build/build_config.h" |
19 #include "components/autofill/core/browser/autofill_profile.h" | 18 #include "components/autofill/core/browser/autofill_profile.h" |
20 #include "components/autofill/core/browser/credit_card.h" | 19 #include "components/autofill/core/browser/credit_card.h" |
21 #include "components/autofill/core/browser/field_types.h" | 20 #include "components/autofill/core/browser/field_types.h" |
22 #include "components/autofill/core/browser/suggestion.h" | 21 #include "components/autofill/core/browser/suggestion.h" |
23 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 22 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
24 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" | 23 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // sufficient address data for a new profile, it is immediately imported. If | 92 // sufficient address data for a new profile, it is immediately imported. If |
94 // the form includes sufficient credit card data for a new credit card, it is | 93 // the form includes sufficient credit card data for a new credit card, it is |
95 // stored into |imported_credit_card| so that we can prompt the user whether | 94 // stored into |imported_credit_card| so that we can prompt the user whether |
96 // to save this data. If the form contains credit card data already present in | 95 // to save this data. If the form contains credit card data already present in |
97 // a local credit card entry *and* |should_return_local_card| is true, the | 96 // a local credit card entry *and* |should_return_local_card| is true, the |
98 // data is stored into |imported_credit_card| so that we can prompt the user | 97 // data is stored into |imported_credit_card| so that we can prompt the user |
99 // whether to upload it. | 98 // whether to upload it. |
100 // Returns |true| if sufficient address or credit card data was found. | 99 // Returns |true| if sufficient address or credit card data was found. |
101 bool ImportFormData(const FormStructure& form, | 100 bool ImportFormData(const FormStructure& form, |
102 bool should_return_local_card, | 101 bool should_return_local_card, |
103 scoped_ptr<CreditCard>* imported_credit_card); | 102 std::unique_ptr<CreditCard>* imported_credit_card); |
104 | 103 |
105 // Called to indicate |data_model| was used (to fill in a form). Updates | 104 // Called to indicate |data_model| was used (to fill in a form). Updates |
106 // the database accordingly. Can invalidate |data_model|, particularly if | 105 // the database accordingly. Can invalidate |data_model|, particularly if |
107 // it's a Mac address book entry. | 106 // it's a Mac address book entry. |
108 virtual void RecordUseOf(const AutofillDataModel& data_model); | 107 virtual void RecordUseOf(const AutofillDataModel& data_model); |
109 | 108 |
110 // Saves |imported_profile| to the WebDB if it exists. Returns the guid of | 109 // Saves |imported_profile| to the WebDB if it exists. Returns the guid of |
111 // the new or updated profile, or the empty string if no profile was saved. | 110 // the new or updated profile, or the empty string if no profile was saved. |
112 virtual std::string SaveImportedProfile( | 111 virtual std::string SaveImportedProfile( |
113 const AutofillProfile& imported_profile); | 112 const AutofillProfile& imported_profile); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 bool ImportAddressProfileForSection(const FormStructure& form, | 375 bool ImportAddressProfileForSection(const FormStructure& form, |
377 const std::string& section); | 376 const std::string& section); |
378 | 377 |
379 // Go through the |form| fields and attempt to extract a new credit card in | 378 // Go through the |form| fields and attempt to extract a new credit card in |
380 // |imported_credit_card|, or update an existing card. | 379 // |imported_credit_card|, or update an existing card. |
381 // |should_return_local_card| will indicate whether |imported_credit_card| is | 380 // |should_return_local_card| will indicate whether |imported_credit_card| is |
382 // filled even if an existing card was updated. Success is defined as having a | 381 // filled even if an existing card was updated. Success is defined as having a |
383 // new card to import, or having merged with an existing card. | 382 // new card to import, or having merged with an existing card. |
384 bool ImportCreditCard(const FormStructure& form, | 383 bool ImportCreditCard(const FormStructure& form, |
385 bool should_return_local_card, | 384 bool should_return_local_card, |
386 scoped_ptr<CreditCard>* imported_credit_card); | 385 std::unique_ptr<CreditCard>* imported_credit_card); |
387 | 386 |
388 // Functionally equivalent to GetProfiles(), but also records metrics if | 387 // Functionally equivalent to GetProfiles(), but also records metrics if |
389 // |record_metrics| is true. Metrics should be recorded when the returned | 388 // |record_metrics| is true. Metrics should be recorded when the returned |
390 // profiles will be used to populate the fields shown in an Autofill popup. | 389 // profiles will be used to populate the fields shown in an Autofill popup. |
391 const std::vector<AutofillProfile*>& GetProfiles( | 390 const std::vector<AutofillProfile*>& GetProfiles( |
392 bool record_metrics) const; | 391 bool record_metrics) const; |
393 | 392 |
394 const std::string app_locale_; | 393 const std::string app_locale_; |
395 | 394 |
396 // The default country code for new addresses. | 395 // The default country code for new addresses. |
(...skipping 14 matching lines...) Expand all Loading... |
411 bool is_off_the_record_; | 410 bool is_off_the_record_; |
412 | 411 |
413 // Whether we have already logged the number of profiles this session. | 412 // Whether we have already logged the number of profiles this session. |
414 mutable bool has_logged_profile_count_; | 413 mutable bool has_logged_profile_count_; |
415 | 414 |
416 // Whether we have already logged the number of local credit cards this | 415 // Whether we have already logged the number of local credit cards this |
417 // session. | 416 // session. |
418 mutable bool has_logged_credit_card_count_; | 417 mutable bool has_logged_credit_card_count_; |
419 | 418 |
420 // An observer to listen for changes to prefs::kAutofillEnabled. | 419 // An observer to listen for changes to prefs::kAutofillEnabled. |
421 scoped_ptr<BooleanPrefMember> enabled_pref_; | 420 std::unique_ptr<BooleanPrefMember> enabled_pref_; |
422 | 421 |
423 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. | 422 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. |
424 scoped_ptr<BooleanPrefMember> wallet_enabled_pref_; | 423 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_; |
425 | 424 |
426 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 425 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
427 }; | 426 }; |
428 | 427 |
429 } // namespace autofill | 428 } // namespace autofill |
430 | 429 |
431 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 430 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
OLD | NEW |