Chromium Code Reviews| 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..5f300f0d9257fad7d7b1f23895237a6e5ab37b91 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 IsCookieCounterEnabled() { |
| +#if defined(OS_ANDROID) |
| + // Only use the cookie 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,16 @@ base::string16 GetChromeCounterTextFromResult( |
| return l10n_util::GetStringUTF16(IDS_DEL_CACHE_COUNTER_ALMOST_EMPTY); |
| } |
| + if (pref_name == browsing_data::prefs::kDeleteCookies) { |
| + // Cookie counter. |
|
msramek
2017/03/06 09:40:57
DCHECK(IsCookieCounterEnabled())
dullweber
2017/03/06 10:44:53
Done.
|
| + 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); |