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

Side by Side Diff: chrome/browser/browsing_data/autofill_counter.cc

Issue 2084903002: Moved BrowsingDataCounter and part of BrowsingDataCounterUtils to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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/browsing_data/autofill_counter.h" 5 #include "chrome/browser/browsing_data/autofill_counter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/web_data_service_factory.h" 13 #include "chrome/browser/web_data_service_factory.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "components/autofill/core/browser/autofill_profile.h" 15 #include "components/autofill/core/browser/autofill_profile.h"
15 #include "components/autofill/core/browser/credit_card.h" 16 #include "components/autofill/core/browser/credit_card.h"
16 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 17 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
17 18
18 AutofillCounter::AutofillCounter() : pref_name_(prefs::kDeleteFormData), 19 AutofillCounter::AutofillCounter(Profile* profile)
19 web_data_service_(nullptr), 20 : BrowsingDataCounter(prefs::kDeleteFormData),
20 suggestions_query_(0), 21 profile_(profile),
21 credit_cards_query_(0), 22 web_data_service_(nullptr),
22 addresses_query_(0), 23 suggestions_query_(0),
23 num_suggestions_(0), 24 credit_cards_query_(0),
24 num_credit_cards_(0), 25 addresses_query_(0),
25 num_addresses_(0) { 26 num_suggestions_(0),
26 } 27 num_credit_cards_(0),
28 num_addresses_(0) {}
27 29
28 AutofillCounter::~AutofillCounter() { 30 AutofillCounter::~AutofillCounter() {
29 CancelAllRequests(); 31 CancelAllRequests();
30 } 32 }
31 33
32 void AutofillCounter::OnInitialized() { 34 void AutofillCounter::OnInitialized() {
33 web_data_service_ = WebDataServiceFactory::GetAutofillWebDataForProfile( 35 web_data_service_ = WebDataServiceFactory::GetAutofillWebDataForProfile(
34 GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); 36 profile_, ServiceAccessType::EXPLICIT_ACCESS);
35 DCHECK(web_data_service_); 37 DCHECK(web_data_service_);
36 } 38 }
37 39
38 const std::string& AutofillCounter::GetPrefName() const {
39 return pref_name_;
40 }
41
42 void AutofillCounter::SetPeriodStartForTesting( 40 void AutofillCounter::SetPeriodStartForTesting(
43 const base::Time& period_start_for_testing) { 41 const base::Time& period_start_for_testing) {
44 period_start_for_testing_ = period_start_for_testing; 42 period_start_for_testing_ = period_start_for_testing;
45 } 43 }
46 44
47 void AutofillCounter::Count() { 45 void AutofillCounter::Count() {
48 const base::Time start = period_start_for_testing_.is_null() 46 const base::Time start = period_start_for_testing_.is_null()
49 ? GetPeriodStart() 47 ? GetPeriodStart()
50 : period_start_for_testing_; 48 : period_start_for_testing_;
51 49
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ResultInt num_suggestions, 162 ResultInt num_suggestions,
165 ResultInt num_credit_cards, 163 ResultInt num_credit_cards,
166 ResultInt num_addresses) 164 ResultInt num_addresses)
167 : FinishedResult(source, num_suggestions), 165 : FinishedResult(source, num_suggestions),
168 num_credit_cards_(num_credit_cards), 166 num_credit_cards_(num_credit_cards),
169 num_addresses_(num_addresses) { 167 num_addresses_(num_addresses) {
170 } 168 }
171 169
172 AutofillCounter::AutofillResult::~AutofillResult() { 170 AutofillCounter::AutofillResult::~AutofillResult() {
173 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/autofill_counter.h ('k') | chrome/browser/browsing_data/autofill_counter_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698