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

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

Issue 2594723002: Count number of origins with data affected by clearing "cookies and site data". (Closed)
Patch Set: small fixes Created 3 years, 9 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_utils.cc
diff --git a/chrome/browser/browsing_data/browsing_data_counter_utils.cc b/chrome/browser/browsing_data/browsing_data_counter_utils.cc
index 568b30ef3bcfe58798ae275ce02b945d69d4b7a3..277cf067080adcba56964aac8e99ebf0caebd31a 100644
--- a/chrome/browser/browsing_data/browsing_data_counter_utils.cc
+++ b/chrome/browser/browsing_data/browsing_data_counter_utils.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browsing_data/cache_counter.h"
#include "chrome/browser/browsing_data/media_licenses_counter.h"
@@ -25,6 +26,10 @@
#include "chrome/browser/browsing_data/hosted_apps_counter.h"
#endif
+#if defined(OS_ANDROID)
+#include "chrome/browser/android/chrome_feature_list.h"
+#endif
+
bool AreCountersEnabled() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableClearBrowsingDataCounters)) {
@@ -40,6 +45,16 @@ bool AreCountersEnabled() {
return true;
}
+bool IsSiteDataCounterEnabled() {
+#if defined(OS_ANDROID)
+ // Only use the site data counter for the new CBD ui.
+ return base::FeatureList::IsEnabled(chrome::android::kTabsInCBD);
+#else
+ // Don't use the counter on other platforms that don't yet have the new ui.
+ return false;
+#endif
+}
+
// A helper function to display the size of cache in units of MB or higher.
// We need this, as 1 MB is the lowest nonzero cache size displayed by the
// counter.
@@ -82,6 +97,17 @@ base::string16 GetChromeCounterTextFromResult(
return l10n_util::GetStringUTF16(IDS_DEL_CACHE_COUNTER_ALMOST_EMPTY);
}
+ if (pref_name == browsing_data::prefs::kDeleteCookies) {
+ // Site data counter.
+ DCHECK(IsSiteDataCounterEnabled());
+ browsing_data::BrowsingDataCounter::ResultInt origins =
+ static_cast<const browsing_data::BrowsingDataCounter::FinishedResult*>(
+ result)
+ ->Value();
+ return l10n_util::GetPluralStringFUTF16(IDS_DEL_COOKIES_COUNTER_ADVANCED,
+ origins);
+ }
+
if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) {
const MediaLicensesCounter::MediaLicenseResult* media_license_result =
static_cast<const MediaLicensesCounter::MediaLicenseResult*>(result);
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_counter_utils.h ('k') | chrome/browser/browsing_data/site_data_counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698