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 "base/scoped_observer.h" |
| 11 #include "components/history/core/browser/history_service_observer.h" |
| 12 |
| 13 namespace ukm { |
| 14 |
| 15 // Observes multiple HistoryService objects for any events that delete history. |
| 16 // Handles cleanup and removing observers as objects are destroyed. |
| 17 class HistoryDeleteObserver : public history::HistoryServiceObserver { |
| 18 public: |
| 19 HistoryDeleteObserver(); |
| 20 ~HistoryDeleteObserver() override; |
| 21 |
| 22 // Starts observing a service for history deletions. |
| 23 void ObserveServiceForDeletions(history::HistoryService* history_service); |
| 24 |
| 25 // history::HistoryServiceObserver |
| 26 void OnURLsDeleted(history::HistoryService* history_service, |
| 27 bool all_history, |
| 28 bool expired, |
| 29 const history::URLRows& deleted_rows, |
| 30 const std::set<GURL>& favicon_urls) override; |
| 31 void HistoryServiceBeingDeleted( |
| 32 history::HistoryService* history_service) override; |
| 33 |
| 34 protected: |
| 35 virtual void OnHistoryDeleted() = 0; |
| 36 |
| 37 private: |
| 38 // Tracks observed history services, for cleanup. |
| 39 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
| 40 history_observer_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(HistoryDeleteObserver); |
| 43 }; |
| 44 |
| 45 } // namespace ukm |
| 46 |
| 47 #endif // COMPONENTS_UKM_OBSERVERS_HISTORY_DELETE_OBSERVER_H_ |
OLD | NEW |