| 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 <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/prefs/pref_member.h" | 15 #include "base/prefs/pref_member.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 17 #include "components/autofill/core/browser/autofill_profile.h" | 17 #include "components/autofill/core/browser/autofill_profile.h" |
| 18 #include "components/autofill/core/browser/credit_card.h" | 18 #include "components/autofill/core/browser/credit_card.h" |
| 19 #include "components/autofill/core/browser/field_types.h" | 19 #include "components/autofill/core/browser/field_types.h" |
| 20 #include "components/autofill/core/browser/suggestion.h" | 20 #include "components/autofill/core/browser/suggestion.h" |
| 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 22 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" | 22 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" |
| 23 #include "components/keyed_service/core/keyed_service.h" | 23 #include "components/keyed_service/core/keyed_service.h" |
| 24 #include "components/webdata/common/web_data_service_consumer.h" | 24 #include "components/webdata/common/web_data_service_consumer.h" |
| 25 | 25 |
| 26 class Browser; | 26 class Browser; |
| 27 class PrefService; | 27 class PrefService; |
| 28 class RemoveAutofillTester; | 28 class RemoveAutofillTester; |
| 29 class AccountTrackerService; |
| 29 | 30 |
| 30 namespace autofill { | 31 namespace autofill { |
| 31 class AutofillInteractiveTest; | 32 class AutofillInteractiveTest; |
| 32 class AutofillTest; | 33 class AutofillTest; |
| 33 class FormStructure; | 34 class FormStructure; |
| 34 class PersonalDataManagerObserver; | 35 class PersonalDataManagerObserver; |
| 35 class PersonalDataManagerFactory; | 36 class PersonalDataManagerFactory; |
| 36 } // namespace autofill | 37 } // namespace autofill |
| 37 | 38 |
| 38 namespace autofill_helper { | 39 namespace autofill_helper { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 51 public: | 52 public: |
| 52 explicit PersonalDataManager(const std::string& app_locale); | 53 explicit PersonalDataManager(const std::string& app_locale); |
| 53 ~PersonalDataManager() override; | 54 ~PersonalDataManager() override; |
| 54 | 55 |
| 55 // Kicks off asynchronous loading of profiles and credit cards. | 56 // Kicks off asynchronous loading of profiles and credit cards. |
| 56 // |pref_service| must outlive this instance. |is_off_the_record| informs | 57 // |pref_service| must outlive this instance. |is_off_the_record| informs |
| 57 // this instance whether the user is currently operating in an off-the-record | 58 // this instance whether the user is currently operating in an off-the-record |
| 58 // context. | 59 // context. |
| 59 void Init(scoped_refptr<AutofillWebDataService> database, | 60 void Init(scoped_refptr<AutofillWebDataService> database, |
| 60 PrefService* pref_service, | 61 PrefService* pref_service, |
| 62 AccountTrackerService* account_tracker, |
| 61 bool is_off_the_record); | 63 bool is_off_the_record); |
| 62 | 64 |
| 63 // WebDataServiceConsumer: | 65 // WebDataServiceConsumer: |
| 64 void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h, | 66 void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h, |
| 65 const WDTypedResult* result) override; | 67 const WDTypedResult* result) override; |
| 66 | 68 |
| 67 // AutofillWebDataServiceObserverOnUIThread: | 69 // AutofillWebDataServiceObserverOnUIThread: |
| 68 void AutofillMultipleChanged() override; | 70 void AutofillMultipleChanged() override; |
| 69 | 71 |
| 70 // Adds a listener to be notified of PersonalDataManager events. | 72 // Adds a listener to be notified of PersonalDataManager events. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 virtual std::string CountryCodeForCurrentTimezone() const; | 304 virtual std::string CountryCodeForCurrentTimezone() const; |
| 303 | 305 |
| 304 // Sets which PrefService to use and observe. |pref_service| is not owned by | 306 // Sets which PrefService to use and observe. |pref_service| is not owned by |
| 305 // this class and must outlive |this|. | 307 // this class and must outlive |this|. |
| 306 void SetPrefService(PrefService* pref_service); | 308 void SetPrefService(PrefService* pref_service); |
| 307 | 309 |
| 308 void set_database(scoped_refptr<AutofillWebDataService> database) { | 310 void set_database(scoped_refptr<AutofillWebDataService> database) { |
| 309 database_ = database; | 311 database_ = database; |
| 310 } | 312 } |
| 311 | 313 |
| 314 void set_account_tracker(AccountTrackerService* account_tracker) { |
| 315 account_tracker_ = account_tracker; |
| 316 } |
| 317 |
| 312 // The backing database that this PersonalDataManager uses. | 318 // The backing database that this PersonalDataManager uses. |
| 313 scoped_refptr<AutofillWebDataService> database_; | 319 scoped_refptr<AutofillWebDataService> database_; |
| 314 | 320 |
| 315 // True if personal data has been loaded from the web database. | 321 // True if personal data has been loaded from the web database. |
| 316 bool is_data_loaded_; | 322 bool is_data_loaded_; |
| 317 | 323 |
| 318 // The loaded web profiles. These are constructed from entries on web pages | 324 // The loaded web profiles. These are constructed from entries on web pages |
| 319 // and from manually editing in the settings. | 325 // and from manually editing in the settings. |
| 320 ScopedVector<AutofillProfile> web_profiles_; | 326 ScopedVector<AutofillProfile> web_profiles_; |
| 321 | 327 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 bool record_metrics) const; | 371 bool record_metrics) const; |
| 366 | 372 |
| 367 const std::string app_locale_; | 373 const std::string app_locale_; |
| 368 | 374 |
| 369 // The default country code for new addresses. | 375 // The default country code for new addresses. |
| 370 mutable std::string default_country_code_; | 376 mutable std::string default_country_code_; |
| 371 | 377 |
| 372 // The PrefService that this instance uses. Must outlive this instance. | 378 // The PrefService that this instance uses. Must outlive this instance. |
| 373 PrefService* pref_service_; | 379 PrefService* pref_service_; |
| 374 | 380 |
| 381 // The AccountTrackerService that this instance uses. Must outlive this |
| 382 // instance. |
| 383 AccountTrackerService* account_tracker_; |
| 384 |
| 375 // Whether the user is currently operating in an off-the-record context. | 385 // Whether the user is currently operating in an off-the-record context. |
| 376 // Default value is false. | 386 // Default value is false. |
| 377 bool is_off_the_record_; | 387 bool is_off_the_record_; |
| 378 | 388 |
| 379 // Whether we have already logged the number of profiles this session. | 389 // Whether we have already logged the number of profiles this session. |
| 380 mutable bool has_logged_profile_count_; | 390 mutable bool has_logged_profile_count_; |
| 381 | 391 |
| 382 // An observer to listen for changes to prefs::kAutofillEnabled. | 392 // An observer to listen for changes to prefs::kAutofillEnabled. |
| 383 scoped_ptr<BooleanPrefMember> enabled_pref_; | 393 scoped_ptr<BooleanPrefMember> enabled_pref_; |
| 384 | 394 |
| 385 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. | 395 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. |
| 386 scoped_ptr<BooleanPrefMember> wallet_enabled_pref_; | 396 scoped_ptr<BooleanPrefMember> wallet_enabled_pref_; |
| 387 | 397 |
| 388 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 398 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 389 }; | 399 }; |
| 390 | 400 |
| 391 } // namespace autofill | 401 } // namespace autofill |
| 392 | 402 |
| 393 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 403 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |