OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_HISTORY_COUNTER_H_ | 5 #ifndef COMPONENTS_BROWSING_DATA_CORE_COUNTERS_HISTORY_COUNTER_H_ |
6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_HISTORY_COUNTER_H_ | 6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_HISTORY_COUNTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.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/history/core/browser/history_service.h" | 13 #include "components/history/core/browser/history_service.h" |
14 #include "components/history/core/browser/web_history_service.h" | 14 #include "components/history/core/browser/web_history_service.h" |
15 #include "components/sync/driver/sync_service.h" | 15 #include "components/sync/driver/sync_service.h" |
16 #include "components/sync/driver/sync_service_observer.h" | 16 #include "components/sync/driver/sync_service_observer.h" |
17 | 17 |
18 namespace browsing_data { | 18 namespace browsing_data { |
19 | 19 |
20 class HistoryCounter : public browsing_data::BrowsingDataCounter, | 20 class HistoryCounter : public browsing_data::BrowsingDataCounter, |
21 public syncer::SyncServiceObserver { | 21 public syncer::SyncServiceObserver { |
22 public: | 22 public: |
23 typedef base::Callback<history::WebHistoryService*()> | 23 typedef base::Callback<history::WebHistoryService*()> |
24 GetUpdatedWebHistoryServiceCallback; | 24 GetUpdatedWebHistoryServiceCallback; |
25 | 25 |
26 class HistoryResult : public FinishedResult { | |
27 public: | |
28 HistoryResult(const HistoryCounter* source, | |
29 ResultInt value, | |
30 bool has_synced_visits); | |
31 ~HistoryResult() override; | |
32 | |
33 bool has_synced_visits() const { return has_synced_visits_; } | |
34 | |
35 private: | |
36 bool has_synced_visits_; | |
37 }; | |
38 | |
39 explicit HistoryCounter(history::HistoryService* history_service, | 26 explicit HistoryCounter(history::HistoryService* history_service, |
40 const GetUpdatedWebHistoryServiceCallback& callback, | 27 const GetUpdatedWebHistoryServiceCallback& callback, |
41 syncer::SyncService* sync_service); | 28 syncer::SyncService* sync_service); |
42 ~HistoryCounter() override; | 29 ~HistoryCounter() override; |
43 | 30 |
44 void OnInitialized() override; | 31 void OnInitialized() override; |
45 | 32 |
46 // Whether there are counting tasks in progress. Only used for testing. | 33 // Whether there are counting tasks in progress. Only used for testing. |
47 bool HasTrackedTasks(); | 34 bool HasTrackedTasks(); |
48 | 35 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 BrowsingDataCounter::ResultInt local_result_; | 67 BrowsingDataCounter::ResultInt local_result_; |
81 | 68 |
82 bool history_sync_enabled_; | 69 bool history_sync_enabled_; |
83 | 70 |
84 base::WeakPtrFactory<HistoryCounter> weak_ptr_factory_; | 71 base::WeakPtrFactory<HistoryCounter> weak_ptr_factory_; |
85 }; | 72 }; |
86 | 73 |
87 } // namespace browsing_data | 74 } // namespace browsing_data |
88 | 75 |
89 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_HISTORY_COUNTER_H_ | 76 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_HISTORY_COUNTER_H_ |
OLD | NEW |