Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: components/browsing_data/core/browsing_data_utils.cc

Issue 2816723002: Add "Site Settings" option to Clear Browsing Data on Android (Closed)
Patch Set: fix deps Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 text = l10n_util::GetPluralStringFUTF16( 83 text = l10n_util::GetPluralStringFUTF16(
84 password_result->password_sync_enabled() 84 password_result->password_sync_enabled()
85 ? IDS_DEL_PASSWORDS_COUNTER_SYNCED 85 ? IDS_DEL_PASSWORDS_COUNTER_SYNCED
86 : IDS_DEL_PASSWORDS_COUNTER, 86 : IDS_DEL_PASSWORDS_COUNTER,
87 count); 87 count);
88 } else if (pref_name == prefs::kDeleteDownloadHistory) { 88 } else if (pref_name == prefs::kDeleteDownloadHistory) {
89 BrowsingDataCounter::ResultInt count = 89 BrowsingDataCounter::ResultInt count =
90 static_cast<const BrowsingDataCounter::FinishedResult*>(result) 90 static_cast<const BrowsingDataCounter::FinishedResult*>(result)
91 ->Value(); 91 ->Value();
92 text = l10n_util::GetPluralStringFUTF16(IDS_DEL_DOWNLOADS_COUNTER, count); 92 text = l10n_util::GetPluralStringFUTF16(IDS_DEL_DOWNLOADS_COUNTER, count);
93 } else if (pref_name == prefs::kDeleteSiteSettings) {
94 BrowsingDataCounter::ResultInt count =
95 static_cast<const BrowsingDataCounter::FinishedResult*>(result)
96 ->Value();
97 text =
98 l10n_util::GetPluralStringFUTF16(IDS_DEL_SITE_SETTINGS_COUNTER, count);
93 } else if (pref_name == prefs::kDeleteBrowsingHistoryBasic) { 99 } else if (pref_name == prefs::kDeleteBrowsingHistoryBasic) {
94 // The basic tab doesn't show history counter results. 100 // The basic tab doesn't show history counter results.
95 NOTREACHED(); 101 NOTREACHED();
96 } else if (pref_name == prefs::kDeleteBrowsingHistory) { 102 } else if (pref_name == prefs::kDeleteBrowsingHistory) {
97 // History counter. 103 // History counter.
98 const HistoryCounter::HistoryResult* history_result = 104 const HistoryCounter::HistoryResult* history_result =
99 static_cast<const HistoryCounter::HistoryResult*>(result); 105 static_cast<const HistoryCounter::HistoryResult*>(result);
100 BrowsingDataCounter::ResultInt local_item_count = history_result->Value(); 106 BrowsingDataCounter::ResultInt local_item_count = history_result->Value();
101 bool has_synced_visits = history_result->has_synced_visits(); 107 bool has_synced_visits = history_result->has_synced_visits();
102 text = has_synced_visits 108 text = has_synced_visits
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 case BrowsingDataType::PASSWORDS: 225 case BrowsingDataType::PASSWORDS:
220 *out_pref = prefs::kDeletePasswords; 226 *out_pref = prefs::kDeletePasswords;
221 return true; 227 return true;
222 case BrowsingDataType::FORM_DATA: 228 case BrowsingDataType::FORM_DATA:
223 *out_pref = prefs::kDeleteFormData; 229 *out_pref = prefs::kDeleteFormData;
224 return true; 230 return true;
225 case BrowsingDataType::BOOKMARKS: 231 case BrowsingDataType::BOOKMARKS:
226 // Bookmarks are deleted on the Android side. No corresponding deletion 232 // Bookmarks are deleted on the Android side. No corresponding deletion
227 // preference. 233 // preference.
228 return false; 234 return false;
235 case BrowsingDataType::SITE_SETTINGS:
236 *out_pref = prefs::kDeleteSiteSettings;
237 return true;
229 case BrowsingDataType::NUM_TYPES: 238 case BrowsingDataType::NUM_TYPES:
230 // This is not an actual type. 239 // This is not an actual type.
231 NOTREACHED(); 240 NOTREACHED();
232 return false; 241 return false;
233 } 242 }
234 NOTREACHED(); 243 NOTREACHED();
235 return false; 244 return false;
236 } 245 }
237 246
238 void MigratePreferencesToBasic(PrefService* prefs) { 247 void MigratePreferencesToBasic(PrefService* prefs) {
239 if (!prefs->GetBoolean(prefs::kPreferencesMigratedToBasic)) { 248 if (!prefs->GetBoolean(prefs::kPreferencesMigratedToBasic)) {
240 prefs->SetBoolean(prefs::kDeleteBrowsingHistoryBasic, 249 prefs->SetBoolean(prefs::kDeleteBrowsingHistoryBasic,
241 prefs->GetBoolean(prefs::kDeleteBrowsingHistory)); 250 prefs->GetBoolean(prefs::kDeleteBrowsingHistory));
242 prefs->SetBoolean(prefs::kDeleteCacheBasic, 251 prefs->SetBoolean(prefs::kDeleteCacheBasic,
243 prefs->GetBoolean(prefs::kDeleteCache)); 252 prefs->GetBoolean(prefs::kDeleteCache));
244 prefs->SetBoolean(prefs::kDeleteCookiesBasic, 253 prefs->SetBoolean(prefs::kDeleteCookiesBasic,
245 prefs->GetBoolean(prefs::kDeleteCookies)); 254 prefs->GetBoolean(prefs::kDeleteCookies));
246 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, 255 prefs->SetInteger(prefs::kDeleteTimePeriodBasic,
247 prefs->GetInteger(prefs::kDeleteTimePeriod)); 256 prefs->GetInteger(prefs::kDeleteTimePeriod));
248 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); 257 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true);
249 } 258 }
250 } 259 }
251 260
252 } // namespace browsing_data 261 } // namespace browsing_data
OLDNEW
« no previous file with comments | « components/browsing_data/core/browsing_data_utils.h ('k') | components/browsing_data/core/counters/site_settings_counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698