| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" | 5 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browsing_data/cache_counter.h" | 9 #include "chrome/browser/browsing_data/cache_counter.h" |
| 10 #include "chrome/browser/browsing_data/media_licenses_counter.h" | 10 #include "chrome/browser/browsing_data/media_licenses_counter.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (cache_size_bytes >= kBytesInAMegabyte) { | 74 if (cache_size_bytes >= kBytesInAMegabyte) { |
| 75 base::string16 formatted_size = FormatBytesMBOrHigher(cache_size_bytes); | 75 base::string16 formatted_size = FormatBytesMBOrHigher(cache_size_bytes); |
| 76 return !is_upper_limit | 76 return !is_upper_limit |
| 77 ? formatted_size | 77 ? formatted_size |
| 78 : l10n_util::GetStringFUTF16( | 78 : l10n_util::GetStringFUTF16( |
| 79 IDS_DEL_CACHE_COUNTER_UPPER_ESTIMATE, formatted_size); | 79 IDS_DEL_CACHE_COUNTER_UPPER_ESTIMATE, formatted_size); |
| 80 } | 80 } |
| 81 return l10n_util::GetStringUTF16(IDS_DEL_CACHE_COUNTER_ALMOST_EMPTY); | 81 return l10n_util::GetStringUTF16(IDS_DEL_CACHE_COUNTER_ALMOST_EMPTY); |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (pref_name == browsing_data::prefs::kDeleteCookies) { |
| 85 // Cookie counter. |
| 86 browsing_data::BrowsingDataCounter::ResultInt origins = |
| 87 static_cast<const browsing_data::BrowsingDataCounter::FinishedResult*>( |
| 88 result) |
| 89 ->Value(); |
| 90 return l10n_util::GetPluralStringFUTF16(IDS_DEL_COOKIES_COUNTER, origins); |
| 91 } |
| 92 |
| 84 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) { | 93 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) { |
| 85 const MediaLicensesCounter::MediaLicenseResult* media_license_result = | 94 const MediaLicensesCounter::MediaLicenseResult* media_license_result = |
| 86 static_cast<const MediaLicensesCounter::MediaLicenseResult*>(result); | 95 static_cast<const MediaLicensesCounter::MediaLicenseResult*>(result); |
| 87 if (media_license_result->Value() > 0) { | 96 if (media_license_result->Value() > 0) { |
| 88 return l10n_util::GetStringFUTF16( | 97 return l10n_util::GetStringFUTF16( |
| 89 IDS_DEL_MEDIA_LICENSES_COUNTER_SITE_COMMENT, | 98 IDS_DEL_MEDIA_LICENSES_COUNTER_SITE_COMMENT, |
| 90 base::UTF8ToUTF16(media_license_result->GetOneOrigin())); | 99 base::UTF8ToUTF16(media_license_result->GetOneOrigin())); |
| 91 } | 100 } |
| 92 return l10n_util::GetStringUTF16( | 101 return l10n_util::GetStringUTF16( |
| 93 IDS_DEL_MEDIA_LICENSES_COUNTER_GENERAL_COMMENT); | 102 IDS_DEL_MEDIA_LICENSES_COUNTER_GENERAL_COMMENT); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return base::ReplaceStringPlaceholders( | 134 return base::ReplaceStringPlaceholders( |
| 126 l10n_util::GetPluralStringFUTF16( | 135 l10n_util::GetPluralStringFUTF16( |
| 127 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count), | 136 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count), |
| 128 replacements, | 137 replacements, |
| 129 nullptr); | 138 nullptr); |
| 130 } | 139 } |
| 131 #endif | 140 #endif |
| 132 | 141 |
| 133 return browsing_data::GetCounterTextFromResult(result); | 142 return browsing_data::GetCounterTextFromResult(result); |
| 134 } | 143 } |
| OLD | NEW |