| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 DISALLOW_COPY_AND_ASSIGN(AutofillResult); | 39 DISALLOW_COPY_AND_ASSIGN(AutofillResult); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 explicit AutofillCounter( | 42 explicit AutofillCounter( |
| 43 scoped_refptr<autofill::AutofillWebDataService> web_data_service); | 43 scoped_refptr<autofill::AutofillWebDataService> web_data_service); |
| 44 ~AutofillCounter() override; | 44 ~AutofillCounter() override; |
| 45 | 45 |
| 46 // BrowsingDataCounter implementation. | 46 // BrowsingDataCounter implementation. |
| 47 void OnInitialized() override; | 47 void OnInitialized() override; |
| 48 | 48 |
| 49 // Whether the counting is in progress. | |
| 50 bool HasPendingQuery() { | |
| 51 return suggestions_query_ || credit_cards_query_ || addresses_query_; | |
| 52 } | |
| 53 | |
| 54 const char* GetPrefName() const override; | 49 const char* GetPrefName() const override; |
| 55 | 50 |
| 56 // Set the beginning of the time period for testing. AutofillTable does not | 51 // Set the beginning of the time period for testing. AutofillTable does not |
| 57 // allow us to set time explicitly, and BrowsingDataCounter recognizes | 52 // allow us to set time explicitly, and BrowsingDataCounter recognizes |
| 58 // only predefined time periods, out of which the lowest one is one hour. | 53 // only predefined time periods, out of which the lowest one is one hour. |
| 59 // Obviously, the test cannot run that long. | 54 // Obviously, the test cannot run that long. |
| 60 // TODO(msramek): Consider changing BrowsingDataCounter to use arbitrary | 55 // TODO(msramek): Consider changing BrowsingDataCounter to use arbitrary |
| 61 // time periods instead of BrowsingDataRemover::TimePeriod. | 56 // time periods instead of BrowsingDataRemover::TimePeriod. |
| 62 void SetPeriodStartForTesting(const base::Time& period_start_for_testing); | 57 void SetPeriodStartForTesting(const base::Time& period_start_for_testing); |
| 63 | 58 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 85 ResultInt num_addresses_; | 80 ResultInt num_addresses_; |
| 86 | 81 |
| 87 base::Time period_start_for_testing_; | 82 base::Time period_start_for_testing_; |
| 88 | 83 |
| 89 DISALLOW_COPY_AND_ASSIGN(AutofillCounter); | 84 DISALLOW_COPY_AND_ASSIGN(AutofillCounter); |
| 90 }; | 85 }; |
| 91 | 86 |
| 92 } // namespace browsing_data | 87 } // namespace browsing_data |
| 93 | 88 |
| 94 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ | 89 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_AUTOFILL_COUNTER_H_ |
| OLD | NEW |