OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 5 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/browsing_data/core/browsing_data_utils.h" | 10 #include "components/browsing_data/core/browsing_data_utils.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 return CalculateBeginDeleteTime(static_cast<TimePeriod>(*period_)); | 38 return CalculateBeginDeleteTime(static_cast<TimePeriod>(*period_)); |
39 } | 39 } |
40 | 40 |
41 void BrowsingDataCounter::Restart() { | 41 void BrowsingDataCounter::Restart() { |
42 DCHECK(initialized_); | 42 DCHECK(initialized_); |
43 | 43 |
44 // If this data type was unchecked for deletion, we do not need to count it. | 44 // If this data type was unchecked for deletion, we do not need to count it. |
45 if (!pref_service_->GetBoolean(GetPrefName())) | 45 if (!pref_service_->GetBoolean(GetPrefName())) |
46 return; | 46 return; |
47 | 47 |
48 callback_.Run(base::WrapUnique(new Result(this))); | 48 callback_.Run(base::MakeUnique<Result>(this)); |
49 | 49 |
50 Count(); | 50 Count(); |
51 } | 51 } |
52 | 52 |
53 void BrowsingDataCounter::ReportResult(ResultInt value) { | 53 void BrowsingDataCounter::ReportResult(ResultInt value) { |
54 DCHECK(initialized_); | 54 DCHECK(initialized_); |
55 callback_.Run(base::WrapUnique(new FinishedResult(this, value))); | 55 callback_.Run(base::MakeUnique<FinishedResult>(this, value)); |
56 } | 56 } |
57 | 57 |
58 void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) { | 58 void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) { |
59 DCHECK(initialized_); | 59 DCHECK(initialized_); |
60 callback_.Run(std::move(result)); | 60 callback_.Run(std::move(result)); |
61 } | 61 } |
62 | 62 |
63 PrefService* BrowsingDataCounter::GetPrefs() const { | 63 PrefService* BrowsingDataCounter::GetPrefs() const { |
64 return pref_service_; | 64 return pref_service_; |
65 } | 65 } |
(...skipping 21 matching lines...) Expand all Loading... |
87 bool BrowsingDataCounter::FinishedResult::Finished() const { | 87 bool BrowsingDataCounter::FinishedResult::Finished() const { |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 BrowsingDataCounter::ResultInt BrowsingDataCounter::FinishedResult::Value() | 91 BrowsingDataCounter::ResultInt BrowsingDataCounter::FinishedResult::Value() |
92 const { | 92 const { |
93 return value_; | 93 return value_; |
94 } | 94 } |
95 | 95 |
96 } // namespace browsing_data | 96 } // namespace browsing_data |
OLD | NEW |