Chromium Code Reviews| Index: chrome/browser/browsing_data/browsing_data_counter.cc |
| diff --git a/chrome/browser/browsing_data/browsing_data_counter.cc b/chrome/browser/browsing_data/browsing_data_counter.cc |
| index a716c32c90fc4eb61d0e0a2462538f7beedcb2a7..ac1fa11d0fe94ef812974a49d60f0e33a16d37f6 100644 |
| --- a/chrome/browser/browsing_data/browsing_data_counter.cc |
| +++ b/chrome/browser/browsing_data/browsing_data_counter.cc |
| @@ -53,12 +53,55 @@ void BrowsingDataCounter::Restart() { |
| if (!profile_->GetPrefs()->GetBoolean(GetPrefName())) |
| return; |
| - callback_.Run(false, 0u); |
| + callback_.Run(make_scoped_ptr(new Result(this))); |
| Count(); |
| } |
| void BrowsingDataCounter::ReportResult(ResultInt value) { |
| DCHECK(initialized_); |
| - callback_.Run(true, value); |
| + callback_.Run(make_scoped_ptr(new FinishedResult(this, value))); |
| +} |
| + |
| +void BrowsingDataCounter::ReportResult(scoped_ptr<Result> result) { |
| + DCHECK(initialized_); |
| + callback_.Run(result.Pass()); |
| +} |
| + |
| +// BrowsingDataCounter::Result ------------------------------------------------- |
| + |
| +BrowsingDataCounter::Result::Result(const BrowsingDataCounter* source) |
| + : source_(source) { |
| +} |
| + |
| +BrowsingDataCounter::Result::~Result() { |
| +} |
| + |
| +bool BrowsingDataCounter::Result::finished() const { |
| + return false; |
| +} |
| + |
| +const BrowsingDataCounter::ResultInt |
| + BrowsingDataCounter::Result::value() const { |
| + return 0; |
|
Bernhard Bauer
2015/11/03 10:11:19
You could add a NOTREACHED(), or -- depending on h
msramek
2015/11/03 10:55:45
Yes, I wanted to move it to the subclass (if you l
|
| +} |
| + |
| +// BrowsingDataCounter::FinishedResult ----------------------------------------- |
| + |
| +BrowsingDataCounter::FinishedResult::FinishedResult( |
| + const BrowsingDataCounter* source, ResultInt value) |
| + : Result(source), |
| + value_(value) { |
| +} |
| + |
| +BrowsingDataCounter::FinishedResult::~FinishedResult() { |
| +} |
| + |
| +bool BrowsingDataCounter::FinishedResult::finished() const { |
| + return true; |
| +} |
| + |
| +const BrowsingDataCounter::ResultInt |
| + BrowsingDataCounter::FinishedResult::value() const { |
| + return value_; |
| } |