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
3 // found in the LICENSE file.
5 #include "chrome/browser/browsing_data/browsing_data_counter.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h"
10 BrowsingDataCounter::BrowsingDataCounter() {}
12 BrowsingDataCounter::~BrowsingDataCounter() {
15 void BrowsingDataCounter::Init(
17 const Callback
& callback
) {
18 DCHECK(!initialized_
);
24 base::Bind(&BrowsingDataCounter::RestartCounting
,
25 base::Unretained(this)));
32 Profile
* BrowsingDataCounter::GetProfile() const {
36 void BrowsingDataCounter::OnInitialized() {
39 void BrowsingDataCounter::RestartCounting() {
42 // If this data type was unchecked for deletion, we do not need to count it.
43 if (!profile_
->GetPrefs()->GetBoolean(GetPrefName()))
46 // If counting is already in progress, do not restart it.
50 callback_
.Run(false, 0u);
56 void BrowsingDataCounter::ReportResult(uint32 value
) {
60 callback_
.Run(true, value
);