| 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 CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ |
| 7 | 7 |
| 8 #include "base/task/cancelable_task_tracker.h" | 8 #include "base/task/cancelable_task_tracker.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_counter.h" | 10 #include "chrome/browser/browsing_data/browsing_data_counter.h" |
| 11 #include "components/history/core/browser/history_service.h" | 11 #include "components/history/core/browser/history_service.h" |
| 12 #include "components/history/core/browser/web_history_service.h" | 12 #include "components/history/core/browser/web_history_service.h" |
| 13 | 13 |
| 14 class HistoryCounter: public BrowsingDataCounter { | 14 class HistoryCounter: public BrowsingDataCounter { |
| 15 public: | 15 public: |
| 16 // A special value indicating that the local counting result is zero, but some | 16 class HistoryResult : public FinishedResult { |
| 17 // history entries exist in Sync. | 17 public: |
| 18 // TODO(msramek): Change the callback signature so we can return a structured | 18 HistoryResult(const HistoryCounter* source, |
| 19 // result instead of special int values. | 19 ResultInt value, |
| 20 static const BrowsingDataCounter::ResultInt kOnlySyncedHistory; | 20 bool has_synced_visits); |
| 21 ~HistoryResult() override; |
| 22 |
| 23 bool has_synced_visits() const { return has_synced_visits_; } |
| 24 |
| 25 private: |
| 26 bool has_synced_visits_; |
| 27 }; |
| 21 | 28 |
| 22 HistoryCounter(); | 29 HistoryCounter(); |
| 23 ~HistoryCounter() override; | 30 ~HistoryCounter() override; |
| 24 | 31 |
| 25 const std::string& GetPrefName() const override; | 32 const std::string& GetPrefName() const override; |
| 26 | 33 |
| 27 // Whether there are counting tasks in progress. Only used for testing. | 34 // Whether there are counting tasks in progress. Only used for testing. |
| 28 bool HasTrackedTasks(); | 35 bool HasTrackedTasks(); |
| 29 | 36 |
| 30 // Make the history counter use a custom WebHistoryService instance. Only | 37 // Make the history counter use a custom WebHistoryService instance. Only |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 void Count() override; | 58 void Count() override; |
| 52 | 59 |
| 53 void OnGetLocalHistoryCount(history::HistoryCountResult result); | 60 void OnGetLocalHistoryCount(history::HistoryCountResult result); |
| 54 void OnGetWebHistoryCount(history::WebHistoryService::Request* request, | 61 void OnGetWebHistoryCount(history::WebHistoryService::Request* request, |
| 55 const base::DictionaryValue* result); | 62 const base::DictionaryValue* result); |
| 56 void OnWebHistoryTimeout(); | 63 void OnWebHistoryTimeout(); |
| 57 void MergeResults(); | 64 void MergeResults(); |
| 58 }; | 65 }; |
| 59 | 66 |
| 60 #endif // CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ | 67 #endif // CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ |
| OLD | NEW |