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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 // static | 42 // static |
43 std::unique_ptr<browsing_data::BrowsingDataCounter> | 43 std::unique_ptr<browsing_data::BrowsingDataCounter> |
44 BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile, | 44 BrowsingDataCounterFactory::GetForProfileAndPref(Profile* profile, |
45 const std::string& pref_name) { | 45 const std::string& pref_name) { |
46 if (!AreCountersEnabled()) | 46 if (!AreCountersEnabled()) |
47 return nullptr; | 47 return nullptr; |
48 | 48 |
49 if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory) { | 49 if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory || |
| 50 pref_name == browsing_data::prefs::kDeleteBrowsingHistoryBasic) { |
50 return base::MakeUnique<browsing_data::HistoryCounter>( | 51 return base::MakeUnique<browsing_data::HistoryCounter>( |
51 HistoryServiceFactory::GetForProfile( | 52 HistoryServiceFactory::GetForProfile( |
52 profile, ServiceAccessType::EXPLICIT_ACCESS), | 53 profile, ServiceAccessType::EXPLICIT_ACCESS), |
53 base::Bind(&GetUpdatedWebHistoryService, | 54 base::Bind(&GetUpdatedWebHistoryService, |
54 base::Unretained(profile)), | 55 base::Unretained(profile)), |
55 ProfileSyncServiceFactory::GetForProfile(profile)); | 56 ProfileSyncServiceFactory::GetForProfile(profile)); |
56 } | 57 } |
57 | 58 |
58 if (pref_name == browsing_data::prefs::kDeleteCache) | 59 if (pref_name == browsing_data::prefs::kDeleteCache || |
| 60 pref_name == browsing_data::prefs::kDeleteCacheBasic) |
59 return base::MakeUnique<CacheCounter>(profile); | 61 return base::MakeUnique<CacheCounter>(profile); |
60 | 62 |
61 if (pref_name == browsing_data::prefs::kDeletePasswords) { | 63 if (pref_name == browsing_data::prefs::kDeletePasswords) { |
62 return base::MakeUnique<browsing_data::PasswordsCounter>( | 64 return base::MakeUnique<browsing_data::PasswordsCounter>( |
63 PasswordStoreFactory::GetForProfile( | 65 PasswordStoreFactory::GetForProfile( |
64 profile, ServiceAccessType::EXPLICIT_ACCESS)); | 66 profile, ServiceAccessType::EXPLICIT_ACCESS)); |
65 } | 67 } |
66 | 68 |
67 if (pref_name == browsing_data::prefs::kDeleteFormData) { | 69 if (pref_name == browsing_data::prefs::kDeleteFormData) { |
68 return base::MakeUnique<browsing_data::AutofillCounter>( | 70 return base::MakeUnique<browsing_data::AutofillCounter>( |
69 WebDataServiceFactory::GetAutofillWebDataForProfile( | 71 WebDataServiceFactory::GetAutofillWebDataForProfile( |
70 profile, ServiceAccessType::EXPLICIT_ACCESS)); | 72 profile, ServiceAccessType::EXPLICIT_ACCESS)); |
71 } | 73 } |
72 | 74 |
73 if (pref_name == browsing_data::prefs::kDeleteDownloadHistory) | 75 if (pref_name == browsing_data::prefs::kDeleteDownloadHistory) |
74 return base::MakeUnique<DownloadsCounter>(profile); | 76 return base::MakeUnique<DownloadsCounter>(profile); |
75 | 77 |
76 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) | 78 if (pref_name == browsing_data::prefs::kDeleteMediaLicenses) |
77 return base::MakeUnique<MediaLicensesCounter>(profile); | 79 return base::MakeUnique<MediaLicensesCounter>(profile); |
78 | 80 |
79 #if BUILDFLAG(ENABLE_EXTENSIONS) | 81 #if BUILDFLAG(ENABLE_EXTENSIONS) |
80 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) | 82 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) |
81 return base::MakeUnique<HostedAppsCounter>(profile); | 83 return base::MakeUnique<HostedAppsCounter>(profile); |
82 #endif | 84 #endif |
83 | 85 |
84 return nullptr; | 86 return nullptr; |
85 } | 87 } |
OLD | NEW |