Chromium Code Reviews| 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/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "components/autofill/core/browser/autofill_profile.h" | 16 #include "components/autofill/core/browser/autofill_profile.h" |
| 17 #include "components/autofill/core/browser/credit_card.h" | 17 #include "components/autofill/core/browser/credit_card.h" |
| 18 #include "components/autofill/core/browser/field_types.h" | 18 #include "components/autofill/core/browser/field_types.h" |
| 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse rver.h" | 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse rver.h" |
| 20 #include "components/webdata/common/web_data_service_consumer.h" | 20 #include "components/webdata/common/web_data_service_consumer.h" |
| 21 | 21 |
| 22 class PrefService; | |
| 22 class RemoveAutofillTester; | 23 class RemoveAutofillTester; |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 class BrowserContext; | 26 class BrowserContext; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace autofill { | 29 namespace autofill { |
| 29 class AutofillInteractiveTest; | 30 class AutofillInteractiveTest; |
| 30 class AutofillMetrics; | 31 class AutofillMetrics; |
| 31 class AutofillTest; | 32 class AutofillTest; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 48 public AutofillWebDataServiceObserverOnUIThread { | 49 public AutofillWebDataServiceObserverOnUIThread { |
| 49 public: | 50 public: |
| 50 // A pair of GUID and variant index. Represents a single FormGroup and a | 51 // A pair of GUID and variant index. Represents a single FormGroup and a |
| 51 // specific data variant. | 52 // specific data variant. |
| 52 typedef std::pair<std::string, size_t> GUIDPair; | 53 typedef std::pair<std::string, size_t> GUIDPair; |
| 53 | 54 |
| 54 explicit PersonalDataManager(const std::string& app_locale); | 55 explicit PersonalDataManager(const std::string& app_locale); |
| 55 virtual ~PersonalDataManager(); | 56 virtual ~PersonalDataManager(); |
| 56 | 57 |
| 57 // Kicks off asynchronous loading of profiles and credit cards. | 58 // Kicks off asynchronous loading of profiles and credit cards. |
| 58 void Init(content::BrowserContext* context); | 59 void Init(content::BrowserContext* context, PrefService* pref_service); |
| 59 | 60 |
| 60 // WebDataServiceConsumer: | 61 // WebDataServiceConsumer: |
| 61 virtual void OnWebDataServiceRequestDone( | 62 virtual void OnWebDataServiceRequestDone( |
| 62 WebDataServiceBase::Handle h, | 63 WebDataServiceBase::Handle h, |
| 63 const WDTypedResult* result) OVERRIDE; | 64 const WDTypedResult* result) OVERRIDE; |
| 64 | 65 |
| 65 // AutofillWebDataServiceObserverOnUIThread: | 66 // AutofillWebDataServiceObserverOnUIThread: |
| 66 virtual void AutofillMultipleChanged() OVERRIDE; | 67 virtual void AutofillMultipleChanged() OVERRIDE; |
| 67 | 68 |
| 68 // Adds a listener to be notified of PersonalDataManager events. | 69 // Adds a listener to be notified of PersonalDataManager events. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 std::string MostCommonCountryCodeFromProfiles() const; | 293 std::string MostCommonCountryCodeFromProfiles() const; |
| 293 | 294 |
| 294 const std::string app_locale_; | 295 const std::string app_locale_; |
| 295 | 296 |
| 296 // The default country code for new addresses. | 297 // The default country code for new addresses. |
| 297 mutable std::string default_country_code_; | 298 mutable std::string default_country_code_; |
| 298 | 299 |
| 299 // For logging UMA metrics. Overridden by metrics tests. | 300 // For logging UMA metrics. Overridden by metrics tests. |
| 300 scoped_ptr<const AutofillMetrics> metric_logger_; | 301 scoped_ptr<const AutofillMetrics> metric_logger_; |
| 301 | 302 |
| 303 // The PrefService that this class uses. | |
|
Jói
2013/10/31 17:23:05
Document the lifetime guarantees. I'm guessing in
blundell
2013/11/03 21:33:03
Done.
| |
| 304 PrefService* pref_service_; | |
| 305 | |
| 302 // Whether we have already logged the number of profiles this session. | 306 // Whether we have already logged the number of profiles this session. |
| 303 mutable bool has_logged_profile_count_; | 307 mutable bool has_logged_profile_count_; |
| 304 | 308 |
| 305 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 309 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 306 }; | 310 }; |
| 307 | 311 |
| 308 } // namespace autofill | 312 } // namespace autofill |
| 309 | 313 |
| 310 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 314 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |