Chromium Code Reviews| Index: components/browsing_data/core/counters/autofill_counter.h |
| diff --git a/chrome/browser/browsing_data/autofill_counter.h b/components/browsing_data/core/counters/autofill_counter.h |
| similarity index 83% |
| rename from chrome/browser/browsing_data/autofill_counter.h |
| rename to components/browsing_data/core/counters/autofill_counter.h |
| index bc65dc332763a2269d70c3b22145c7557f7e5d2a..9d98a9b521b34ba946d5295ac3e7f6201077087d 100644 |
| --- a/chrome/browser/browsing_data/autofill_counter.h |
| +++ b/components/browsing_data/core/counters/autofill_counter.h |
| @@ -2,21 +2,22 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_BROWSING_DATA_AUTOFILL_COUNTER_H_ |
| -#define CHROME_BROWSER_BROWSING_DATA_AUTOFILL_COUNTER_H_ |
| +#ifndef COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
| +#define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
| #include "base/macros.h" |
| #include "base/threading/thread_checker.h" |
| #include "base/time/time.h" |
| +#include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| #include "components/browsing_data/core/counters/browsing_data_counter.h" |
| #include "components/webdata/common/web_data_service_consumer.h" |
| -class Profile; |
| - |
| namespace autofill { |
| class AutofillWebDataService; |
| } |
| +namespace browsing_data { |
| + |
| class AutofillCounter : public browsing_data::BrowsingDataCounter, |
| public WebDataServiceConsumer { |
| public: |
| @@ -38,7 +39,8 @@ class AutofillCounter : public browsing_data::BrowsingDataCounter, |
| DISALLOW_COPY_AND_ASSIGN(AutofillResult); |
| }; |
| - explicit AutofillCounter(Profile* profile); |
| + explicit AutofillCounter( |
| + scoped_refptr<autofill::AutofillWebDataService> web_data_service); |
| ~AutofillCounter() override; |
| // BrowsingDataCounter implementation. |
| @@ -49,6 +51,8 @@ class AutofillCounter : public browsing_data::BrowsingDataCounter, |
| return suggestions_query_ || credit_cards_query_ || addresses_query_; |
| } |
| + const std::string& GetPrefName() const override; |
| + |
| // Set the beginning of the time period for testing. AutofillTable does not |
| // allow us to set time explicitly, and BrowsingDataCounter recognizes |
| // only predefined time periods, out of which the lowest one is one hour. |
| @@ -58,7 +62,17 @@ class AutofillCounter : public browsing_data::BrowsingDataCounter, |
| void SetPeriodStartForTesting(const base::Time& period_start_for_testing); |
| private: |
| - Profile* profile_; |
| + void Count() override; |
| + |
| + // WebDataServiceConsumer implementation. |
| + void OnWebDataServiceRequestDone(WebDataServiceBase::Handle handle, |
| + const WDTypedResult* result) override; |
| + |
| + // Cancel all pending requests to AutofillWebdataService. |
| + void CancelAllRequests(); |
| + |
| + const std::string pref_name_; |
| + |
| base::ThreadChecker thread_checker_; |
| scoped_refptr<autofill::AutofillWebDataService> web_data_service_; |
| @@ -73,16 +87,8 @@ class AutofillCounter : public browsing_data::BrowsingDataCounter, |
| base::Time period_start_for_testing_; |
| - void Count() override; |
| - |
| - // WebDataServiceConsumer implementation. |
| - void OnWebDataServiceRequestDone(WebDataServiceBase::Handle handle, |
| - const WDTypedResult* result) override; |
| - |
| - // Cancel all pending requests to AutofillWebdataService. |
| - void CancelAllRequests(); |
| - |
| DISALLOW_COPY_AND_ASSIGN(AutofillCounter); |
| }; |
| -#endif // CHROME_BROWSER_BROWSING_DATA_AUTOFILL_COUNTER_H_ |
| +} // namespace browsing_data |
| +#endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
|
msramek
2016/07/20 13:41:16
nit: Empty line.
ioanap
2016/07/20 17:50:36
Done.
|