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

Side by Side Diff: components/browsing_data/core/counters/browsing_data_counter.cc

Issue 2623033003: Always show counters in the material design Clear Browsing Data dialog. (Closed)
Patch Set: iOS fix #2 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
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 22 matching lines...) Expand all
33 } 33 }
34 34
35 void BrowsingDataCounter::OnInitialized() {} 35 void BrowsingDataCounter::OnInitialized() {}
36 36
37 base::Time BrowsingDataCounter::GetPeriodStart() { 37 base::Time BrowsingDataCounter::GetPeriodStart() {
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
44 // If this data type was unchecked for deletion, we do not need to count it.
45 if (!pref_service_->GetBoolean(GetPrefName()))
46 return;
47
48 callback_.Run(base::MakeUnique<Result>(this)); 43 callback_.Run(base::MakeUnique<Result>(this));
49
50 Count(); 44 Count();
51 } 45 }
52 46
53 void BrowsingDataCounter::ReportResult(ResultInt value) { 47 void BrowsingDataCounter::ReportResult(ResultInt value) {
54 DCHECK(initialized_); 48 DCHECK(initialized_);
55 callback_.Run(base::MakeUnique<FinishedResult>(this, value)); 49 callback_.Run(base::MakeUnique<FinishedResult>(this, value));
56 } 50 }
57 51
58 void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) { 52 void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) {
59 DCHECK(initialized_); 53 DCHECK(initialized_);
(...skipping 27 matching lines...) Expand all
87 bool BrowsingDataCounter::FinishedResult::Finished() const { 81 bool BrowsingDataCounter::FinishedResult::Finished() const {
88 return true; 82 return true;
89 } 83 }
90 84
91 BrowsingDataCounter::ResultInt BrowsingDataCounter::FinishedResult::Value() 85 BrowsingDataCounter::ResultInt BrowsingDataCounter::FinishedResult::Value()
92 const { 86 const {
93 return value_; 87 return value_;
94 } 88 }
95 89
96 } // namespace browsing_data 90 } // namespace browsing_data
OLDNEW
« no previous file with comments | « components/browsing_data/core/counters/autofill_counter.cc ('k') | ios/chrome/browser/browsing_data/cache_counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698