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