| 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 "chrome/browser/browsing_data/browsing_data_counter_factory.h" | 5 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/browsing_data/autofill_counter.h" | 8 #include "chrome/browser/browsing_data/autofill_counter.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" | 9 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" |
| 10 #include "chrome/browser/browsing_data/cache_counter.h" | 10 #include "chrome/browser/browsing_data/cache_counter.h" |
| 11 #include "chrome/browser/browsing_data/downloads_counter.h" | 11 #include "chrome/browser/browsing_data/downloads_counter.h" |
| 12 #include "chrome/browser/browsing_data/history_counter.h" | 12 #include "chrome/browser/browsing_data/history_counter.h" |
| 13 #include "chrome/browser/browsing_data/media_licenses_counter.h" | 13 #include "chrome/browser/browsing_data/media_licenses_counter.h" |
| 14 #include "chrome/browser/browsing_data/passwords_counter.h" | 14 #include "chrome/browser/browsing_data/passwords_counter.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/pref_names.h" | |
| 17 #include "components/browsing_data/counters/browsing_data_counter.h" | 16 #include "components/browsing_data/counters/browsing_data_counter.h" |
| 17 #include "components/browsing_data/pref_names.h" |
| 18 | 18 |
| 19 #if defined(ENABLE_EXTENSIONS) | 19 #if defined(ENABLE_EXTENSIONS) |
| 20 #include "chrome/browser/browsing_data/hosted_apps_counter.h" | 20 #include "chrome/browser/browsing_data/hosted_apps_counter.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 std::unique_ptr<browsing_data::BrowsingDataCounter> | 24 std::unique_ptr<browsing_data::BrowsingDataCounter> |
| 25 BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile, | 25 BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile, |
| 26 const std::string& pref_name) { | 26 const std::string& pref_name) { |
| 27 if (!AreCountersEnabled()) | 27 if (!AreCountersEnabled()) |
| 28 return nullptr; | 28 return nullptr; |
| 29 | 29 |
| 30 if (pref_name == prefs::kDeleteBrowsingHistory) | 30 if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory) |
| 31 return base::MakeUnique<HistoryCounter>(profile); | 31 return base::MakeUnique<HistoryCounter>(profile); |
| 32 | 32 |
| 33 if (pref_name == prefs::kDeleteCache) | 33 if (pref_name == browsing_data::prefs::kDeleteCache) |
| 34 return base::MakeUnique<CacheCounter>(profile); | 34 return base::MakeUnique<CacheCounter>(profile); |
| 35 | 35 |
| 36 if (pref_name == prefs::kDeletePasswords) | 36 if (pref_name == browsing_data::prefs::kDeletePasswords) |
| 37 return base::MakeUnique<PasswordsCounter>(profile); | 37 return base::MakeUnique<PasswordsCounter>(profile); |
| 38 | 38 |
| 39 if (pref_name == prefs::kDeleteFormData) | 39 if (pref_name == browsing_data::prefs::kDeleteFormData) |
| 40 return base::MakeUnique<AutofillCounter>(profile); | 40 return base::MakeUnique<AutofillCounter>(profile); |
| 41 | 41 |
| 42 if (pref_name == prefs::kDeleteDownloadHistory) | 42 if (pref_name == browsing_data::prefs::kDeleteDownloadHistory) |
| 43 return base::MakeUnique<DownloadsCounter>(profile); | 43 return base::MakeUnique<DownloadsCounter>(profile); |
| 44 | 44 |
| 45 if (pref_name == prefs::kDeleteMediaLicenses) | 45 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) |
| 46 return base::MakeUnique<MediaLicensesCounter>(profile); | 46 return base::MakeUnique<MediaLicensesCounter>(profile); |
| 47 | 47 |
| 48 #if defined(ENABLE_EXTENSIONS) | 48 #if defined(ENABLE_EXTENSIONS) |
| 49 if (pref_name == prefs::kDeleteHostedAppsData) | 49 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) |
| 50 return base::MakeUnique<HostedAppsCounter>(profile); | 50 return base::MakeUnique<HostedAppsCounter>(profile); |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 return nullptr; | 53 return nullptr; |
| 54 } | 54 } |
| OLD | NEW |