Index: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc |
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc |
index ea235fab38ea5438c83fe98b847a90568b04d54d..c4a0e385824bce63eada6aac321e5e99b961e7a3 100644 |
--- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc |
+++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc |
@@ -10,16 +10,10 @@ |
#include "base/memory/ptr_util.h" |
#include "base/metrics/histogram_macros.h" |
#include "base/metrics/sparse_histogram.h" |
-#include "chrome/browser/browsing_data/autofill_counter.h" |
+#include "chrome/browser/browsing_data/browsing_data_counter_factory.h" |
#include "chrome/browser/browsing_data/browsing_data_counter_utils.h" |
#include "chrome/browser/browsing_data/browsing_data_helper.h" |
#include "chrome/browser/browsing_data/browsing_data_remover_factory.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/hosted_apps_counter.h" |
-#include "chrome/browser/browsing_data/media_licenses_counter.h" |
-#include "chrome/browser/browsing_data/passwords_counter.h" |
#include "chrome/browser/history/web_history_service_factory.h" |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/common/channel_info.h" |
@@ -33,7 +27,17 @@ namespace { |
const int kMaxTimesHistoryNoticeShown = 1; |
-} |
+const char* kCounterPrefs[] = { |
+ prefs::kDeleteBrowsingHistory, |
+ prefs::kDeleteCache, |
+ prefs::kDeleteDownloadHistory, |
+ prefs::kDeleteFormData, |
+ prefs::kDeleteHostedAppsData, |
+ prefs::kDeleteMediaLicenses, |
+ prefs::kDeletePasswords, |
+}; |
+ |
+} // namespace |
namespace settings { |
@@ -215,14 +219,11 @@ void ClearBrowsingDataHandler::OnBrowsingHistoryPrefChanged() { |
void ClearBrowsingDataHandler::HandleInitialize(const base::ListValue* args) { |
AllowJavascript(); |
- // TODO(msramek): Simplify this using a factory. |
- AddCounter(base::WrapUnique(new AutofillCounter(profile_))); |
- AddCounter(base::WrapUnique(new CacheCounter(profile_))); |
- AddCounter(base::WrapUnique(new DownloadsCounter(profile_))); |
- AddCounter(base::WrapUnique(new HistoryCounter(profile_))); |
- AddCounter(base::WrapUnique(new HostedAppsCounter(profile_))); |
- AddCounter(base::WrapUnique(new PasswordsCounter(profile_))); |
- AddCounter(base::WrapUnique(new MediaLicensesCounter(profile_))); |
+ // TODO(msramek): Get the list of deletion preferences from the JS side. |
msramek
2016/07/07 16:49:05
nit: This TODO now belongs to the list of prefs :)
ioanap
2016/07/08 15:32:43
Done.
|
+ for (const std::string& pref : kCounterPrefs) { |
+ AddCounter( |
+ BrowsingDataCounterFactory::GetForProfileAndPref(profile_, pref)); |
+ } |
OnStateChanged(); |
RefreshHistoryNotice(); |