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

Unified Diff: chrome/browser/browsing_data/browsing_data_counter_factory.cc

Issue 2153863002: Move counters for passwords, history and autofill to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@separate_build_targets_in_components_bd
Patch Set: Fixed dependencies 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
index 020a70d3acd10e931bd8ad2ed6ad3fc27b7b0e73..f0ee9d9947835aa6eea71e70b38f67698e457b3e 100644
--- a/chrome/browser/browsing_data/browsing_data_counter_factory.cc
+++ b/chrome/browser/browsing_data/browsing_data_counter_factory.cc
@@ -4,17 +4,26 @@
#include "chrome/browser/browsing_data/browsing_data_counter_factory.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/memory/ptr_util.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/history/history_service_factory.h"
+#include "chrome/browser/history/web_history_service_factory.h"
+#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/web_data_service_factory.h"
+#include "components/browsing_data/core/counters/autofill_counter.h"
#include "components/browsing_data/core/counters/browsing_data_counter.h"
+#include "components/browsing_data/core/counters/history_counter.h"
+#include "components/browsing_data/core/counters/passwords_counter.h"
#include "components/browsing_data/core/pref_names.h"
+#include "components/history/core/browser/web_history_service.h"
+#include "components/password_manager/core/browser/password_store.h"
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/browsing_data/hosted_apps_counter.h"
@@ -27,17 +36,29 @@ BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile,
if (!AreCountersEnabled())
return nullptr;
- if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory)
- return base::MakeUnique<HistoryCounter>(profile);
+ if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory) {
+ return base::MakeUnique<browsing_data::HistoryCounter>(
+ ProfileSyncServiceFactory::GetForProfile(profile),
+ base::Bind(&BrowsingDataCounterFactory::GetUpdatedWebHistoryService,
+ base::Unretained(profile)),
+ HistoryServiceFactory::GetForProfile(
+ profile, ServiceAccessType::EXPLICIT_ACCESS));
+ }
if (pref_name == browsing_data::prefs::kDeleteCache)
return base::MakeUnique<CacheCounter>(profile);
- if (pref_name == browsing_data::prefs::kDeletePasswords)
- return base::MakeUnique<PasswordsCounter>(profile);
+ if (pref_name == browsing_data::prefs::kDeletePasswords) {
+ return base::MakeUnique<browsing_data::PasswordsCounter>(
+ PasswordStoreFactory::GetForProfile(
+ profile, ServiceAccessType::EXPLICIT_ACCESS));
+ }
- if (pref_name == browsing_data::prefs::kDeleteFormData)
- return base::MakeUnique<AutofillCounter>(profile);
+ if (pref_name == browsing_data::prefs::kDeleteFormData) {
+ return base::MakeUnique<browsing_data::AutofillCounter>(
+ WebDataServiceFactory::GetAutofillWebDataForProfile(
+ profile, ServiceAccessType::EXPLICIT_ACCESS));
+ }
if (pref_name == browsing_data::prefs::kDeleteDownloadHistory)
return base::MakeUnique<DownloadsCounter>(profile);
@@ -52,3 +73,9 @@ BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile,
return nullptr;
}
+
+// static
+history::WebHistoryService*
msramek 2016/07/20 13:41:16 Can we move this to an anonymous namespace?
ioanap 2016/07/20 17:50:36 Done.
+BrowsingDataCounterFactory::GetUpdatedWebHistoryService(Profile* profile) {
+ return WebHistoryServiceFactory::GetForProfile(profile);
+}

Powered by Google App Engine
This is Rietveld 408576698