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