OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/browsing_data/core/browsing_data_utils.h" | 5 #include "components/browsing_data/core/browsing_data_utils.h" |
6 | 6 |
7 #include "base/metrics/user_metrics.h" | 7 #include "base/metrics/user_metrics.h" |
8 #include "components/browsing_data/core/counters/autofill_counter.h" | 8 #include "components/browsing_data/core/counters/autofill_counter.h" |
9 #include "components/browsing_data/core/counters/history_counter.h" | 9 #include "components/browsing_data/core/counters/history_counter.h" |
10 #include "components/browsing_data/core/counters/passwords_counter.h" | 10 #include "components/browsing_data/core/counters/passwords_counter.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Counters with trivially formatted result: passwords and downloads. | 79 // Counters with trivially formatted result: passwords and downloads. |
80 browsing_data::BrowsingDataCounter::ResultInt count = | 80 browsing_data::BrowsingDataCounter::ResultInt count = |
81 static_cast<const browsing_data::BrowsingDataCounter::FinishedResult*>( | 81 static_cast<const browsing_data::BrowsingDataCounter::FinishedResult*>( |
82 result) | 82 result) |
83 ->Value(); | 83 ->Value(); |
84 text = l10n_util::GetPluralStringFUTF16( | 84 text = l10n_util::GetPluralStringFUTF16( |
85 pref_name == browsing_data::prefs::kDeletePasswords | 85 pref_name == browsing_data::prefs::kDeletePasswords |
86 ? IDS_DEL_PASSWORDS_COUNTER | 86 ? IDS_DEL_PASSWORDS_COUNTER |
87 : IDS_DEL_DOWNLOADS_COUNTER, | 87 : IDS_DEL_DOWNLOADS_COUNTER, |
88 count); | 88 count); |
89 } else if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory || | 89 } else if (pref_name == browsing_data::prefs::kDeleteBrowsingHistoryBasic) { |
90 pref_name == browsing_data::prefs::kDeleteBrowsingHistoryBasic) { | 90 // The basic tab doesn't show history counter results. |
| 91 NOTREACHED(); |
| 92 } else if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory) { |
91 // History counter. | 93 // History counter. |
92 const browsing_data::HistoryCounter::HistoryResult* history_result = | 94 const browsing_data::HistoryCounter::HistoryResult* history_result = |
93 static_cast<const browsing_data::HistoryCounter::HistoryResult*>( | 95 static_cast<const browsing_data::HistoryCounter::HistoryResult*>( |
94 result); | 96 result); |
95 browsing_data::BrowsingDataCounter::ResultInt local_item_count = | 97 browsing_data::BrowsingDataCounter::ResultInt local_item_count = |
96 history_result->Value(); | 98 history_result->Value(); |
97 bool has_synced_visits = history_result->has_synced_visits(); | 99 bool has_synced_visits = history_result->has_synced_visits(); |
98 | |
99 text = has_synced_visits | 100 text = has_synced_visits |
100 ? l10n_util::GetPluralStringFUTF16( | 101 ? l10n_util::GetPluralStringFUTF16( |
101 IDS_DEL_BROWSING_HISTORY_COUNTER_SYNCED, local_item_count) | 102 IDS_DEL_BROWSING_HISTORY_COUNTER_SYNCED, local_item_count) |
102 : l10n_util::GetPluralStringFUTF16( | 103 : l10n_util::GetPluralStringFUTF16( |
103 IDS_DEL_BROWSING_HISTORY_COUNTER, local_item_count); | 104 IDS_DEL_BROWSING_HISTORY_COUNTER, local_item_count); |
104 | 105 |
105 } else if (pref_name == browsing_data::prefs::kDeleteFormData) { | 106 } else if (pref_name == browsing_data::prefs::kDeleteFormData) { |
106 // Autofill counter. | 107 // Autofill counter. |
107 const browsing_data::AutofillCounter::AutofillResult* autofill_result = | 108 const browsing_data::AutofillCounter::AutofillResult* autofill_result = |
108 static_cast<const browsing_data::AutofillCounter::AutofillResult*>( | 109 static_cast<const browsing_data::AutofillCounter::AutofillResult*>( |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 prefs->GetBoolean(prefs::kDeleteCache)); | 237 prefs->GetBoolean(prefs::kDeleteCache)); |
237 prefs->SetBoolean(prefs::kDeleteCookiesBasic, | 238 prefs->SetBoolean(prefs::kDeleteCookiesBasic, |
238 prefs->GetBoolean(prefs::kDeleteCookies)); | 239 prefs->GetBoolean(prefs::kDeleteCookies)); |
239 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, | 240 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, |
240 prefs->GetInteger(prefs::kDeleteTimePeriod)); | 241 prefs->GetInteger(prefs::kDeleteTimePeriod)); |
241 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); | 242 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); |
242 } | 243 } |
243 } | 244 } |
244 | 245 |
245 } // namespace browsing_data | 246 } // namespace browsing_data |
OLD | NEW |