| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" | 10 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" |
| 11 #include "chrome/browser/browsing_data/cache_counter.h" | 11 #include "chrome/browser/browsing_data/cache_counter.h" |
| 12 #include "chrome/browser/browsing_data/downloads_counter.h" | 12 #include "chrome/browser/browsing_data/downloads_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/site_data_counter.h" |
| 14 #include "chrome/browser/history/history_service_factory.h" | 15 #include "chrome/browser/history/history_service_factory.h" |
| 15 #include "chrome/browser/history/web_history_service_factory.h" | 16 #include "chrome/browser/history/web_history_service_factory.h" |
| 16 #include "chrome/browser/password_manager/password_store_factory.h" | 17 #include "chrome/browser/password_manager/password_store_factory.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/sync/profile_sync_service_factory.h" | 19 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 19 #include "chrome/browser/web_data_service_factory.h" | 20 #include "chrome/browser/web_data_service_factory.h" |
| 20 #include "components/browser_sync/profile_sync_service.h" | 21 #include "components/browser_sync/profile_sync_service.h" |
| 21 #include "components/browsing_data/core/counters/autofill_counter.h" | 22 #include "components/browsing_data/core/counters/autofill_counter.h" |
| 22 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 23 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
| 23 #include "components/browsing_data/core/counters/history_counter.h" | 24 #include "components/browsing_data/core/counters/history_counter.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 50 pref_name == browsing_data::prefs::kDeleteBrowsingHistoryBasic) { | 51 pref_name == browsing_data::prefs::kDeleteBrowsingHistoryBasic) { |
| 51 return base::MakeUnique<browsing_data::HistoryCounter>( | 52 return base::MakeUnique<browsing_data::HistoryCounter>( |
| 52 HistoryServiceFactory::GetForProfile( | 53 HistoryServiceFactory::GetForProfile( |
| 53 profile, ServiceAccessType::EXPLICIT_ACCESS), | 54 profile, ServiceAccessType::EXPLICIT_ACCESS), |
| 54 base::Bind(&GetUpdatedWebHistoryService, | 55 base::Bind(&GetUpdatedWebHistoryService, |
| 55 base::Unretained(profile)), | 56 base::Unretained(profile)), |
| 56 ProfileSyncServiceFactory::GetForProfile(profile)); | 57 ProfileSyncServiceFactory::GetForProfile(profile)); |
| 57 } | 58 } |
| 58 | 59 |
| 59 if (pref_name == browsing_data::prefs::kDeleteCache || | 60 if (pref_name == browsing_data::prefs::kDeleteCache || |
| 60 pref_name == browsing_data::prefs::kDeleteCacheBasic) | 61 pref_name == browsing_data::prefs::kDeleteCacheBasic) { |
| 61 return base::MakeUnique<CacheCounter>(profile); | 62 return base::MakeUnique<CacheCounter>(profile); |
| 63 } |
| 64 |
| 65 if (pref_name == browsing_data::prefs::kDeleteCookies && |
| 66 IsSiteDataCounterEnabled()) { |
| 67 return base::MakeUnique<SiteDataCounter>(profile); |
| 68 } |
| 62 | 69 |
| 63 if (pref_name == browsing_data::prefs::kDeletePasswords) { | 70 if (pref_name == browsing_data::prefs::kDeletePasswords) { |
| 64 return base::MakeUnique<browsing_data::PasswordsCounter>( | 71 return base::MakeUnique<browsing_data::PasswordsCounter>( |
| 65 PasswordStoreFactory::GetForProfile( | 72 PasswordStoreFactory::GetForProfile( |
| 66 profile, ServiceAccessType::EXPLICIT_ACCESS)); | 73 profile, ServiceAccessType::EXPLICIT_ACCESS)); |
| 67 } | 74 } |
| 68 | 75 |
| 69 if (pref_name == browsing_data::prefs::kDeleteFormData) { | 76 if (pref_name == browsing_data::prefs::kDeleteFormData) { |
| 70 return base::MakeUnique<browsing_data::AutofillCounter>( | 77 return base::MakeUnique<browsing_data::AutofillCounter>( |
| 71 WebDataServiceFactory::GetAutofillWebDataForProfile( | 78 WebDataServiceFactory::GetAutofillWebDataForProfile( |
| 72 profile, ServiceAccessType::EXPLICIT_ACCESS)); | 79 profile, ServiceAccessType::EXPLICIT_ACCESS)); |
| 73 } | 80 } |
| 74 | 81 |
| 75 if (pref_name == browsing_data::prefs::kDeleteDownloadHistory) | 82 if (pref_name == browsing_data::prefs::kDeleteDownloadHistory) |
| 76 return base::MakeUnique<DownloadsCounter>(profile); | 83 return base::MakeUnique<DownloadsCounter>(profile); |
| 77 | 84 |
| 78 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) | 85 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) |
| 79 return base::MakeUnique<MediaLicensesCounter>(profile); | 86 return base::MakeUnique<MediaLicensesCounter>(profile); |
| 80 | 87 |
| 81 #if BUILDFLAG(ENABLE_EXTENSIONS) | 88 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 82 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) | 89 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) |
| 83 return base::MakeUnique<HostedAppsCounter>(profile); | 90 return base::MakeUnique<HostedAppsCounter>(profile); |
| 84 #endif | 91 #endif |
| 85 | 92 |
| 86 return nullptr; | 93 return nullptr; |
| 87 } | 94 } |
| OLD | NEW |