Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: chrome/browser/browsing_data/history_counter.h

Issue 2084903002: Moved BrowsingDataCounter and part of BrowsingDataCounterUtils to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/task/cancelable_task_tracker.h" 9 #include "base/task/cancelable_task_tracker.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
11 #include "chrome/browser/browsing_data/browsing_data_counter.h" 11 #include "components/browsing_data/counters/browsing_data_counter.h"
12 #include "components/history/core/browser/history_service.h" 12 #include "components/history/core/browser/history_service.h"
13 #include "components/history/core/browser/web_history_service.h" 13 #include "components/history/core/browser/web_history_service.h"
14 #include "components/sync_driver/sync_service_observer.h" 14 #include "components/sync_driver/sync_service_observer.h"
15 15
16 class Profile;
17
16 class ProfileSyncService; 18 class ProfileSyncService;
17 19
18 class HistoryCounter: public BrowsingDataCounter, 20 class HistoryCounter : public browsing_data::BrowsingDataCounter,
19 public sync_driver::SyncServiceObserver { 21 public sync_driver::SyncServiceObserver {
20 public: 22 public:
21 class HistoryResult : public FinishedResult { 23 class HistoryResult : public FinishedResult {
22 public: 24 public:
23 HistoryResult(const HistoryCounter* source, 25 HistoryResult(const HistoryCounter* source,
24 ResultInt value, 26 ResultInt value,
25 bool has_synced_visits); 27 bool has_synced_visits);
26 ~HistoryResult() override; 28 ~HistoryResult() override;
27 29
28 bool has_synced_visits() const { return has_synced_visits_; } 30 bool has_synced_visits() const { return has_synced_visits_; }
29 31
30 private: 32 private:
31 bool has_synced_visits_; 33 bool has_synced_visits_;
32 }; 34 };
33 35
34 HistoryCounter(); 36 explicit HistoryCounter(Profile* profile);
35 ~HistoryCounter() override; 37 ~HistoryCounter() override;
36 38
37 void OnInitialized() override; 39 void OnInitialized() override;
38 const std::string& GetPrefName() const override;
39 40
40 // Whether there are counting tasks in progress. Only used for testing. 41 // Whether there are counting tasks in progress. Only used for testing.
41 bool HasTrackedTasks(); 42 bool HasTrackedTasks();
42 43
43 // Make the history counter use a custom WebHistoryService instance. Only 44 // Make the history counter use a custom WebHistoryService instance. Only
44 // used for testing. 45 // used for testing.
45 void SetWebHistoryServiceForTesting(history::WebHistoryService* service); 46 void SetWebHistoryServiceForTesting(history::WebHistoryService* service);
46 47
47 private: 48 private:
48 const std::string pref_name_; 49 Profile* profile_;
49 50
50 BrowsingDataCounter::ResultInt local_result_; 51 BrowsingDataCounter::ResultInt local_result_;
51 bool has_synced_visits_; 52 bool has_synced_visits_;
52 53
53 bool local_counting_finished_; 54 bool local_counting_finished_;
54 bool web_counting_finished_; 55 bool web_counting_finished_;
55 56
56 history::WebHistoryService* testing_web_history_service_; 57 history::WebHistoryService* testing_web_history_service_;
57 58
58 base::CancelableTaskTracker cancelable_task_tracker_; 59 base::CancelableTaskTracker cancelable_task_tracker_;
(...skipping 13 matching lines...) Expand all
72 void OnGetWebHistoryCount(history::WebHistoryService::Request* request, 73 void OnGetWebHistoryCount(history::WebHistoryService::Request* request,
73 const base::DictionaryValue* result); 74 const base::DictionaryValue* result);
74 void OnWebHistoryTimeout(); 75 void OnWebHistoryTimeout();
75 void MergeResults(); 76 void MergeResults();
76 77
77 // SyncServiceObserver implementation. 78 // SyncServiceObserver implementation.
78 void OnStateChanged() override; 79 void OnStateChanged() override;
79 }; 80 };
80 81
81 #endif // CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_ 82 #endif // CHROME_BROWSER_BROWSING_DATA_HISTORY_COUNTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/downloads_counter_browsertest.cc ('k') | chrome/browser/browsing_data/history_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698