| 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 <memory> | 9 #include <memory> |
| 9 #include <set> | 10 #include <set> |
| 11 #include <string> |
| 12 #include <unordered_set> |
| 10 #include <vector> | 13 #include <vector> |
| 11 | 14 |
| 12 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 16 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 15 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 16 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| 17 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 18 #include "components/autofill/core/browser/autofill_profile.h" | 21 #include "components/autofill/core/browser/autofill_profile.h" |
| 19 #include "components/autofill/core/browser/credit_card.h" | 22 #include "components/autofill/core/browser/credit_card.h" |
| 20 #include "components/autofill/core/browser/field_types.h" | 23 #include "components/autofill/core/browser/field_types.h" |
| 21 #include "components/autofill/core/browser/suggestion.h" | 24 #include "components/autofill/core/browser/suggestion.h" |
| 22 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 25 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 23 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" | 26 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" |
| 24 #include "components/keyed_service/core/keyed_service.h" | 27 #include "components/keyed_service/core/keyed_service.h" |
| 25 #include "components/prefs/pref_member.h" | 28 #include "components/prefs/pref_member.h" |
| 26 #include "components/webdata/common/web_data_service_consumer.h" | 29 #include "components/webdata/common/web_data_service_consumer.h" |
| 27 | 30 |
| 28 class AccountTrackerService; | 31 class AccountTrackerService; |
| 29 class Browser; | 32 class Browser; |
| 30 class PrefService; | 33 class PrefService; |
| 31 class RemoveAutofillTester; | 34 class RemoveAutofillTester; |
| 32 class SigninManagerBase; | 35 class SigninManagerBase; |
| 33 | 36 |
| 34 namespace sync_driver { | |
| 35 class SyncService; | |
| 36 } | |
| 37 | |
| 38 namespace autofill { | 37 namespace autofill { |
| 39 class AutofillInteractiveTest; | 38 class AutofillInteractiveTest; |
| 40 class AutofillTest; | 39 class AutofillTest; |
| 41 class FormStructure; | 40 class FormStructure; |
| 42 class PersonalDataManagerObserver; | 41 class PersonalDataManagerObserver; |
| 43 class PersonalDataManagerFactory; | 42 class PersonalDataManagerFactory; |
| 44 } // namespace autofill | 43 } // namespace autofill |
| 45 | 44 |
| 46 namespace autofill_helper { | 45 namespace autofill_helper { |
| 47 void SetProfiles(int, std::vector<autofill::AutofillProfile>*); | 46 void SetProfiles(int, std::vector<autofill::AutofillProfile>*); |
| 48 void SetCreditCards(int, std::vector<autofill::CreditCard>*); | 47 void SetCreditCards(int, std::vector<autofill::CreditCard>*); |
| 49 } // namespace autofill_helper | 48 } // namespace autofill_helper |
| 50 | 49 |
| 50 namespace syncer { |
| 51 class SyncService; |
| 52 } // namespace syncer |
| 53 |
| 51 namespace autofill { | 54 namespace autofill { |
| 52 | 55 |
| 53 extern const char kFrecencyFieldTrialName[]; | 56 extern const char kFrecencyFieldTrialName[]; |
| 54 extern const char kFrecencyFieldTrialStateEnabled[]; | 57 extern const char kFrecencyFieldTrialStateEnabled[]; |
| 55 extern const char kFrecencyFieldTrialLimitParam[]; | 58 extern const char kFrecencyFieldTrialLimitParam[]; |
| 56 | 59 |
| 57 // Handles loading and saving Autofill profile information to the web database. | 60 // Handles loading and saving Autofill profile information to the web database. |
| 58 // This class also stores the profiles loaded from the database for use during | 61 // This class also stores the profiles loaded from the database for use during |
| 59 // Autofill. | 62 // Autofill. |
| 60 class PersonalDataManager : public KeyedService, | 63 class PersonalDataManager : public KeyedService, |
| 61 public WebDataServiceConsumer, | 64 public WebDataServiceConsumer, |
| 62 public AutofillWebDataServiceObserverOnUIThread { | 65 public AutofillWebDataServiceObserverOnUIThread { |
| 63 public: | 66 public: |
| 64 explicit PersonalDataManager(const std::string& app_locale); | 67 explicit PersonalDataManager(const std::string& app_locale); |
| 65 ~PersonalDataManager() override; | 68 ~PersonalDataManager() override; |
| 66 | 69 |
| 67 // Kicks off asynchronous loading of profiles and credit cards. | 70 // Kicks off asynchronous loading of profiles and credit cards. |
| 68 // |pref_service| must outlive this instance. |is_off_the_record| informs | 71 // |pref_service| must outlive this instance. |is_off_the_record| informs |
| 69 // this instance whether the user is currently operating in an off-the-record | 72 // this instance whether the user is currently operating in an off-the-record |
| 70 // context. | 73 // context. |
| 71 void Init(scoped_refptr<AutofillWebDataService> database, | 74 void Init(scoped_refptr<AutofillWebDataService> database, |
| 72 PrefService* pref_service, | 75 PrefService* pref_service, |
| 73 AccountTrackerService* account_tracker, | 76 AccountTrackerService* account_tracker, |
| 74 SigninManagerBase* signin_manager, | 77 SigninManagerBase* signin_manager, |
| 75 bool is_off_the_record); | 78 bool is_off_the_record); |
| 76 | 79 |
| 77 // Called once the sync service is known to be instantiated. Note that it may | 80 // Called once the sync service is known to be instantiated. Note that it may |
| 78 // not be started, but it's preferences can be queried. | 81 // not be started, but it's preferences can be queried. |
| 79 void OnSyncServiceInitialized(sync_driver::SyncService* sync_service); | 82 void OnSyncServiceInitialized(syncer::SyncService* sync_service); |
| 80 | 83 |
| 81 // WebDataServiceConsumer: | 84 // WebDataServiceConsumer: |
| 82 void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h, | 85 void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h, |
| 83 const WDTypedResult* result) override; | 86 const WDTypedResult* result) override; |
| 84 | 87 |
| 85 // AutofillWebDataServiceObserverOnUIThread: | 88 // AutofillWebDataServiceObserverOnUIThread: |
| 86 void AutofillMultipleChanged() override; | 89 void AutofillMultipleChanged() override; |
| 87 void SyncStarted(syncer::ModelType model_type) override; | 90 void SyncStarted(syncer::ModelType model_type) override; |
| 88 | 91 |
| 89 // Adds a listener to be notified of PersonalDataManager events. | 92 // Adds a listener to be notified of PersonalDataManager events. |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // Set to true if autofill profile deduplication is enabled and needs to be | 495 // Set to true if autofill profile deduplication is enabled and needs to be |
| 493 // performed on the next data refresh. | 496 // performed on the next data refresh. |
| 494 bool is_autofill_profile_dedupe_pending_ = false; | 497 bool is_autofill_profile_dedupe_pending_ = false; |
| 495 | 498 |
| 496 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 499 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 497 }; | 500 }; |
| 498 | 501 |
| 499 } // namespace autofill | 502 } // namespace autofill |
| 500 | 503 |
| 501 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 504 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |