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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_counter_utils.cc

Issue 2075023002: UI Changes to support clearing EME/CDM data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert options_page.css 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 unified diff | Download patch
« no previous file with comments | « chrome/app/settings_strings.grdp ('k') | chrome/browser/browsing_data/browsing_data_remover.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/browsing_data/autofill_counter.h" 9 #include "chrome/browser/browsing_data/autofill_counter.h"
9 #include "chrome/browser/browsing_data/cache_counter.h" 10 #include "chrome/browser/browsing_data/cache_counter.h"
10 #include "chrome/browser/browsing_data/history_counter.h" 11 #include "chrome/browser/browsing_data/history_counter.h"
12 #include "chrome/browser/browsing_data/media_licenses_counter.h"
11 #include "chrome/browser/browsing_data/passwords_counter.h" 13 #include "chrome/browser/browsing_data/passwords_counter.h"
12 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
14 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
15 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
16 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/text/bytes_formatting.h" 19 #include "ui/base/text/bytes_formatting.h"
18 20
19 #if defined(ENABLE_EXTENSIONS) 21 #if defined(ENABLE_EXTENSIONS)
20 #include "base/numerics/safe_conversions.h" 22 #include "base/numerics/safe_conversions.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 case 3: 165 case 3:
164 text = l10n_util::GetStringFUTF16(IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES, 166 text = l10n_util::GetStringFUTF16(IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES,
165 displayed_strings[0], 167 displayed_strings[0],
166 displayed_strings[1], 168 displayed_strings[1],
167 displayed_strings[2]); 169 displayed_strings[2]);
168 break; 170 break;
169 default: 171 default:
170 NOTREACHED(); 172 NOTREACHED();
171 } 173 }
172 174
175 } else if (pref_name == prefs::kDeleteMediaLicenses) {
176 const MediaLicensesCounter::MediaLicenseResult* media_license_result =
177 static_cast<const MediaLicensesCounter::MediaLicenseResult*>(result);
178 if (media_license_result->Value() > 0) {
179 text = l10n_util::GetStringFUTF16(
180 IDS_DEL_MEDIA_LICENSES_COUNTER_SITE_COMMENT,
181 base::UTF8ToUTF16(media_license_result->GetOneOrigin()));
182 } else {
183 text = l10n_util::GetStringUTF16(
184 IDS_DEL_MEDIA_LICENSES_COUNTER_GENERAL_COMMENT);
185 }
186
173 #if defined(ENABLE_EXTENSIONS) 187 #if defined(ENABLE_EXTENSIONS)
174 } else if (pref_name == prefs::kDeleteHostedAppsData) { 188 } else if (pref_name == prefs::kDeleteHostedAppsData) {
175 // Hosted apps counter. 189 // Hosted apps counter.
176 const HostedAppsCounter::HostedAppsResult* hosted_apps_result = 190 const HostedAppsCounter::HostedAppsResult* hosted_apps_result =
177 static_cast<const HostedAppsCounter::HostedAppsResult*>(result); 191 static_cast<const HostedAppsCounter::HostedAppsResult*>(result);
178 int hosted_apps_count = hosted_apps_result->Value(); 192 int hosted_apps_count = hosted_apps_result->Value();
179 193
180 DCHECK_GE(hosted_apps_result->Value(), 194 DCHECK_GE(hosted_apps_result->Value(),
181 base::checked_cast<BrowsingDataCounter::ResultInt>( 195 base::checked_cast<BrowsingDataCounter::ResultInt>(
182 hosted_apps_result->examples().size())); 196 hosted_apps_result->examples().size()));
(...skipping 15 matching lines...) Expand all
198 212
199 // The output string has both the number placeholder (#) and substitution 213 // The output string has both the number placeholder (#) and substitution
200 // placeholders ($1, $2, $3). First fetch the correct plural string first, 214 // placeholders ($1, $2, $3). First fetch the correct plural string first,
201 // then substitute the $ placeholders. 215 // then substitute the $ placeholders.
202 text = base::ReplaceStringPlaceholders( 216 text = base::ReplaceStringPlaceholders(
203 l10n_util::GetPluralStringFUTF16( 217 l10n_util::GetPluralStringFUTF16(
204 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count), 218 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count),
205 replacements, 219 replacements,
206 nullptr); 220 nullptr);
207 #endif 221 #endif
208
209 } 222 }
210 223
211 return text; 224 return text;
212 } 225 }
213 226
214 bool GetDeletionPreferenceFromDataType( 227 bool GetDeletionPreferenceFromDataType(
215 BrowsingDataType data_type, std::string* out_pref) { 228 BrowsingDataType data_type, std::string* out_pref) {
216 switch (data_type) { 229 switch (data_type) {
217 case HISTORY: 230 case HISTORY:
218 *out_pref = prefs::kDeleteBrowsingHistory; 231 *out_pref = prefs::kDeleteBrowsingHistory;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return new HistoryCounter(); 263 return new HistoryCounter();
251 if (pref_name == prefs::kDeleteCache) 264 if (pref_name == prefs::kDeleteCache)
252 return new CacheCounter(); 265 return new CacheCounter();
253 if (pref_name == prefs::kDeletePasswords) 266 if (pref_name == prefs::kDeletePasswords)
254 return new PasswordsCounter(); 267 return new PasswordsCounter();
255 if (pref_name == prefs::kDeleteFormData) 268 if (pref_name == prefs::kDeleteFormData)
256 return new AutofillCounter(); 269 return new AutofillCounter();
257 270
258 return nullptr; 271 return nullptr;
259 } 272 }
OLDNEW
« no previous file with comments | « chrome/app/settings_strings.grdp ('k') | chrome/browser/browsing_data/browsing_data_remover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698