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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_counter_utils.cc

Issue 1530123002: Prepare ClearBrowsingDataDialogFragment for browsing data counters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@utils
Patch Set: s/default/NUM_TYPES/ Created 4 years, 11 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
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_counter_utils.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/browsing_data/autofill_counter.h" 9 #include "chrome/browser/browsing_data/autofill_counter.h"
10 #include "chrome/browser/browsing_data/cache_counter.h" 10 #include "chrome/browser/browsing_data/cache_counter.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 displayed_strings[2]); 161 displayed_strings[2]);
162 break; 162 break;
163 default: 163 default:
164 NOTREACHED(); 164 NOTREACHED();
165 } 165 }
166 } 166 }
167 167
168 return text; 168 return text;
169 } 169 }
170 170
171 bool GetDeletionPreferenceFromDataType(
172 BrowsingDataType data_type, std::string* out_pref) {
173 switch (data_type) {
174 case HISTORY:
175 *out_pref = prefs::kDeleteBrowsingHistory;
176 return true;
177 case CACHE:
178 *out_pref = prefs::kDeleteCache;
179 return true;
180 case COOKIES:
181 *out_pref = prefs::kDeleteCookies;
182 return true;
183 case PASSWORDS:
184 *out_pref = prefs::kDeletePasswords;
185 return true;
186 case FORM_DATA:
187 *out_pref = prefs::kDeleteFormData;
188 return true;
189 case BOOKMARKS:
190 // Bookmarks are deleted on the Android side. No corresponding deletion
191 // preference.
192 return false;
193 case NUM_TYPES:
194 // This is not an actual type.
195 NOTREACHED();
196 return false;
197 }
198 NOTREACHED();
199 return false;
200 }
201
171 BrowsingDataCounter* CreateCounterForPreference(std::string pref_name) { 202 BrowsingDataCounter* CreateCounterForPreference(std::string pref_name) {
172 if (!AreCountersEnabled()) 203 if (!AreCountersEnabled())
173 return nullptr; 204 return nullptr;
174 205
175 if (pref_name == prefs::kDeleteBrowsingHistory) 206 if (pref_name == prefs::kDeleteBrowsingHistory)
176 return new HistoryCounter(); 207 return new HistoryCounter();
177 if (pref_name == prefs::kDeleteCache) 208 if (pref_name == prefs::kDeleteCache)
178 return new CacheCounter(); 209 return new CacheCounter();
179 if (pref_name == prefs::kDeletePasswords) 210 if (pref_name == prefs::kDeletePasswords)
180 return new PasswordsCounter(); 211 return new PasswordsCounter();
181 if (pref_name == prefs::kDeleteFormData) 212 if (pref_name == prefs::kDeleteFormData)
182 return new AutofillCounter(); 213 return new AutofillCounter();
183 214
184 return nullptr; 215 return nullptr;
185 } 216 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_counter_utils.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698