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

Unified 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: Fixed Android code and 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/browsing_data_counter_factory.cc
diff --git a/chrome/browser/browsing_data/browsing_data_counter_factory.cc b/chrome/browser/browsing_data/browsing_data_counter_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d464b31af4f53d0632378c2bef2e8e9558d615bb
--- /dev/null
+++ b/chrome/browser/browsing_data/browsing_data_counter_factory.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/browsing_data/browsing_data_counter_factory.h"
+
+#include "chrome/browser/browsing_data/autofill_counter.h"
+#include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
+#include "chrome/browser/browsing_data/cache_counter.h"
+#include "chrome/browser/browsing_data/downloads_counter.h"
+#include "chrome/browser/browsing_data/history_counter.h"
+#include "chrome/browser/browsing_data/media_licenses_counter.h"
+#include "chrome/browser/browsing_data/passwords_counter.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
+#include "components/browsing_data/counters/browsing_data_counter.h"
+
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/browser/browsing_data/hosted_apps_counter.h"
+#endif
+
+// static
+browsing_data::BrowsingDataCounter*
msramek 2016/07/07 11:55:32 We should return a unique_ptr<>, not a naked point
ioanap 2016/07/07 16:30:48 Done.
+BrowsingDataCounterFactory::GetForPreference(std::string pref_name,
+ Profile* profile) {
+ if (!AreCountersEnabled())
+ return nullptr;
+
+ if (pref_name == prefs::kDeleteBrowsingHistory)
+ return new HistoryCounter(profile);
+ if (pref_name == prefs::kDeleteCache)
+ return new CacheCounter(profile);
+ if (pref_name == prefs::kDeletePasswords)
+ return new PasswordsCounter(profile);
+ if (pref_name == prefs::kDeleteFormData)
+ return new AutofillCounter(profile);
+ if (pref_name == prefs::kDeleteDownloadHistory)
+ return new DownloadsCounter(profile);
+ if (pref_name == prefs::kDeleteMediaLicenses)
+ return new MediaLicensesCounter(profile);
+#if defined(ENABLE_EXTENSIONS)
+ if (pref_name == prefs::kDeleteHostedAppsData)
+ return new HostedAppsCounter(profile);
+#endif
+
+ return nullptr;
+}

Powered by Google App Engine
This is Rietveld 408576698