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; |
+} |