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

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

Issue 2121203002: Add BrowsingDataCounterFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_bd_counters_to_components
Patch Set: Addressed comments 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/browsing_data/autofill_counter.h"
9 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
10 #include "chrome/browser/browsing_data/cache_counter.h"
11 #include "chrome/browser/browsing_data/downloads_counter.h"
12 #include "chrome/browser/browsing_data/history_counter.h"
13 #include "chrome/browser/browsing_data/media_licenses_counter.h"
14 #include "chrome/browser/browsing_data/passwords_counter.h"
15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/pref_names.h"
17 #include "components/browsing_data/counters/browsing_data_counter.h"
18
19 #if defined(ENABLE_EXTENSIONS)
20 #include "chrome/browser/browsing_data/hosted_apps_counter.h"
21 #endif
22
23 // static
24 std::unique_ptr<browsing_data::BrowsingDataCounter>
25 BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile,
26 const std::string& pref_name) {
27 if (!AreCountersEnabled())
28 return nullptr;
29
30 if (pref_name == prefs::kDeleteBrowsingHistory)
31 return base::MakeUnique<HistoryCounter>(profile);
32
33 if (pref_name == prefs::kDeleteCache)
34 return base::MakeUnique<CacheCounter>(profile);
35
36 if (pref_name == prefs::kDeletePasswords)
37 return base::MakeUnique<PasswordsCounter>(profile);
38
39 if (pref_name == prefs::kDeleteFormData)
40 return base::MakeUnique<AutofillCounter>(profile);
41
42 if (pref_name == prefs::kDeleteDownloadHistory)
43 return base::MakeUnique<DownloadsCounter>(profile);
44
45 if (pref_name == prefs::kDeleteMediaLicenses)
46 return base::MakeUnique<MediaLicensesCounter>(profile);
47
48 #if defined(ENABLE_EXTENSIONS)
49 if (pref_name == prefs::kDeleteHostedAppsData)
50 return base::MakeUnique<HostedAppsCounter>(profile);
51 #endif
52
53 return nullptr;
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698