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> |
11 #include <string> | 11 #include <string> |
12 #include <unordered_map> | 12 #include <unordered_map> |
13 #include <unordered_set> | 13 #include <unordered_set> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "components/autofill/core/browser/autofill_profile.h" | 21 #include "components/autofill/core/browser/autofill_profile.h" |
22 #include "components/autofill/core/browser/credit_card.h" | 22 #include "components/autofill/core/browser/credit_card.h" |
23 #include "components/autofill/core/browser/field_types.h" | 23 #include "components/autofill/core/browser/field_types.h" |
24 #include "components/autofill/core/browser/suggestion.h" | 24 #include "components/autofill/core/browser/suggestion.h" |
25 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 25 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
26 #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" |
27 #include "components/keyed_service/core/keyed_service.h" | 27 #include "components/keyed_service/core/keyed_service.h" |
28 #include "components/prefs/pref_member.h" | 28 #include "components/prefs/pref_member.h" |
29 #include "components/webdata/common/web_data_service_consumer.h" | 29 #include "components/webdata/common/web_data_service_consumer.h" |
30 #if defined(OS_ANDROID) | |
31 #include "net/url_request/url_request_context_getter.h" | 30 #include "net/url_request/url_request_context_getter.h" |
32 #endif | |
33 | 31 |
34 class AccountTrackerService; | 32 class AccountTrackerService; |
35 class Browser; | 33 class Browser; |
36 class PrefService; | 34 class PrefService; |
37 class RemoveAutofillTester; | 35 class RemoveAutofillTester; |
38 class SigninManagerBase; | 36 class SigninManagerBase; |
39 | 37 |
40 namespace autofill { | 38 namespace autofill { |
41 class AutofillInteractiveTest; | 39 class AutofillInteractiveTest; |
42 class AutofillTest; | 40 class AutofillTest; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // local duplicates, and local cards are preferred over their masked server | 265 // local duplicates, and local cards are preferred over their masked server |
268 // card duplicate. | 266 // card duplicate. |
269 static void DedupeCreditCardToSuggest( | 267 static void DedupeCreditCardToSuggest( |
270 std::list<CreditCard*>* cards_to_suggest); | 268 std::list<CreditCard*>* cards_to_suggest); |
271 | 269 |
272 // Notifies test observers that personal data has changed. | 270 // Notifies test observers that personal data has changed. |
273 void NotifyPersonalDataChangedForTest() { | 271 void NotifyPersonalDataChangedForTest() { |
274 NotifyPersonalDataChanged(); | 272 NotifyPersonalDataChanged(); |
275 } | 273 } |
276 | 274 |
277 #if defined(OS_ANDROID) | |
278 // Sets the URL request context getter to be used when normalizing addresses | 275 // Sets the URL request context getter to be used when normalizing addresses |
279 // with libaddressinput's address validator. | 276 // with libaddressinput's address validator. |
280 void SetURLRequestContextGetter( | 277 void SetURLRequestContextGetter( |
281 net::URLRequestContextGetter* context_getter) { | 278 net::URLRequestContextGetter* context_getter) { |
282 context_getter_ = context_getter; | 279 context_getter_ = context_getter; |
283 } | 280 } |
284 | 281 |
285 // Returns the class used to fetch the address validation rules. | 282 // Returns the class used to fetch the address validation rules. |
286 net::URLRequestContextGetter* GetURLRequestContextGetter() const { | 283 net::URLRequestContextGetter* GetURLRequestContextGetter() const { |
287 return context_getter_.get(); | 284 return context_getter_.get(); |
288 } | 285 } |
289 #endif | |
290 | 286 |
291 protected: | 287 protected: |
292 // Only PersonalDataManagerFactory and certain tests can create instances of | 288 // Only PersonalDataManagerFactory and certain tests can create instances of |
293 // PersonalDataManager. | 289 // PersonalDataManager. |
294 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); | 290 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); |
295 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); | 291 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); |
296 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, | 292 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
297 DedupeProfiles_ProfilesToDelete); | 293 DedupeProfiles_ProfilesToDelete); |
298 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, | 294 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
299 DedupeProfiles_GuidsMergeMap); | 295 DedupeProfiles_GuidsMergeMap); |
(...skipping 23 matching lines...) Expand all Loading... |
323 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, | 319 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
324 ApplyDedupingRoutine_MultipleDedupes); | 320 ApplyDedupingRoutine_MultipleDedupes); |
325 FRIEND_TEST_ALL_PREFIXES( | 321 FRIEND_TEST_ALL_PREFIXES( |
326 PersonalDataManagerTest, | 322 PersonalDataManagerTest, |
327 ConvertWalletAddressesAndUpdateWalletCards_NewProfile); | 323 ConvertWalletAddressesAndUpdateWalletCards_NewProfile); |
328 FRIEND_TEST_ALL_PREFIXES( | 324 FRIEND_TEST_ALL_PREFIXES( |
329 PersonalDataManagerTest, | 325 PersonalDataManagerTest, |
330 ConvertWalletAddressesAndUpdateWalletCards_MergedProfile); | 326 ConvertWalletAddressesAndUpdateWalletCards_MergedProfile); |
331 FRIEND_TEST_ALL_PREFIXES( | 327 FRIEND_TEST_ALL_PREFIXES( |
332 PersonalDataManagerTest, | 328 PersonalDataManagerTest, |
333 ConvertWalletAddressesAndUpdateWalletCards_NewCard_AddressAlreadyConverted
); | 329 ConvertWalletAddressesAndUpdateWalletCards_NewCard_AddressAlreadyConverted
); // NOLINT |
334 FRIEND_TEST_ALL_PREFIXES( | 330 FRIEND_TEST_ALL_PREFIXES( |
335 PersonalDataManagerTest, | 331 PersonalDataManagerTest, |
336 ConvertWalletAddressesAndUpdateWalletCards_AlreadyConverted); | 332 ConvertWalletAddressesAndUpdateWalletCards_AlreadyConverted); |
337 FRIEND_TEST_ALL_PREFIXES( | 333 FRIEND_TEST_ALL_PREFIXES( |
338 PersonalDataManagerTest, | 334 PersonalDataManagerTest, |
339 ConvertWalletAddressesAndUpdateWalletCards_MultipleSimilarWalletAddresses)
; | 335 ConvertWalletAddressesAndUpdateWalletCards_MultipleSimilarWalletAddresses)
; // NOLINT |
340 friend class autofill::AutofillInteractiveTest; | 336 friend class autofill::AutofillInteractiveTest; |
341 friend class autofill::AutofillTest; | 337 friend class autofill::AutofillTest; |
342 friend class autofill::PersonalDataManagerFactory; | 338 friend class autofill::PersonalDataManagerFactory; |
343 friend class PersonalDataManagerTest; | 339 friend class PersonalDataManagerTest; |
344 friend class PersonalDataManagerTestBase; | 340 friend class PersonalDataManagerTestBase; |
345 friend class SaveImportedProfileTest; | 341 friend class SaveImportedProfileTest; |
346 friend class ProfileSyncServiceAutofillTest; | 342 friend class ProfileSyncServiceAutofillTest; |
347 friend class ::RemoveAutofillTester; | 343 friend class ::RemoveAutofillTester; |
348 friend std::default_delete<PersonalDataManager>; | 344 friend std::default_delete<PersonalDataManager>; |
349 friend void autofill_helper::SetProfiles( | 345 friend void autofill_helper::SetProfiles( |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 591 |
596 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. | 592 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. |
597 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_; | 593 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_; |
598 | 594 |
599 // True if autofill profile cleanup needs to be performed. | 595 // True if autofill profile cleanup needs to be performed. |
600 bool is_autofill_profile_cleanup_pending_ = false; | 596 bool is_autofill_profile_cleanup_pending_ = false; |
601 | 597 |
602 // Whether new information was received from the sync server. | 598 // Whether new information was received from the sync server. |
603 bool has_synced_new_data_ = false; | 599 bool has_synced_new_data_ = false; |
604 | 600 |
605 #if defined(OS_ANDROID) | |
606 // The context for the request to be used to fetch libaddressinput's address | 601 // The context for the request to be used to fetch libaddressinput's address |
607 // validation rules. | 602 // validation rules. |
608 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 603 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
609 #endif | |
610 | 604 |
611 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 605 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
612 }; | 606 }; |
613 | 607 |
614 } // namespace autofill | 608 } // namespace autofill |
615 | 609 |
616 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 610 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
OLD | NEW |