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

Unified Diff: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.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 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
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698