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/chrome_browsing_data_remover_delegate.h" | 5 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Another convenience method to turn a callback without arguments into one that | 144 // Another convenience method to turn a callback without arguments into one that |
145 // accepts (and ignores) a single argument. | 145 // accepts (and ignores) a single argument. |
146 template <typename T> | 146 template <typename T> |
147 base::Callback<void(T)> IgnoreArgument(const base::Closure& callback) { | 147 base::Callback<void(T)> IgnoreArgument(const base::Closure& callback) { |
148 return base::Bind(&IgnoreArgumentHelper<T>, callback); | 148 return base::Bind(&IgnoreArgumentHelper<T>, callback); |
149 } | 149 } |
150 | 150 |
151 bool WebsiteSettingsFilterAdapter( | 151 bool WebsiteSettingsFilterAdapter( |
152 const base::Callback<bool(const GURL&)> predicate, | 152 const base::Callback<bool(const GURL&)> predicate, |
| 153 base::Time begin_time, |
153 const ContentSettingsPattern& primary_pattern, | 154 const ContentSettingsPattern& primary_pattern, |
154 const ContentSettingsPattern& secondary_pattern) { | 155 const ContentSettingsPattern& secondary_pattern, |
| 156 base::Time last_modified) { |
155 // Ignore the default setting. | 157 // Ignore the default setting. |
156 if (primary_pattern == ContentSettingsPattern::Wildcard()) | 158 if (primary_pattern == ContentSettingsPattern::Wildcard()) |
157 return false; | 159 return false; |
158 | 160 |
| 161 // Ignore entries that are too old. |
| 162 if (last_modified < begin_time) { |
| 163 return false; |
| 164 } |
| 165 |
159 // Website settings only use origin-scoped patterns. The only content setting | 166 // Website settings only use origin-scoped patterns. The only content setting |
160 // currently supported by ChromeBrowsingDataRemoverDelegate is | 167 // currently supported by ChromeBrowsingDataRemoverDelegate is |
161 // DURABLE_STORAGE, which also only uses origin-scoped patterns. Such patterns | 168 // DURABLE_STORAGE, which also only uses origin-scoped patterns. Such patterns |
162 // can be directly translated to a GURL. | 169 // can be directly translated to a GURL. |
163 GURL url(primary_pattern.ToString()); | 170 GURL url(primary_pattern.ToString()); |
164 DCHECK(url.is_valid()); | 171 DCHECK(url.is_valid()); |
165 return predicate.Run(url); | 172 return predicate.Run(url); |
166 } | 173 } |
167 | 174 |
168 #if !defined(DISABLE_NACL) | 175 #if !defined(DISABLE_NACL) |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 706 |
700 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); | 707 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); |
701 } | 708 } |
702 | 709 |
703 ////////////////////////////////////////////////////////////////////////////// | 710 ////////////////////////////////////////////////////////////////////////////// |
704 // DATA_TYPE_DURABLE_PERMISSION | 711 // DATA_TYPE_DURABLE_PERMISSION |
705 if (remove_mask & DATA_TYPE_DURABLE_PERMISSION) { | 712 if (remove_mask & DATA_TYPE_DURABLE_PERMISSION) { |
706 HostContentSettingsMapFactory::GetForProfile(profile_) | 713 HostContentSettingsMapFactory::GetForProfile(profile_) |
707 ->ClearSettingsForOneTypeWithPredicate( | 714 ->ClearSettingsForOneTypeWithPredicate( |
708 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, | 715 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, |
709 base::Bind(&WebsiteSettingsFilterAdapter, filter)); | 716 base::Bind(&WebsiteSettingsFilterAdapter, filter, base::Time())); |
710 } | 717 } |
711 | 718 |
712 ////////////////////////////////////////////////////////////////////////////// | 719 ////////////////////////////////////////////////////////////////////////////// |
713 // DATA_TYPE_SITE_USAGE_DATA | 720 // DATA_TYPE_SITE_USAGE_DATA |
714 if (remove_mask & DATA_TYPE_SITE_USAGE_DATA) { | 721 if (remove_mask & DATA_TYPE_SITE_USAGE_DATA) { |
715 HostContentSettingsMapFactory::GetForProfile(profile_) | 722 HostContentSettingsMapFactory::GetForProfile(profile_) |
716 ->ClearSettingsForOneTypeWithPredicate( | 723 ->ClearSettingsForOneTypeWithPredicate( |
717 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, | 724 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, |
718 base::Bind(&WebsiteSettingsFilterAdapter, filter)); | 725 base::Bind(&WebsiteSettingsFilterAdapter, filter, base::Time())); |
719 } | 726 } |
720 | 727 |
721 if ((remove_mask & DATA_TYPE_SITE_USAGE_DATA) || | 728 if ((remove_mask & DATA_TYPE_SITE_USAGE_DATA) || |
722 (remove_mask & DATA_TYPE_HISTORY)) { | 729 (remove_mask & DATA_TYPE_HISTORY)) { |
723 HostContentSettingsMapFactory::GetForProfile(profile_) | 730 HostContentSettingsMapFactory::GetForProfile(profile_) |
724 ->ClearSettingsForOneTypeWithPredicate( | 731 ->ClearSettingsForOneTypeWithPredicate( |
725 CONTENT_SETTINGS_TYPE_APP_BANNER, | 732 CONTENT_SETTINGS_TYPE_APP_BANNER, |
726 base::Bind(&WebsiteSettingsFilterAdapter, filter)); | 733 base::Bind(&WebsiteSettingsFilterAdapter, filter, base::Time())); |
727 | 734 |
728 PermissionDecisionAutoBlocker::GetForProfile(profile_)->RemoveCountsByUrl( | 735 PermissionDecisionAutoBlocker::GetForProfile(profile_)->RemoveCountsByUrl( |
729 filter); | 736 filter); |
730 } | 737 } |
731 | 738 |
732 ////////////////////////////////////////////////////////////////////////////// | 739 ////////////////////////////////////////////////////////////////////////////// |
733 // Password manager | 740 // Password manager |
734 if (remove_mask & DATA_TYPE_PASSWORDS) { | 741 if (remove_mask & DATA_TYPE_PASSWORDS) { |
735 base::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); | 742 base::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); |
736 password_manager::PasswordStore* password_store = | 743 password_manager::PasswordStore* password_store = |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 } | 1141 } |
1135 | 1142 |
1136 void ChromeBrowsingDataRemoverDelegate:: | 1143 void ChromeBrowsingDataRemoverDelegate:: |
1137 OnDeauthorizeFlashContentLicensesCompleted( | 1144 OnDeauthorizeFlashContentLicensesCompleted( |
1138 uint32_t request_id, | 1145 uint32_t request_id, |
1139 bool /* success */) { | 1146 bool /* success */) { |
1140 DCHECK_EQ(request_id, deauthorize_flash_content_licenses_request_id_); | 1147 DCHECK_EQ(request_id, deauthorize_flash_content_licenses_request_id_); |
1141 clear_flash_content_licenses_.GetCompletionCallback().Run(); | 1148 clear_flash_content_licenses_.GetCompletionCallback().Run(); |
1142 } | 1149 } |
1143 #endif | 1150 #endif |
OLD | NEW |