| 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_BROWSING_DATA_COUNTER_H_ | 5 #ifndef COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ |
| 6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ | 6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 base::Time GetPeriodStart(); | 121 base::Time GetPeriodStart(); |
| 122 | 122 |
| 123 // Returns if this counter belongs to a preference on the default, basic or | 123 // Returns if this counter belongs to a preference on the default, basic or |
| 124 // advanced CBD tab. | 124 // advanced CBD tab. |
| 125 ClearBrowsingDataTab GetTab() const; | 125 ClearBrowsingDataTab GetTab() const; |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 // Called after the class is initialized by calling |Init|. | 128 // Called after the class is initialized by calling |Init|. |
| 129 virtual void OnInitialized(); | 129 virtual void OnInitialized(); |
| 130 | 130 |
| 131 // Count the data. | 131 // Count the data. Call ReportResult() when finished. Tasks that are still |
| 132 // running should be cancelled to avoid reporting old results. |
| 132 virtual void Count() = 0; | 133 virtual void Count() = 0; |
| 133 | 134 |
| 134 // State transition methods. | 135 // State transition methods. |
| 135 void TransitionToShowCalculating(); | 136 void TransitionToShowCalculating(); |
| 136 void TransitionToReadyToReportResult(); | 137 void TransitionToReadyToReportResult(); |
| 137 | 138 |
| 138 // Indicates if this counter belongs to a preference on the basic CBD tab. | 139 // Indicates if this counter belongs to a preference on the basic CBD tab. |
| 139 ClearBrowsingDataTab clear_browsing_data_tab_; | 140 ClearBrowsingDataTab clear_browsing_data_tab_; |
| 140 | 141 |
| 141 // The callback that will be called when the UI should be updated with a new | 142 // The callback that will be called when the UI should be updated with a new |
| (...skipping 21 matching lines...) Expand all Loading... |
| 163 std::unique_ptr<Result> staged_result_; | 164 std::unique_ptr<Result> staged_result_; |
| 164 | 165 |
| 165 // A timer to time the RESTARTED->SHOW_CALCULATION and | 166 // A timer to time the RESTARTED->SHOW_CALCULATION and |
| 166 // SHOW_CALCULATION->READY_TO_REPORT_RESULT state transitions. | 167 // SHOW_CALCULATION->READY_TO_REPORT_RESULT state transitions. |
| 167 base::OneShotTimer timer_; | 168 base::OneShotTimer timer_; |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 } // namespace browsing_data | 171 } // namespace browsing_data |
| 171 | 172 |
| 172 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ | 173 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ |
| OLD | NEW |