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 "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_license_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 bool AreCountersEnabled() { | 21 bool AreCountersEnabled() { |
20 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 22 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 break; | 153 break; |
152 case 3: | 154 case 3: |
153 text = l10n_util::GetStringFUTF16(IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES, | 155 text = l10n_util::GetStringFUTF16(IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES, |
154 displayed_strings[0], | 156 displayed_strings[0], |
155 displayed_strings[1], | 157 displayed_strings[1], |
156 displayed_strings[2]); | 158 displayed_strings[2]); |
157 break; | 159 break; |
158 default: | 160 default: |
159 NOTREACHED(); | 161 NOTREACHED(); |
160 } | 162 } |
| 163 } else if (pref_name == prefs::kDeleteMediaLicenses) { |
| 164 const MediaLicenseCounter::MediaLicenseResult* media_license_result = |
| 165 static_cast<const MediaLicenseCounter::MediaLicenseResult*>(result); |
| 166 text = (media_license_result->Value() > 0) |
| 167 ? l10n_util::GetStringFUTF16( |
| 168 IDS_DEL_CONTENT_LICENSES_SITE_COMMENT, |
| 169 base::UTF8ToUTF16(media_license_result->GetOneOrigin())) |
| 170 : l10n_util::GetStringUTF16( |
| 171 IDS_DEL_CONTENT_LICENSES_GENERAL_COMMENT); |
161 } | 172 } |
162 | 173 |
163 return text; | 174 return text; |
164 } | 175 } |
165 | 176 |
166 bool GetDeletionPreferenceFromDataType( | 177 bool GetDeletionPreferenceFromDataType( |
167 BrowsingDataType data_type, std::string* out_pref) { | 178 BrowsingDataType data_type, std::string* out_pref) { |
168 switch (data_type) { | 179 switch (data_type) { |
169 case HISTORY: | 180 case HISTORY: |
170 *out_pref = prefs::kDeleteBrowsingHistory; | 181 *out_pref = prefs::kDeleteBrowsingHistory; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return new HistoryCounter(); | 213 return new HistoryCounter(); |
203 if (pref_name == prefs::kDeleteCache) | 214 if (pref_name == prefs::kDeleteCache) |
204 return new CacheCounter(); | 215 return new CacheCounter(); |
205 if (pref_name == prefs::kDeletePasswords) | 216 if (pref_name == prefs::kDeletePasswords) |
206 return new PasswordsCounter(); | 217 return new PasswordsCounter(); |
207 if (pref_name == prefs::kDeleteFormData) | 218 if (pref_name == prefs::kDeleteFormData) |
208 return new AutofillCounter(); | 219 return new AutofillCounter(); |
209 | 220 |
210 return nullptr; | 221 return nullptr; |
211 } | 222 } |
OLD | NEW |