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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 base::string16 GetCounterTextFromResult( | 68 base::string16 GetCounterTextFromResult( |
69 const BrowsingDataCounter::Result* result) { | 69 const BrowsingDataCounter::Result* result) { |
70 base::string16 text; | 70 base::string16 text; |
71 std::string pref_name = result->source()->GetPrefName(); | 71 std::string pref_name = result->source()->GetPrefName(); |
72 | 72 |
73 if (!result->Finished()) { | 73 if (!result->Finished()) { |
74 // The counter is still counting. | 74 // The counter is still counting. |
75 text = l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_CALCULATING); | 75 text = l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_CALCULATING); |
76 | 76 |
77 } else if (pref_name == prefs::kDeletePasswords) { | 77 } else if (pref_name == prefs::kDeletePasswords) { |
78 const PasswordsCounter::PasswordResult* password_result = | 78 const BrowsingDataCounter::SyncResult* password_result = |
79 static_cast<const PasswordsCounter::PasswordResult*>(result); | 79 static_cast<const BrowsingDataCounter::SyncResult*>(result); |
80 | 80 |
81 BrowsingDataCounter::ResultInt count = password_result->Value(); | 81 BrowsingDataCounter::ResultInt count = password_result->Value(); |
82 | 82 |
83 text = l10n_util::GetPluralStringFUTF16( | 83 text = l10n_util::GetPluralStringFUTF16( |
84 password_result->password_sync_enabled() | 84 password_result->is_sync_enabled() ? IDS_DEL_PASSWORDS_COUNTER_SYNCED |
85 ? IDS_DEL_PASSWORDS_COUNTER_SYNCED | 85 : IDS_DEL_PASSWORDS_COUNTER, |
86 : IDS_DEL_PASSWORDS_COUNTER, | |
87 count); | 86 count); |
88 } else if (pref_name == prefs::kDeleteDownloadHistory) { | 87 } else if (pref_name == prefs::kDeleteDownloadHistory) { |
89 BrowsingDataCounter::ResultInt count = | 88 BrowsingDataCounter::ResultInt count = |
90 static_cast<const BrowsingDataCounter::FinishedResult*>(result) | 89 static_cast<const BrowsingDataCounter::FinishedResult*>(result) |
91 ->Value(); | 90 ->Value(); |
92 text = l10n_util::GetPluralStringFUTF16(IDS_DEL_DOWNLOADS_COUNTER, count); | 91 text = l10n_util::GetPluralStringFUTF16(IDS_DEL_DOWNLOADS_COUNTER, count); |
93 } else if (pref_name == prefs::kDeleteSiteSettings) { | 92 } else if (pref_name == prefs::kDeleteSiteSettings) { |
94 BrowsingDataCounter::ResultInt count = | 93 BrowsingDataCounter::ResultInt count = |
95 static_cast<const BrowsingDataCounter::FinishedResult*>(result) | 94 static_cast<const BrowsingDataCounter::FinishedResult*>(result) |
96 ->Value(); | 95 ->Value(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 break; | 143 break; |
145 case 2: | 144 case 2: |
146 displayed_strings.push_back(l10n_util::GetPluralStringFUTF16( | 145 displayed_strings.push_back(l10n_util::GetPluralStringFUTF16( |
147 IDS_DEL_AUTOFILL_COUNTER_SUGGESTIONS_SHORT, num_suggestions)); | 146 IDS_DEL_AUTOFILL_COUNTER_SUGGESTIONS_SHORT, num_suggestions)); |
148 break; | 147 break; |
149 default: | 148 default: |
150 NOTREACHED(); | 149 NOTREACHED(); |
151 } | 150 } |
152 } | 151 } |
153 | 152 |
154 bool synced = autofill_result->autofill_sync_enabled(); | 153 bool synced = autofill_result->is_sync_enabled(); |
155 | 154 |
156 // Construct the resulting string from the sections in |displayed_strings|. | 155 // Construct the resulting string from the sections in |displayed_strings|. |
157 switch (displayed_strings.size()) { | 156 switch (displayed_strings.size()) { |
158 case 0: | 157 case 0: |
159 text = l10n_util::GetStringUTF16(IDS_DEL_AUTOFILL_COUNTER_EMPTY); | 158 text = l10n_util::GetStringUTF16(IDS_DEL_AUTOFILL_COUNTER_EMPTY); |
160 break; | 159 break; |
161 case 1: | 160 case 1: |
162 text = synced ? l10n_util::GetStringFUTF16( | 161 text = synced ? l10n_util::GetStringFUTF16( |
163 IDS_DEL_AUTOFILL_COUNTER_ONE_TYPE_SYNCED, | 162 IDS_DEL_AUTOFILL_COUNTER_ONE_TYPE_SYNCED, |
164 displayed_strings[0]) | 163 displayed_strings[0]) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 prefs->GetBoolean(prefs::kDeleteCache)); | 251 prefs->GetBoolean(prefs::kDeleteCache)); |
253 prefs->SetBoolean(prefs::kDeleteCookiesBasic, | 252 prefs->SetBoolean(prefs::kDeleteCookiesBasic, |
254 prefs->GetBoolean(prefs::kDeleteCookies)); | 253 prefs->GetBoolean(prefs::kDeleteCookies)); |
255 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, | 254 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, |
256 prefs->GetInteger(prefs::kDeleteTimePeriod)); | 255 prefs->GetInteger(prefs::kDeleteTimePeriod)); |
257 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); | 256 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); |
258 } | 257 } |
259 } | 258 } |
260 | 259 |
261 } // namespace browsing_data | 260 } // namespace browsing_data |
OLD | NEW |