OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_UKM_OBSERVERS_HISTORY_DELETE_OBSERVER_H_ | |
6 #define COMPONENTS_UKM_OBSERVERS_HISTORY_DELETE_OBSERVER_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "components/history/core/browser/history_service_observer.h" | |
11 | |
12 namespace ukm { | |
13 | |
14 // Observes multiple HistoryService objects for any events that delete history. | |
15 // Handles cleanup and removing observers as objects are destroyed. | |
16 class HistoryDeleteObserver : public history::HistoryServiceObserver { | |
17 public: | |
18 HistoryDeleteObserver(); | |
19 ~HistoryDeleteObserver() override; | |
20 | |
21 // Starts observing a service for history deletions. | |
22 void ObserveServiceForDeletions(history::HistoryService* history_service); | |
23 | |
24 // history::HistoryServiceObserver | |
25 void OnURLsDeleted(history::HistoryService* history_service, | |
26 bool all_history, | |
27 bool expired, | |
28 const history::URLRows& deleted_rows, | |
29 const std::set<GURL>& favicon_urls) override; | |
30 void HistoryServiceBeingDeleted( | |
31 history::HistoryService* history_service) override; | |
32 | |
33 protected: | |
34 virtual void OnHistoryDeleted() = 0; | |
35 | |
36 private: | |
37 // Tracks observed history services, for cleanup. | |
38 std::set<history::HistoryService*> observed_history_services_; | |
sdefresne
2017/01/23 09:53:04
I would recommend using ScopedObserver here. It al
Steven Holte
2017/01/23 20:37:29
Done, thanks for the tip.
| |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(HistoryDeleteObserver); | |
41 }; | |
42 | |
43 } // namespace ukm | |
44 | |
45 #endif // COMPONENTS_UKM_OBSERVERS_HISTORY_DELETE_OBSERVER_H_ | |
OLD | NEW |