OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ | 5 #ifndef COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ | 6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
12 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 12 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
13 #include "components/sync/driver/sync_service_observer.h" | 13 #include "components/sync/driver/sync_service_observer.h" |
14 #include "components/webdata/common/web_data_service_consumer.h" | 14 #include "components/webdata/common/web_data_service_consumer.h" |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 class AutofillWebDataService; | 17 class AutofillWebDataService; |
18 } | 18 } |
19 | 19 |
20 namespace browsing_data { | 20 namespace browsing_data { |
21 | 21 |
22 class AutofillCounter : public browsing_data::BrowsingDataCounter, | 22 class AutofillCounter : public browsing_data::BrowsingDataCounter, |
23 public WebDataServiceConsumer, | 23 public WebDataServiceConsumer, |
24 public syncer::SyncServiceObserver { | 24 public syncer::SyncServiceObserver { |
25 public: | 25 public: |
26 class AutofillResult : public FinishedResult { | 26 class AutofillResult : public SyncResult { |
27 public: | 27 public: |
28 AutofillResult(const AutofillCounter* source, | 28 AutofillResult(const AutofillCounter* source, |
29 ResultInt num_suggestions, | 29 ResultInt num_suggestions, |
30 ResultInt num_credit_cards, | 30 ResultInt num_credit_cards, |
31 ResultInt num_addresses, | 31 ResultInt num_addresses, |
32 bool autofill_sync_enabled_); | 32 bool autofill_sync_enabled_); |
33 ~AutofillResult() override; | 33 ~AutofillResult() override; |
34 | 34 |
35 ResultInt num_credit_cards() const { return num_credit_cards_; } | 35 ResultInt num_credit_cards() const { return num_credit_cards_; } |
36 ResultInt num_addresses() const { return num_addresses_; } | 36 ResultInt num_addresses() const { return num_addresses_; } |
37 bool autofill_sync_enabled() const { return autofill_sync_enabled_; } | |
38 | 37 |
39 private: | 38 private: |
40 ResultInt num_credit_cards_; | 39 ResultInt num_credit_cards_; |
41 ResultInt num_addresses_; | 40 ResultInt num_addresses_; |
42 bool autofill_sync_enabled_; | |
43 | 41 |
44 DISALLOW_COPY_AND_ASSIGN(AutofillResult); | 42 DISALLOW_COPY_AND_ASSIGN(AutofillResult); |
45 }; | 43 }; |
46 | 44 |
47 explicit AutofillCounter( | 45 explicit AutofillCounter( |
48 scoped_refptr<autofill::AutofillWebDataService> web_data_service, | 46 scoped_refptr<autofill::AutofillWebDataService> web_data_service, |
49 syncer::SyncService* sync_service); | 47 syncer::SyncService* sync_service); |
50 ~AutofillCounter() override; | 48 ~AutofillCounter() override; |
51 | 49 |
52 // BrowsingDataCounter implementation. | 50 // BrowsingDataCounter implementation. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool autofill_sync_enabled_; | 89 bool autofill_sync_enabled_; |
92 | 90 |
93 base::Time period_start_for_testing_; | 91 base::Time period_start_for_testing_; |
94 | 92 |
95 DISALLOW_COPY_AND_ASSIGN(AutofillCounter); | 93 DISALLOW_COPY_AND_ASSIGN(AutofillCounter); |
96 }; | 94 }; |
97 | 95 |
98 } // namespace browsing_data | 96 } // namespace browsing_data |
99 | 97 |
100 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ | 98 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
OLD | NEW |