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

Side by Side Diff: components/ukm/observers/history_delete_observer.cc

Issue 2567263003: Basic UkmService implementation (Closed)
Patch Set: Check OFFICIAL_BUILD Created 3 years, 11 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
(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 #include "components/ukm/observers/history_delete_observer.h"
6
7 #include "components/history/core/browser/history_service.h"
8
9 namespace ukm {
10
11 HistoryDeleteObserver::HistoryDeleteObserver() = default;
12
13 HistoryDeleteObserver::~HistoryDeleteObserver() {
14 for (history::HistoryService* history_service : observed_history_services_) {
15 history_service->RemoveObserver(this);
16 }
17 }
18
19 void HistoryDeleteObserver::ObserveServiceForDeletions(
20 history::HistoryService* history_service) {
21 if (history_service) {
22 history_service->AddObserver(this);
23 observed_history_services_.insert(history_service);
24 }
25 }
26
27 void HistoryDeleteObserver::OnURLsDeleted(
28 history::HistoryService* history_service,
29 bool all_history,
30 bool expired,
31 const history::URLRows& deleted_rows,
32 const std::set<GURL>& favicon_urls) {
33 if (!expired)
34 OnHistoryDeleted();
35 }
36
37 void HistoryDeleteObserver::HistoryServiceBeingDeleted(
38 history::HistoryService* history_service) {
39 history_service->RemoveObserver(this);
40 observed_history_services_.erase(history_service);
41 }
42
43 } // namespace ukm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698