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

Unified Diff: chrome/browser/ui/webui/options/clear_browser_data_handler.cc

Issue 2084903002: Moved BrowsingDataCounter and part of BrowsingDataCounterUtils to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed deps Created 4 years, 6 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/ui/webui/options/clear_browser_data_handler.cc
diff --git a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
index b4b15d3b832a48a855e054908db8a10fa38ea8b9..134abe1dde5d520f01c93a18369cef3a244936aa 100644
--- a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
+++ b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
@@ -22,7 +22,6 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/autofill_counter.h"
-#include "chrome/browser/browsing_data/browsing_data_counter.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.h"
@@ -39,6 +38,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
+#include "components/browsing_data/counters/browsing_data_counter.h"
#include "components/browsing_data_ui/history_notice_utils.h"
#include "components/google/core/browser/google_util.h"
#include "components/prefs/pref_service.h"
@@ -92,13 +92,13 @@ void ClearBrowserDataHandler::InitializeHandler() {
base::Unretained(this)));
if (AreCountersEnabled()) {
- AddCounter(base::WrapUnique(new PasswordsCounter()));
- AddCounter(base::WrapUnique(new HistoryCounter()));
- AddCounter(base::WrapUnique(new CacheCounter()));
- AddCounter(base::WrapUnique(new AutofillCounter()));
+ Profile* profile = Profile::FromWebUI(web_ui());
+ AddCounter(base::WrapUnique(new PasswordsCounter(profile)));
+ AddCounter(base::WrapUnique(new HistoryCounter(profile)));
+ AddCounter(base::WrapUnique(new CacheCounter(profile)));
+ AddCounter(base::WrapUnique(new AutofillCounter(profile)));
- sync_service_ =
- ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
+ sync_service_ = ProfileSyncServiceFactory::GetForProfile(profile);
if (sync_service_)
sync_service_->AddObserver(this);
}
@@ -317,10 +317,8 @@ void ClearBrowserDataHandler::HandleClearBrowserData(
remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(profile);
remover_->AddObserver(this);
int period_selected = prefs->GetInteger(prefs::kDeleteTimePeriod);
- remover_->Remove(
- BrowsingDataRemover::Period(
- static_cast<BrowsingDataRemover::TimePeriod>(period_selected)),
- remove_mask, origin_mask);
+ remover_->Remove(Period(static_cast<TimePeriod>(period_selected)),
+ remove_mask, origin_mask);
// Store the clear browsing data time. Next time the clear browsing data
// dialog is open, this time is used to decide whether to display an info
@@ -370,10 +368,10 @@ void ClearBrowserDataHandler::AddCounter(
std::unique_ptr<BrowsingDataCounter> counter) {
DCHECK(AreCountersEnabled());
- counter->Init(
- Profile::FromWebUI(web_ui()),
- base::Bind(&ClearBrowserDataHandler::UpdateCounterText,
- base::Unretained(this)));
+ counter->Init(Profile::FromWebUI(web_ui())->GetPrefs(),
+ prefs::kDeleteTimePeriod,
+ base::Bind(&ClearBrowserDataHandler::UpdateCounterText,
+ base::Unretained(this)));
counters_.push_back(std::move(counter));
}

Powered by Google App Engine
This is Rietveld 408576698