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

Side by Side Diff: chrome/browser/profiles/profile_statistics.cc

Issue 2915053002: Replace profile statistics preference count with AutofillCounter (Closed)
Patch Set: change to SetBooleanWithoutPathExpansion Created 3 years, 6 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 "chrome/browser/profiles/profile_statistics.h" 5 #include "chrome/browser/profiles/profile_statistics.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_attributes_entry.h"
12 #include "chrome/browser/profiles/profile_attributes_storage.h"
13 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profile_statistics_aggregator.h" 12 #include "chrome/browser/profiles/profile_statistics_aggregator.h"
15 13
16 ProfileStatistics::ProfileStatistics(Profile* profile) 14 ProfileStatistics::ProfileStatistics(Profile* profile)
17 : profile_(profile), aggregator_(nullptr), weak_ptr_factory_(this) { 15 : profile_(profile), aggregator_(nullptr), weak_ptr_factory_(this) {
18 } 16 }
19 17
20 ProfileStatistics::~ProfileStatistics() { 18 ProfileStatistics::~ProfileStatistics() {
21 } 19 }
22 20
23 void ProfileStatistics::GatherStatistics( 21 void ProfileStatistics::GatherStatistics(
24 const profiles::ProfileStatisticsCallback& callback) { 22 const profiles::ProfileStatisticsCallback& callback) {
25 // IsValidProfile() can be false in unit tests. 23 // IsValidProfile() can be false in unit tests.
26 if (!g_browser_process->profile_manager()->IsValidProfile(profile_)) 24 if (!g_browser_process->profile_manager()->IsValidProfile(profile_))
27 return; 25 return;
28 DCHECK(!profile_->IsOffTheRecord() && !profile_->IsSystemProfile()); 26 DCHECK(!profile_->IsOffTheRecord() && !profile_->IsSystemProfile());
29 27
30 if (!aggregator_) { 28 if (!aggregator_) {
31 aggregator_ = new ProfileStatisticsAggregator( 29 aggregator_ = base::MakeUnique<ProfileStatisticsAggregator>(
32 profile_, base::Bind(&ProfileStatistics::DeregisterAggregator, 30 profile_, base::Bind(&ProfileStatistics::DeregisterAggregator,
33 weak_ptr_factory_.GetWeakPtr())); 31 weak_ptr_factory_.GetWeakPtr()));
34 } 32 }
35 aggregator_->AddCallbackAndStartAggregator(callback); 33 aggregator_->AddCallbackAndStartAggregator(callback);
36 } 34 }
37 35
38 void ProfileStatistics::DeregisterAggregator() { 36 void ProfileStatistics::DeregisterAggregator() {
39 aggregator_ = nullptr; 37 aggregator_ = nullptr;
40 } 38 }
41 39
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_statistics.h ('k') | chrome/browser/profiles/profile_statistics_aggregator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698