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> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "components/keyed_service/core/keyed_service.h" | 24 #include "components/keyed_service/core/keyed_service.h" |
25 #include "components/prefs/pref_member.h" | 25 #include "components/prefs/pref_member.h" |
26 #include "components/webdata/common/web_data_service_consumer.h" | 26 #include "components/webdata/common/web_data_service_consumer.h" |
27 | 27 |
28 class AccountTrackerService; | 28 class AccountTrackerService; |
29 class Browser; | 29 class Browser; |
30 class PrefService; | 30 class PrefService; |
31 class RemoveAutofillTester; | 31 class RemoveAutofillTester; |
32 class SigninManagerBase; | 32 class SigninManagerBase; |
33 | 33 |
| 34 namespace net { |
| 35 class URLFetcher; |
| 36 class URLRequestContextGetter; |
| 37 } |
| 38 |
34 namespace sync_driver { | 39 namespace sync_driver { |
35 class SyncService; | 40 class SyncService; |
36 } | 41 } |
37 | 42 |
38 namespace autofill { | 43 namespace autofill { |
39 class AutofillInteractiveTest; | 44 class AutofillInteractiveTest; |
40 class AutofillTest; | 45 class AutofillTest; |
41 class FormStructure; | 46 class FormStructure; |
42 class PersonalDataManagerObserver; | 47 class PersonalDataManagerObserver; |
43 class PersonalDataManagerFactory; | 48 class PersonalDataManagerFactory; |
(...skipping 10 matching lines...) Expand all Loading... |
54 extern const char kFrecencyFieldTrialStateEnabled[]; | 59 extern const char kFrecencyFieldTrialStateEnabled[]; |
55 extern const char kFrecencyFieldTrialLimitParam[]; | 60 extern const char kFrecencyFieldTrialLimitParam[]; |
56 | 61 |
57 // Handles loading and saving Autofill profile information to the web database. | 62 // 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 | 63 // This class also stores the profiles loaded from the database for use during |
59 // Autofill. | 64 // Autofill. |
60 class PersonalDataManager : public KeyedService, | 65 class PersonalDataManager : public KeyedService, |
61 public WebDataServiceConsumer, | 66 public WebDataServiceConsumer, |
62 public AutofillWebDataServiceObserverOnUIThread { | 67 public AutofillWebDataServiceObserverOnUIThread { |
63 public: | 68 public: |
64 explicit PersonalDataManager(const std::string& app_locale); | 69 explicit PersonalDataManager(const std::string& app_locale, |
| 70 net::URLRequestContextGetter* context_getter); |
65 ~PersonalDataManager() override; | 71 ~PersonalDataManager() override; |
66 | 72 |
67 // Kicks off asynchronous loading of profiles and credit cards. | 73 // Kicks off asynchronous loading of profiles and credit cards. |
68 // |pref_service| must outlive this instance. |is_off_the_record| informs | 74 // |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 | 75 // this instance whether the user is currently operating in an off-the-record |
70 // context. | 76 // context. |
71 void Init(scoped_refptr<AutofillWebDataService> database, | 77 void Init(scoped_refptr<AutofillWebDataService> database, |
72 PrefService* pref_service, | 78 PrefService* pref_service, |
73 AccountTrackerService* account_tracker, | 79 AccountTrackerService* account_tracker, |
74 SigninManagerBase* signin_manager, | 80 SigninManagerBase* signin_manager, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // local duplicates, and local cards are preferred over their masked server | 259 // local duplicates, and local cards are preferred over their masked server |
254 // card duplicate. | 260 // card duplicate. |
255 static void DedupeCreditCardToSuggest( | 261 static void DedupeCreditCardToSuggest( |
256 std::list<CreditCard*>* cards_to_suggest); | 262 std::list<CreditCard*>* cards_to_suggest); |
257 | 263 |
258 // Notifies test observers that personal data has changed. | 264 // Notifies test observers that personal data has changed. |
259 void NotifyPersonalDataChangedForTest() { | 265 void NotifyPersonalDataChangedForTest() { |
260 NotifyPersonalDataChanged(); | 266 NotifyPersonalDataChanged(); |
261 } | 267 } |
262 | 268 |
| 269 // Returns the class used to fetch the address validation rules. |
| 270 net::URLRequestContextGetter* GetURLRequestContextGetter() const { |
| 271 return context_getter_.get(); |
| 272 } |
| 273 |
263 protected: | 274 protected: |
264 // Only PersonalDataManagerFactory and certain tests can create instances of | 275 // Only PersonalDataManagerFactory and certain tests can create instances of |
265 // PersonalDataManager. | 276 // PersonalDataManager. |
266 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); | 277 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); |
267 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); | 278 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); |
268 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, | 279 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
269 DedupeProfiles_ProfilesToDelete); | 280 DedupeProfiles_ProfilesToDelete); |
270 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, ApplyProfileUseDatesFix); | 281 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, ApplyProfileUseDatesFix); |
271 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, | 282 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
272 ApplyProfileUseDatesFix_NotAppliedTwice); | 283 ApplyProfileUseDatesFix_NotAppliedTwice); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 // An observer to listen for changes to prefs::kAutofillEnabled. | 497 // An observer to listen for changes to prefs::kAutofillEnabled. |
487 std::unique_ptr<BooleanPrefMember> enabled_pref_; | 498 std::unique_ptr<BooleanPrefMember> enabled_pref_; |
488 | 499 |
489 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. | 500 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. |
490 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_; | 501 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_; |
491 | 502 |
492 // Set to true if autofill profile deduplication is enabled and needs to be | 503 // Set to true if autofill profile deduplication is enabled and needs to be |
493 // performed on the next data refresh. | 504 // performed on the next data refresh. |
494 bool is_autofill_profile_dedupe_pending_ = false; | 505 bool is_autofill_profile_dedupe_pending_ = false; |
495 | 506 |
| 507 // The context for the request to be used to fetch libaddressinput's address |
| 508 // validation rules. |
| 509 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| 510 |
496 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 511 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
497 }; | 512 }; |
498 | 513 |
499 } // namespace autofill | 514 } // namespace autofill |
500 | 515 |
501 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 516 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
OLD | NEW |