Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/browsing_data/autofill_counter.h" | |
| 8 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" | |
| 9 #include "chrome/browser/browsing_data/cache_counter.h" | |
| 10 #include "chrome/browser/browsing_data/downloads_counter.h" | |
| 11 #include "chrome/browser/browsing_data/history_counter.h" | |
| 12 #include "chrome/browser/browsing_data/media_licenses_counter.h" | |
| 13 #include "chrome/browser/browsing_data/passwords_counter.h" | |
| 14 #include "chrome/browser/profiles/profile.h" | |
| 15 #include "chrome/common/pref_names.h" | |
| 16 #include "components/browsing_data/counters/browsing_data_counter.h" | |
| 17 | |
| 18 #if defined(ENABLE_EXTENSIONS) | |
| 19 #include "chrome/browser/browsing_data/hosted_apps_counter.h" | |
| 20 #endif | |
| 21 | |
| 22 // static | |
| 23 std::unique_ptr<browsing_data::BrowsingDataCounter> | |
| 24 BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile, | |
| 25 const std::string& pref_name) { | |
| 26 if (!AreCountersEnabled()) | |
| 27 return nullptr; | |
| 28 | |
| 29 if (pref_name == prefs::kDeleteBrowsingHistory) | |
|
Bernhard Bauer
2016/07/11 10:57:02
These need braces, as they are more than one line.
ioanap
2016/07/11 13:34:15
Done.
| |
| 30 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 31 new HistoryCounter(profile)); | |
|
Bernhard Bauer
2016/07/11 10:57:02
Would base::WrapUnique or even base::MakeUnique wo
ioanap
2016/07/11 13:34:15
base::MakeUnique looks good! Thank you!
Done.
| |
| 32 if (pref_name == prefs::kDeleteCache) | |
| 33 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 34 new CacheCounter(profile)); | |
| 35 if (pref_name == prefs::kDeletePasswords) | |
| 36 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 37 new PasswordsCounter(profile)); | |
| 38 if (pref_name == prefs::kDeleteFormData) | |
| 39 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 40 new AutofillCounter(profile)); | |
| 41 if (pref_name == prefs::kDeleteDownloadHistory) | |
| 42 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 43 new DownloadsCounter(profile)); | |
| 44 if (pref_name == prefs::kDeleteMediaLicenses) | |
| 45 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 46 new MediaLicensesCounter(profile)); | |
| 47 #if defined(ENABLE_EXTENSIONS) | |
| 48 if (pref_name == prefs::kDeleteHostedAppsData) | |
| 49 return std::unique_ptr<browsing_data::BrowsingDataCounter>( | |
| 50 new HostedAppsCounter(profile)); | |
| 51 #endif | |
| 52 | |
| 53 return nullptr; | |
| 54 } | |
| OLD | NEW |