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_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 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 |
| 164 } else if (pref_name == prefs::kDeleteMediaLicenses) { |
| 165 const MediaLicenseCounter::MediaLicenseResult* media_license_result = |
| 166 static_cast<const MediaLicenseCounter::MediaLicenseResult*>(result); |
| 167 if (media_license_result->Value() > 0) { |
| 168 text = l10n_util::GetStringFUTF16( |
| 169 IDS_DEL_MEDIA_LICENSES_SITE_COMMENT, |
| 170 base::UTF8ToUTF16(media_license_result->GetOneOrigin())); |
| 171 } else { |
| 172 text = l10n_util::GetStringUTF16(IDS_DEL_MEDIA_LICENSES_GENERAL_COMMENT); |
| 173 } |
161 } | 174 } |
162 | 175 |
163 return text; | 176 return text; |
164 } | 177 } |
165 | 178 |
166 bool GetDeletionPreferenceFromDataType( | 179 bool GetDeletionPreferenceFromDataType( |
167 BrowsingDataType data_type, std::string* out_pref) { | 180 BrowsingDataType data_type, std::string* out_pref) { |
168 switch (data_type) { | 181 switch (data_type) { |
169 case HISTORY: | 182 case HISTORY: |
170 *out_pref = prefs::kDeleteBrowsingHistory; | 183 *out_pref = prefs::kDeleteBrowsingHistory; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return new HistoryCounter(); | 215 return new HistoryCounter(); |
203 if (pref_name == prefs::kDeleteCache) | 216 if (pref_name == prefs::kDeleteCache) |
204 return new CacheCounter(); | 217 return new CacheCounter(); |
205 if (pref_name == prefs::kDeletePasswords) | 218 if (pref_name == prefs::kDeletePasswords) |
206 return new PasswordsCounter(); | 219 return new PasswordsCounter(); |
207 if (pref_name == prefs::kDeleteFormData) | 220 if (pref_name == prefs::kDeleteFormData) |
208 return new AutofillCounter(); | 221 return new AutofillCounter(); |
209 | 222 |
210 return nullptr; | 223 return nullptr; |
211 } | 224 } |
OLD | NEW |