OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
17 #include "build/build_config.h" | |
18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | |
19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | |
20 #include "chrome/browser/browser_process.h" | |
21 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" | 17 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" |
22 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
23 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 19 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" |
24 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 20 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
25 #include "chrome/browser/chrome_notification_types.h" | |
26 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | |
27 #include "chrome/browser/domain_reliability/service_factory.h" | |
28 #include "chrome/browser/download/download_prefs.h" | 21 #include "chrome/browser/download/download_prefs.h" |
29 #include "chrome/browser/history/history_service_factory.h" | |
30 #include "chrome/browser/history/web_history_service_factory.h" | |
31 #include "chrome/browser/io_thread.h" | 22 #include "chrome/browser/io_thread.h" |
32 #include "chrome/browser/media/media_device_id_salt.h" | |
33 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h" | |
34 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.h" | |
35 #include "chrome/browser/net/predictor.h" | |
36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | |
37 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | |
38 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" | |
39 #include "chrome/browser/password_manager/password_store_factory.h" | |
40 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" | |
41 #include "chrome/browser/prerender/prerender_manager.h" | |
42 #include "chrome/browser/prerender/prerender_manager_factory.h" | |
43 #include "chrome/browser/previews/previews_service.h" | |
44 #include "chrome/browser/previews/previews_service_factory.h" | |
45 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
46 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | |
47 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
48 #include "chrome/browser/sessions/tab_restore_service_factory.h" | |
49 #include "chrome/browser/web_data_service_factory.h" | |
50 #include "chrome/common/features.h" | |
51 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
52 #include "chrome/common/url_constants.h" | |
53 #include "components/autofill/core/browser/personal_data_manager.h" | |
54 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | |
55 #include "components/bookmarks/browser/bookmark_model.h" | |
56 #include "components/browsing_data/content/storage_partition_http_cache_data_rem over.h" | 25 #include "components/browsing_data/content/storage_partition_http_cache_data_rem over.h" |
57 #include "components/content_settings/core/browser/host_content_settings_map.h" | |
58 #include "components/content_settings/core/common/content_settings.h" | |
59 #include "components/content_settings/core/common/content_settings_pattern.h" | |
60 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" | |
61 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" | |
62 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | |
63 #include "components/domain_reliability/service.h" | |
64 #include "components/history/core/browser/history_service.h" | |
65 #include "components/nacl/browser/nacl_browser.h" | |
66 #include "components/nacl/browser/pnacl_host.h" | |
67 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h" | |
68 #include "components/ntp_snippets/content_suggestions_service.h" | |
69 #include "components/omnibox/browser/omnibox_pref_names.h" | |
70 #include "components/password_manager/core/browser/password_store.h" | |
71 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
72 #include "components/previews/core/previews_ui_service.h" | |
73 #include "components/search_engines/template_url_service.h" | |
74 #include "components/sessions/core/tab_restore_service.h" | |
75 #include "components/web_cache/browser/web_cache_manager.h" | 27 #include "components/web_cache/browser/web_cache_manager.h" |
76 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
77 #include "content/public/browser/download_manager.h" | 29 #include "content/public/browser/download_manager.h" |
78 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
79 #include "content/public/browser/plugin_data_remover.h" | 31 #include "content/public/browser/plugin_data_remover.h" |
80 #include "content/public/browser/ssl_host_state_delegate.h" | 32 #include "content/public/browser/ssl_host_state_delegate.h" |
81 #include "content/public/browser/storage_partition.h" | 33 #include "content/public/browser/storage_partition.h" |
82 #include "content/public/browser/user_metrics.h" | 34 #include "content/public/browser/user_metrics.h" |
83 #include "extensions/features/features.h" | 35 #include "extensions/features/features.h" |
84 #include "media/media_features.h" | 36 #include "media/media_features.h" |
85 #include "net/base/net_errors.h" | 37 #include "net/base/net_errors.h" |
86 #include "net/cookies/cookie_store.h" | 38 #include "net/cookies/cookie_store.h" |
87 #include "net/http/http_network_session.h" | 39 #include "net/http/http_network_session.h" |
88 #include "net/http/http_transaction_factory.h" | 40 #include "net/http/http_transaction_factory.h" |
89 #include "net/http/transport_security_state.h" | 41 #include "net/http/transport_security_state.h" |
90 #include "net/ssl/channel_id_service.h" | 42 #include "net/ssl/channel_id_service.h" |
91 #include "net/ssl/channel_id_store.h" | 43 #include "net/ssl/channel_id_store.h" |
92 #include "net/url_request/url_request_context.h" | 44 #include "net/url_request/url_request_context.h" |
93 #include "net/url_request/url_request_context_getter.h" | 45 #include "net/url_request/url_request_context_getter.h" |
94 #include "ppapi/features/features.h" | 46 #include "ppapi/features/features.h" |
95 #include "storage/browser/quota/special_storage_policy.h" | 47 #include "storage/browser/quota/special_storage_policy.h" |
96 #include "url/origin.h" | 48 #include "url/origin.h" |
97 | 49 |
98 #if BUILDFLAG(ANDROID_JAVA_UI) | |
99 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | |
100 #include "chrome/browser/android/webapps/webapp_registry.h" | |
101 #include "chrome/browser/precache/precache_manager_factory.h" | |
102 #include "components/offline_pages/core/offline_page_feature.h" | |
103 #include "components/offline_pages/core/offline_page_model.h" | |
104 #include "components/precache/content/precache_manager.h" | |
105 #endif | |
106 | |
107 #if BUILDFLAG(ENABLE_EXTENSIONS) | |
108 #include "chrome/browser/extensions/activity_log/activity_log.h" | |
109 #include "extensions/browser/extension_prefs.h" | |
110 #endif | |
111 | |
112 #if BUILDFLAG(ENABLE_PLUGINS) | 50 #if BUILDFLAG(ENABLE_PLUGINS) |
113 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" | 51 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
114 #endif | 52 #endif |
115 | 53 |
116 #if BUILDFLAG(ENABLE_SESSION_SERVICE) | |
117 #include "chrome/browser/sessions/session_service.h" | |
118 #include "chrome/browser/sessions/session_service_factory.h" | |
119 #endif | |
120 | |
121 #if defined(OS_CHROMEOS) | |
122 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
123 #include "chromeos/attestation/attestation_constants.h" | |
124 #include "chromeos/cryptohome/cryptohome_parameters.h" | |
125 #include "chromeos/dbus/cryptohome_client.h" | |
126 #include "chromeos/dbus/dbus_thread_manager.h" | |
127 #include "components/user_manager/user.h" | |
128 #endif | |
129 | |
130 #if BUILDFLAG(ENABLE_WEBRTC) | |
131 #include "chrome/browser/media/webrtc/webrtc_log_list.h" | |
132 #include "chrome/browser/media/webrtc/webrtc_log_util.h" | |
133 #endif | |
134 | |
135 using base::UserMetricsAction; | 54 using base::UserMetricsAction; |
136 using content::BrowserContext; | 55 using content::BrowserContext; |
137 using content::BrowserThread; | 56 using content::BrowserThread; |
138 using content::DOMStorageContext; | 57 using content::DOMStorageContext; |
139 | 58 |
140 namespace { | 59 namespace { |
141 | 60 |
142 void UIThreadTrampolineHelper(const base::Closure& callback) { | |
143 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); | |
144 } | |
145 | |
146 // Convenience method to create a callback that can be run on any thread and | |
147 // will post the given |callback| back to the UI thread. | |
148 base::Closure UIThreadTrampoline(const base::Closure& callback) { | |
149 // We could directly bind &BrowserThread::PostTask, but that would require | |
150 // evaluating FROM_HERE when this method is called, as opposed to when the | |
151 // task is actually posted. | |
152 return base::Bind(&UIThreadTrampolineHelper, callback); | |
153 } | |
154 | |
155 template <typename T> | 61 template <typename T> |
156 void IgnoreArgumentHelper(const base::Closure& callback, T unused_argument) { | 62 void IgnoreArgumentHelper(const base::Closure& callback, T unused_argument) { |
157 callback.Run(); | 63 callback.Run(); |
158 } | 64 } |
159 | 65 |
160 // Another convenience method to turn a callback without arguments into one that | 66 // Another convenience method to turn a callback without arguments into one that |
161 // accepts (and ignores) a single argument. | 67 // accepts (and ignores) a single argument. |
162 template <typename T> | 68 template <typename T> |
163 base::Callback<void(T)> IgnoreArgument(const base::Closure& callback) { | 69 base::Callback<void(T)> IgnoreArgument(const base::Closure& callback) { |
164 return base::Bind(&IgnoreArgumentHelper<T>, callback); | 70 return base::Bind(&IgnoreArgumentHelper<T>, callback); |
165 } | 71 } |
166 | 72 |
167 // Helper to create callback for BrowsingDataRemover::DoesOriginMatchMask. | 73 // Helper to create callback for BrowsingDataRemover::DoesOriginMatchMask. |
168 bool DoesOriginMatchMaskAndUrls( | 74 bool DoesOriginMatchMaskAndUrls( |
169 int origin_type_mask, | 75 int origin_type_mask, |
170 const base::Callback<bool(const GURL&)>& predicate, | 76 const base::Callback<bool(const GURL&)>& predicate, |
171 const GURL& origin, | 77 const GURL& origin, |
172 storage::SpecialStoragePolicy* special_storage_policy) { | 78 storage::SpecialStoragePolicy* special_storage_policy) { |
173 return predicate.Run(origin) && | 79 return predicate.Run(origin) && |
174 BrowsingDataHelper::DoesOriginMatchMask(origin, origin_type_mask, | 80 BrowsingDataHelper::DoesOriginMatchMask(origin, origin_type_mask, |
175 special_storage_policy); | 81 special_storage_policy); |
176 } | 82 } |
177 | 83 |
178 bool ForwardPrimaryPatternCallback( | |
179 const base::Callback<bool(const ContentSettingsPattern&)> predicate, | |
180 const ContentSettingsPattern& primary_pattern, | |
181 const ContentSettingsPattern& secondary_pattern) { | |
182 return predicate.Run(primary_pattern); | |
183 } | |
184 | |
185 void ClearHostnameResolutionCacheOnIOThread( | |
186 IOThread* io_thread, | |
187 base::Callback<bool(const std::string&)> host_filter) { | |
188 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
189 | |
190 io_thread->ClearHostCache(host_filter); | |
191 } | |
192 | |
193 void ClearHttpAuthCacheOnIOThread( | 84 void ClearHttpAuthCacheOnIOThread( |
194 scoped_refptr<net::URLRequestContextGetter> context_getter, | 85 scoped_refptr<net::URLRequestContextGetter> context_getter, |
195 base::Time delete_begin) { | 86 base::Time delete_begin) { |
196 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 87 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
197 | 88 |
198 net::HttpNetworkSession* http_session = context_getter->GetURLRequestContext() | 89 net::HttpNetworkSession* http_session = context_getter->GetURLRequestContext() |
199 ->http_transaction_factory() | 90 ->http_transaction_factory() |
200 ->GetSession(); | 91 ->GetSession(); |
201 DCHECK(http_session); | 92 DCHECK(http_session); |
202 http_session->http_auth_cache()->ClearEntriesAddedWithin(base::Time::Now() - | 93 http_session->http_auth_cache()->ClearEntriesAddedWithin(base::Time::Now() - |
203 delete_begin); | 94 delete_begin); |
204 http_session->CloseAllConnections(); | 95 http_session->CloseAllConnections(); |
205 } | 96 } |
206 | 97 |
207 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { | |
208 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
209 DCHECK(predictor); | |
210 | |
211 predictor->DiscardInitialNavigationHistory(); | |
212 predictor->DiscardAllResults(); | |
213 } | |
214 | |
215 #if !defined(DISABLE_NACL) | |
216 void ClearNaClCacheOnIOThread(const base::Closure& callback) { | |
217 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
218 | |
219 nacl::NaClBrowser::GetInstance()->ClearValidationCache(callback); | |
220 } | |
221 | |
222 void ClearPnaclCacheOnIOThread(base::Time begin, | |
223 base::Time end, | |
224 const base::Closure& callback) { | |
225 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
226 | |
227 pnacl::PnaclHost::GetInstance()->ClearTranslationCacheEntriesBetween( | |
228 begin, end, callback); | |
229 } | |
230 #endif | |
231 | |
232 void ClearCookiesOnIOThread(base::Time delete_begin, | |
233 base::Time delete_end, | |
234 net::URLRequestContextGetter* rq_context, | |
235 const base::Closure& callback) { | |
236 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
237 net::CookieStore* cookie_store = | |
238 rq_context->GetURLRequestContext()->cookie_store(); | |
239 cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, | |
240 IgnoreArgument<int>(callback)); | |
241 } | |
242 | |
243 void ClearCookiesWithPredicateOnIOThread( | |
244 base::Time delete_begin, | |
245 base::Time delete_end, | |
246 net::CookieStore::CookiePredicate predicate, | |
247 net::URLRequestContextGetter* rq_context, | |
248 const base::Closure& callback) { | |
249 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
250 net::CookieStore* cookie_store = | |
251 rq_context->GetURLRequestContext()->cookie_store(); | |
252 cookie_store->DeleteAllCreatedBetweenWithPredicateAsync( | |
253 delete_begin, delete_end, predicate, IgnoreArgument<int>(callback)); | |
254 } | |
255 | |
256 void OnClearedChannelIDsOnIOThread(net::URLRequestContextGetter* rq_context, | 98 void OnClearedChannelIDsOnIOThread(net::URLRequestContextGetter* rq_context, |
257 const base::Closure& callback) { | 99 const base::Closure& callback) { |
258 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 100 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
259 | 101 |
260 // Need to close open SSL connections which may be using the channel ids we | 102 // Need to close open SSL connections which may be using the channel ids we |
261 // are deleting. | 103 // are deleting. |
262 // TODO(mattm): http://crbug.com/166069 Make the server bound cert | 104 // TODO(mattm): http://crbug.com/166069 Make the server bound cert |
263 // service/store have observers that can notify relevant things directly. | 105 // service/store have observers that can notify relevant things directly. |
264 rq_context->GetURLRequestContext() | 106 rq_context->GetURLRequestContext() |
265 ->ssl_config_service() | 107 ->ssl_config_service() |
(...skipping 11 matching lines...) Expand all Loading... | |
277 net::ChannelIDService* channel_id_service = | 119 net::ChannelIDService* channel_id_service = |
278 rq_context->GetURLRequestContext()->channel_id_service(); | 120 rq_context->GetURLRequestContext()->channel_id_service(); |
279 channel_id_service->GetChannelIDStore()->DeleteForDomainsCreatedBetween( | 121 channel_id_service->GetChannelIDStore()->DeleteForDomainsCreatedBetween( |
280 domain_predicate, delete_begin, delete_end, | 122 domain_predicate, delete_begin, delete_end, |
281 base::Bind(&OnClearedChannelIDsOnIOThread, | 123 base::Bind(&OnClearedChannelIDsOnIOThread, |
282 base::RetainedRef(std::move(rq_context)), callback)); | 124 base::RetainedRef(std::move(rq_context)), callback)); |
283 } | 125 } |
284 | 126 |
285 } // namespace | 127 } // namespace |
286 | 128 |
287 BrowsingDataRemover::CompletionInhibitor* | 129 BrowsingDataRemover::CompletionInhibitor* |
Bernhard Bauer
2016/12/13 13:26:22
Ooh... this could be made an additional SubTask as
msramek
2016/12/13 14:21:51
Acknowledged. There's also a TODO to make it non-s
| |
288 BrowsingDataRemover::completion_inhibitor_ = nullptr; | 130 BrowsingDataRemover::completion_inhibitor_ = nullptr; |
289 | 131 |
132 BrowsingDataRemover::SubTask::SubTask(const base::Closure& forward_callback) | |
133 : is_pending_(false), | |
134 forward_callback_(forward_callback), | |
135 weak_ptr_factory_(this) {} | |
136 | |
137 BrowsingDataRemover::SubTask::~SubTask() {} | |
138 | |
139 void BrowsingDataRemover::SubTask::Start() { | |
140 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
141 DCHECK(!is_pending_); | |
142 is_pending_ = true; | |
143 } | |
144 | |
145 base::Closure BrowsingDataRemover::SubTask::GetCompletionCallback() { | |
146 return base::Bind(&BrowsingDataRemover::SubTask::CompletionCallback, | |
147 weak_ptr_factory_.GetWeakPtr()); | |
148 } | |
149 | |
150 void BrowsingDataRemover::SubTask::CompletionCallback() { | |
151 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
152 DCHECK(is_pending_); | |
153 is_pending_ = false; | |
154 DCHECK(!forward_callback_.is_null()); | |
Bernhard Bauer
2016/12/13 13:26:22
DCHECK this in the constructor?
msramek
2016/12/13 14:21:51
Done.
| |
155 forward_callback_.Run(); | |
156 } | |
157 | |
290 bool BrowsingDataRemover::TimeRange::operator==( | 158 bool BrowsingDataRemover::TimeRange::operator==( |
291 const BrowsingDataRemover::TimeRange& other) const { | 159 const BrowsingDataRemover::TimeRange& other) const { |
292 return begin == other.begin && end == other.end; | 160 return begin == other.begin && end == other.end; |
293 } | 161 } |
294 | 162 |
295 // static | 163 // static |
296 BrowsingDataRemover::TimeRange BrowsingDataRemover::Unbounded() { | 164 BrowsingDataRemover::TimeRange BrowsingDataRemover::Unbounded() { |
297 return TimeRange(base::Time(), base::Time::Max()); | 165 return TimeRange(base::Time(), base::Time::Max()); |
298 } | 166 } |
299 | 167 |
(...skipping 22 matching lines...) Expand all Loading... | |
322 | 190 |
323 BrowsingDataRemover::BrowsingDataRemover( | 191 BrowsingDataRemover::BrowsingDataRemover( |
324 content::BrowserContext* browser_context) | 192 content::BrowserContext* browser_context) |
325 : profile_(Profile::FromBrowserContext(browser_context)), | 193 : profile_(Profile::FromBrowserContext(browser_context)), |
326 remove_mask_(-1), | 194 remove_mask_(-1), |
327 origin_type_mask_(-1), | 195 origin_type_mask_(-1), |
328 is_removing_(false), | 196 is_removing_(false), |
329 #if BUILDFLAG(ENABLE_PLUGINS) | 197 #if BUILDFLAG(ENABLE_PLUGINS) |
330 flash_lso_helper_(BrowsingDataFlashLSOHelper::Create(profile_)), | 198 flash_lso_helper_(BrowsingDataFlashLSOHelper::Create(profile_)), |
331 #endif | 199 #endif |
332 #if BUILDFLAG(ANDROID_JAVA_UI) | 200 sub_task_forward_callback_( |
333 webapp_registry_(new WebappRegistry()), | 201 base::Bind(&BrowsingDataRemover::NotifyIfDone, |
334 #endif | 202 base::Unretained(this))), |
203 synchronous_clear_operations_(sub_task_forward_callback_), | |
204 clear_embedder_data_(sub_task_forward_callback_), | |
205 clear_cache_(sub_task_forward_callback_), | |
206 clear_channel_ids_(sub_task_forward_callback_), | |
207 clear_http_auth_cache_(sub_task_forward_callback_), | |
208 clear_storage_partition_data_(sub_task_forward_callback_), | |
335 weak_ptr_factory_(this) { | 209 weak_ptr_factory_(this) { |
336 DCHECK(browser_context); | 210 DCHECK(browser_context); |
337 } | 211 } |
338 | 212 |
339 BrowsingDataRemover::~BrowsingDataRemover() { | 213 BrowsingDataRemover::~BrowsingDataRemover() { |
340 if (!task_queue_.empty()) { | 214 if (!task_queue_.empty()) { |
341 VLOG(1) << "BrowsingDataRemover shuts down with " << task_queue_.size() | 215 VLOG(1) << "BrowsingDataRemover shuts down with " << task_queue_.size() |
342 << " pending tasks"; | 216 << " pending tasks"; |
343 } | 217 } |
344 | 218 |
345 // If we are still removing data, notify observers that their task has been | 219 // If we are still removing data, notify observers that their task has been |
346 // (albeit unsucessfuly) processed, so they can unregister themselves. | 220 // (albeit unsucessfuly) processed, so they can unregister themselves. |
347 // TODO(bauerb): If it becomes a problem that browsing data might not actually | 221 // TODO(bauerb): If it becomes a problem that browsing data might not actually |
348 // be fully cleared when an observer is notified, add a success flag. | 222 // be fully cleared when an observer is notified, add a success flag. |
349 while (!task_queue_.empty()) { | 223 while (!task_queue_.empty()) { |
350 if (observer_list_.HasObserver(task_queue_.front().observer)) | 224 if (observer_list_.HasObserver(task_queue_.front().observer)) |
351 task_queue_.front().observer->OnBrowsingDataRemoverDone(); | 225 task_queue_.front().observer->OnBrowsingDataRemoverDone(); |
352 task_queue_.pop(); | 226 task_queue_.pop(); |
353 } | 227 } |
354 } | 228 } |
355 | 229 |
356 void BrowsingDataRemover::Shutdown() { | 230 void BrowsingDataRemover::Shutdown() { |
357 history_task_tracker_.TryCancelAll(); | 231 embedder_delegate_.reset(); |
358 template_url_sub_.reset(); | |
359 } | 232 } |
360 | 233 |
361 void BrowsingDataRemover::SetRemoving(bool is_removing) { | 234 void BrowsingDataRemover::SetRemoving(bool is_removing) { |
362 DCHECK_NE(is_removing_, is_removing); | 235 DCHECK_NE(is_removing_, is_removing); |
363 is_removing_ = is_removing; | 236 is_removing_ = is_removing; |
364 } | 237 } |
365 | 238 |
366 void BrowsingDataRemover::Remove(const TimeRange& time_range, | 239 void BrowsingDataRemover::Remove(const TimeRange& time_range, |
367 int remove_mask, | 240 int remove_mask, |
368 int origin_type_mask) { | 241 int origin_type_mask) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 // =============== README before adding more storage backends =============== | 329 // =============== README before adding more storage backends =============== |
457 // | 330 // |
458 // If you're adding a data storage backend that is included among | 331 // If you're adding a data storage backend that is included among |
459 // RemoveDataMask::FILTERABLE_DATATYPES, you must do one of the following: | 332 // RemoveDataMask::FILTERABLE_DATATYPES, you must do one of the following: |
460 // 1. Support one of the filters generated by |filter_builder|. | 333 // 1. Support one of the filters generated by |filter_builder|. |
461 // 2. Add a comment explaining why is it acceptable in your case to delete all | 334 // 2. Add a comment explaining why is it acceptable in your case to delete all |
462 // data without filtering URLs / origins / domains. | 335 // data without filtering URLs / origins / domains. |
463 // 3. Do not support partial deletion, i.e. only delete your data if | 336 // 3. Do not support partial deletion, i.e. only delete your data if |
464 // |filter_builder.IsEmptyBlacklist()|. Add a comment explaining why this | 337 // |filter_builder.IsEmptyBlacklist()|. Add a comment explaining why this |
465 // is acceptable. | 338 // is acceptable. |
466 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 339 synchronous_clear_operations_.Start(); |
467 waiting_for_synchronous_clear_operations_ = true; | |
468 | 340 |
469 // crbug.com/140910: Many places were calling this with base::Time() as | 341 // crbug.com/140910: Many places were calling this with base::Time() as |
470 // delete_end, even though they should've used base::Time::Max(). | 342 // delete_end, even though they should've used base::Time::Max(). |
471 DCHECK_NE(base::Time(), time_range.end); | 343 DCHECK_NE(base::Time(), time_range.end); |
472 | 344 |
473 delete_begin_ = time_range.begin; | 345 delete_begin_ = time_range.begin; |
474 delete_end_ = time_range.end; | 346 delete_end_ = time_range.end; |
475 remove_mask_ = remove_mask; | 347 remove_mask_ = remove_mask; |
476 origin_type_mask_ = origin_type_mask; | 348 origin_type_mask_ = origin_type_mask; |
477 | 349 |
478 base::Callback<bool(const GURL& url)> filter = | |
479 filter_builder.BuildGeneralFilter(); | |
480 base::Callback<bool(const ContentSettingsPattern& url)> same_pattern_filter = | |
481 filter_builder.BuildWebsiteSettingsPatternMatchesFilter(); | |
482 | |
483 // Some backends support a filter that |is_null()| to make complete deletion | |
484 // more efficient. | |
485 base::Callback<bool(const GURL&)> nullable_filter = | |
486 filter_builder.IsEmptyBlacklist() ? base::Callback<bool(const GURL&)>() | |
487 : filter; | |
488 | |
489 PrefService* prefs = profile_->GetPrefs(); | |
490 bool may_delete_history = prefs->GetBoolean( | |
491 prefs::kAllowDeletingBrowserHistory); | |
492 | |
493 // All the UI entry points into the BrowsingDataRemover should be disabled, | |
494 // but this will fire if something was missed or added. | |
495 DCHECK(may_delete_history || (remove_mask & REMOVE_NOCHECKS) || | |
496 (!(remove_mask & REMOVE_HISTORY) && !(remove_mask & REMOVE_DOWNLOADS))); | |
497 | |
498 if (origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 350 if (origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
499 content::RecordAction( | 351 content::RecordAction( |
500 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); | 352 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); |
501 } | 353 } |
502 if (origin_type_mask_ & BrowsingDataHelper::PROTECTED_WEB) { | 354 if (origin_type_mask_ & BrowsingDataHelper::PROTECTED_WEB) { |
503 content::RecordAction( | 355 content::RecordAction( |
504 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); | 356 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); |
505 } | 357 } |
506 if (origin_type_mask_ & BrowsingDataHelper::EXTENSION) { | 358 if (origin_type_mask_ & BrowsingDataHelper::EXTENSION) { |
507 content::RecordAction( | 359 content::RecordAction( |
508 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); | 360 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); |
509 } | 361 } |
510 // If this fires, we added a new BrowsingDataHelper::OriginTypeMask without | 362 // If this fires, we added a new BrowsingDataHelper::OriginTypeMask without |
511 // updating the user metrics above. | 363 // updating the user metrics above. |
512 static_assert( | 364 static_assert( |
513 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | | 365 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | |
514 BrowsingDataHelper::PROTECTED_WEB | | 366 BrowsingDataHelper::PROTECTED_WEB | |
515 BrowsingDataHelper::EXTENSION), | 367 BrowsingDataHelper::EXTENSION), |
516 "OriginTypeMask has been updated without updating user metrics"); | 368 "OriginTypeMask has been updated without updating user metrics"); |
517 | 369 |
370 // Record the combined deletion of cookies and cache. | |
371 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; | |
372 if (remove_mask & REMOVE_COOKIES && | |
373 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | |
374 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE | |
375 : ONLY_COOKIES; | |
376 } else if (remove_mask & REMOVE_CACHE) { | |
377 choice = ONLY_CACHE; | |
378 } | |
379 | |
380 UMA_HISTOGRAM_ENUMERATION( | |
381 "History.ClearBrowsingData.UserDeletedCookieOrCache", | |
382 choice, MAX_CHOICE_VALUE); | |
383 | |
384 // Managed devices and supervised users can have restrictions on history | |
385 // deletion. | |
386 PrefService* prefs = profile_->GetPrefs(); | |
387 bool may_delete_history = prefs->GetBoolean( | |
388 prefs::kAllowDeletingBrowserHistory); | |
389 | |
390 // All the UI entry points into the BrowsingDataRemover should be disabled, | |
391 // but this will fire if something was missed or added. | |
392 DCHECK(may_delete_history || (remove_mask & REMOVE_NOCHECKS) || | |
393 (!(remove_mask & REMOVE_HISTORY) && !(remove_mask & REMOVE_DOWNLOADS))); | |
394 | |
395 ////////////////////////////////////////////////////////////////////////////// | |
396 // INITIALIZATION | |
397 base::Callback<bool(const GURL& url)> filter = | |
398 filter_builder.BuildGeneralFilter(); | |
399 | |
518 if ((remove_mask & REMOVE_HISTORY) && may_delete_history) { | 400 if ((remove_mask & REMOVE_HISTORY) && may_delete_history) { |
519 history::HistoryService* history_service = | |
520 HistoryServiceFactory::GetForProfile( | |
521 profile_, ServiceAccessType::EXPLICIT_ACCESS); | |
522 if (history_service) { | |
523 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | |
524 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | |
525 waiting_for_clear_history_ = true; | |
526 history_service->ExpireLocalAndRemoteHistoryBetween( | |
527 WebHistoryServiceFactory::GetForProfile(profile_), std::set<GURL>(), | |
528 delete_begin_, delete_end_, | |
529 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, | |
530 weak_ptr_factory_.GetWeakPtr()), | |
531 &history_task_tracker_); | |
532 } | |
533 | |
534 // Currently, ContentSuggestionService instance exists only on Android. | |
535 ntp_snippets::ContentSuggestionsService* content_suggestions_service = | |
536 ContentSuggestionsServiceFactory::GetForProfileIfExists(profile_); | |
537 if (content_suggestions_service) { | |
538 content_suggestions_service->ClearHistory(delete_begin_, delete_end_, | |
539 filter); | |
540 } | |
541 | |
542 // Remove the last visit dates meta-data from the bookmark model. | |
543 // TODO(vitaliii): Do not remove all dates, but only the ones matched by the | |
544 // time range and the filter. | |
545 bookmarks::BookmarkModel* bookmark_model = | |
546 BookmarkModelFactory::GetForBrowserContext(profile_); | |
547 if (bookmark_model) | |
548 ntp_snippets::RemoveAllLastVisitDates(bookmark_model); | |
549 | |
550 #if BUILDFLAG(ENABLE_EXTENSIONS) | |
551 // The extension activity log contains details of which websites extensions | |
552 // were active on. It therefore indirectly stores details of websites a | |
553 // user has visited so best clean from here as well. | |
554 // TODO(msramek): Support all backends with filter (crbug.com/589586). | |
555 extensions::ActivityLog::GetInstance(profile_)->RemoveURLs( | |
556 std::set<GURL>()); | |
557 | |
558 // Clear launch times as they are a form of history. | |
559 // BrowsingDataFilterBuilder currently doesn't support extension origins. | |
560 // Therefore, clearing history for a small set of origins (WHITELIST) should | |
561 // never delete any extension launch times, while clearing for almost all | |
562 // origins (BLACKLIST) should always delete all of extension launch times. | |
563 if (filter_builder.mode() == BrowsingDataFilterBuilder::BLACKLIST) { | |
564 extensions::ExtensionPrefs* extension_prefs = | |
565 extensions::ExtensionPrefs::Get(profile_); | |
566 extension_prefs->ClearLastLaunchTimes(); | |
567 } | |
568 #endif | |
569 | |
570 // Need to clear the host cache and accumulated speculative data, as it also | |
571 // reveals some history. We have no mechanism to track when these items were | |
572 // created, so we'll not honor the time range. | |
573 // TODO(msramek): We can use the plugin filter here because plugins, same | |
574 // as the hostname resolution cache, key their entries by hostname. Rename | |
575 // BuildPluginFilter() to something more general to reflect this use. | |
576 if (g_browser_process->io_thread()) { | |
577 waiting_for_clear_hostname_resolution_cache_ = true; | |
578 BrowserThread::PostTaskAndReply( | |
579 BrowserThread::IO, FROM_HERE, | |
580 base::Bind(&ClearHostnameResolutionCacheOnIOThread, | |
581 g_browser_process->io_thread(), | |
582 filter_builder.BuildPluginFilter()), | |
583 base::Bind(&BrowsingDataRemover::OnClearedHostnameResolutionCache, | |
584 weak_ptr_factory_.GetWeakPtr())); | |
585 } | |
586 if (profile_->GetNetworkPredictor()) { | |
587 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | |
588 waiting_for_clear_network_predictor_ = true; | |
589 BrowserThread::PostTaskAndReply( | |
590 BrowserThread::IO, FROM_HERE, | |
591 base::Bind(&ClearNetworkPredictorOnIOThread, | |
592 profile_->GetNetworkPredictor()), | |
593 base::Bind(&BrowsingDataRemover::OnClearedNetworkPredictor, | |
594 weak_ptr_factory_.GetWeakPtr())); | |
595 profile_->GetNetworkPredictor()->ClearPrefsOnUIThread(); | |
596 } | |
597 | |
598 // As part of history deletion we also delete the auto-generated keywords. | |
599 TemplateURLService* keywords_model = | |
600 TemplateURLServiceFactory::GetForProfile(profile_); | |
601 | |
602 if (keywords_model && !keywords_model->loaded()) { | |
603 // TODO(msramek): Store filters from the currently executed task on the | |
604 // object to avoid having to copy them to callback methods. | |
605 template_url_sub_ = keywords_model->RegisterOnLoadedCallback( | |
606 base::Bind(&BrowsingDataRemover::OnKeywordsLoaded, | |
607 weak_ptr_factory_.GetWeakPtr(), filter)); | |
608 keywords_model->Load(); | |
609 waiting_for_clear_keyword_data_ = true; | |
610 } else if (keywords_model) { | |
611 keywords_model->RemoveAutoGeneratedForUrlsBetween(filter, delete_begin_, | |
612 delete_end_); | |
613 } | |
614 | |
615 // The PrerenderManager keeps history of prerendered pages, so clear that. | |
616 // It also may have a prerendered page. If so, the page could be | |
617 // considered to have a small amount of historical information, so delete | |
618 // it, too. | |
619 prerender::PrerenderManager* prerender_manager = | |
620 prerender::PrerenderManagerFactory::GetForBrowserContext(profile_); | |
621 if (prerender_manager) { | |
622 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | |
623 prerender_manager->ClearData( | |
624 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS | | |
625 prerender::PrerenderManager::CLEAR_PRERENDER_HISTORY); | |
626 } | |
627 | |
628 // If the caller is removing history for all hosts, then clear ancillary | |
629 // historical information. | |
630 if (filter_builder.IsEmptyBlacklist()) { | |
631 // We also delete the list of recently closed tabs. Since these expire, | |
632 // they can't be more than a day old, so we can simply clear them all. | |
633 sessions::TabRestoreService* tab_service = | |
634 TabRestoreServiceFactory::GetForProfile(profile_); | |
635 if (tab_service) { | |
636 tab_service->ClearEntries(); | |
637 tab_service->DeleteLastSession(); | |
638 } | |
639 | |
640 #if BUILDFLAG(ENABLE_SESSION_SERVICE) | |
641 // We also delete the last session when we delete the history. | |
642 SessionService* session_service = | |
643 SessionServiceFactory::GetForProfile(profile_); | |
644 if (session_service) | |
645 session_service->DeleteLastSession(); | |
646 #endif | |
647 } | |
648 | |
649 // The saved Autofill profiles and credit cards can include the origin from | |
650 // which these profiles and credit cards were learned. These are a form of | |
651 // history, so clear them as well. | |
652 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | |
653 scoped_refptr<autofill::AutofillWebDataService> web_data_service = | |
654 WebDataServiceFactory::GetAutofillWebDataForProfile( | |
655 profile_, ServiceAccessType::EXPLICIT_ACCESS); | |
656 if (web_data_service.get()) { | |
657 waiting_for_clear_autofill_origin_urls_ = true; | |
658 web_data_service->RemoveOriginURLsModifiedBetween( | |
659 delete_begin_, delete_end_); | |
660 // The above calls are done on the UI thread but do their work on the DB | |
661 // thread. So wait for it. | |
662 BrowserThread::PostTaskAndReply( | |
663 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | |
664 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs, | |
665 weak_ptr_factory_.GetWeakPtr())); | |
666 | |
667 autofill::PersonalDataManager* data_manager = | |
668 autofill::PersonalDataManagerFactory::GetForProfile(profile_); | |
669 if (data_manager) | |
670 data_manager->Refresh(); | |
671 } | |
672 | |
673 #if BUILDFLAG(ENABLE_WEBRTC) | |
674 waiting_for_clear_webrtc_logs_ = true; | |
675 BrowserThread::PostTaskAndReply( | |
676 BrowserThread::FILE, FROM_HERE, | |
677 base::Bind( | |
678 &WebRtcLogUtil::DeleteOldAndRecentWebRtcLogFiles, | |
679 WebRtcLogList::GetWebRtcLogDirectoryForProfile(profile_->GetPath()), | |
680 delete_begin_), | |
681 base::Bind(&BrowsingDataRemover::OnClearedWebRtcLogs, | |
682 weak_ptr_factory_.GetWeakPtr())); | |
683 #endif | |
684 | |
685 // The SSL Host State that tracks SSL interstitial "proceed" decisions may | 401 // The SSL Host State that tracks SSL interstitial "proceed" decisions may |
686 // include origins that the user has visited, so it must be cleared. | 402 // include origins that the user has visited, so it must be cleared. |
687 // TODO(msramek): We can reuse the plugin filter here, since both plugins | 403 // TODO(msramek): We can reuse the plugin filter here, since both plugins |
688 // and SSL host state are scoped to hosts and represent them as std::string. | 404 // and SSL host state are scoped to hosts and represent them as std::string. |
689 // Rename the method to indicate its more general usage. | 405 // Rename the method to indicate its more general usage. |
690 if (profile_->GetSSLHostStateDelegate()) { | 406 if (profile_->GetSSLHostStateDelegate()) { |
691 profile_->GetSSLHostStateDelegate()->Clear( | 407 profile_->GetSSLHostStateDelegate()->Clear( |
692 filter_builder.IsEmptyBlacklist() | 408 filter_builder.IsEmptyBlacklist() |
693 ? base::Callback<bool(const std::string&)>() | 409 ? base::Callback<bool(const std::string&)>() |
694 : filter_builder.BuildPluginFilter()); | 410 : filter_builder.BuildPluginFilter()); |
695 } | 411 } |
696 | |
697 #if BUILDFLAG(ANDROID_JAVA_UI) | |
698 precache::PrecacheManager* precache_manager = | |
699 precache::PrecacheManagerFactory::GetForBrowserContext(profile_); | |
700 // |precache_manager| could be nullptr if the profile is off the record. | |
701 if (!precache_manager) { | |
702 waiting_for_clear_precache_history_ = true; | |
703 precache_manager->ClearHistory(); | |
704 // The above calls are done on the UI thread but do their work on the DB | |
705 // thread. So wait for it. | |
706 BrowserThread::PostTaskAndReply( | |
707 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | |
708 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, | |
709 weak_ptr_factory_.GetWeakPtr())); | |
710 } | |
711 | |
712 // Clear the history information (last launch time and origin URL) of any | |
713 // registered webapps. | |
714 webapp_registry_->ClearWebappHistoryForUrls(filter); | |
715 #endif | |
716 | |
717 data_reduction_proxy::DataReductionProxySettings* | |
718 data_reduction_proxy_settings = | |
719 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | |
720 profile_); | |
721 // |data_reduction_proxy_settings| is null if |profile_| is off the record. | |
722 if (data_reduction_proxy_settings) { | |
723 data_reduction_proxy::DataReductionProxyService* | |
724 data_reduction_proxy_service = | |
725 data_reduction_proxy_settings->data_reduction_proxy_service(); | |
726 if (data_reduction_proxy_service) { | |
727 data_reduction_proxy_service->compression_stats() | |
728 ->DeleteBrowsingHistory(delete_begin_, delete_end_); | |
729 } | |
730 } | |
731 | |
732 // |previews_service| is null if |profile_| is off the record. | |
733 PreviewsService* previews_service = | |
734 PreviewsServiceFactory::GetForProfile(profile_); | |
735 if (previews_service && previews_service->previews_ui_service()) { | |
736 previews_service->previews_ui_service()->ClearBlackList(delete_begin_, | |
737 delete_end_); | |
738 } | |
739 } | 412 } |
740 | 413 |
414 ////////////////////////////////////////////////////////////////////////////// | |
415 // REMOVE_DOWNLOADS | |
741 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { | 416 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { |
742 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); | 417 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); |
743 content::DownloadManager* download_manager = | 418 content::DownloadManager* download_manager = |
744 BrowserContext::GetDownloadManager(profile_); | 419 BrowserContext::GetDownloadManager(profile_); |
745 download_manager->RemoveDownloadsByURLAndTime(filter, | 420 download_manager->RemoveDownloadsByURLAndTime(filter, |
746 delete_begin_, delete_end_); | 421 delete_begin_, delete_end_); |
747 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( | 422 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( |
748 download_manager); | 423 download_manager); |
749 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); | 424 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); |
750 } | 425 } |
751 | 426 |
752 uint32_t storage_partition_remove_mask = 0; | 427 ////////////////////////////////////////////////////////////////////////////// |
753 | 428 // REMOVE_CHANNEL_IDS |
754 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, | |
755 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB | |
756 // don't accidentally remove the cookies that are associated with the | |
757 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | |
758 // between UNPROTECTED_WEB and PROTECTED_WEB. | |
759 if (remove_mask & REMOVE_COOKIES && | |
760 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | |
761 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); | |
762 | |
763 storage_partition_remove_mask |= | |
764 content::StoragePartition::REMOVE_DATA_MASK_COOKIES; | |
765 | |
766 // Clear the safebrowsing cookies only if time period is for "all time". It | |
767 // doesn't make sense to apply the time period of deleting in the last X | |
768 // hours/days to the safebrowsing cookies since they aren't the result of | |
769 // any user action. | |
770 if (delete_begin_ == base::Time()) { | |
771 safe_browsing::SafeBrowsingService* sb_service = | |
772 g_browser_process->safe_browsing_service(); | |
773 if (sb_service) { | |
774 scoped_refptr<net::URLRequestContextGetter> sb_context = | |
775 sb_service->url_request_context(); | |
776 ++waiting_for_clear_cookies_count_; | |
777 if (filter_builder.IsEmptyBlacklist()) { | |
778 BrowserThread::PostTask( | |
779 BrowserThread::IO, FROM_HERE, | |
780 base::Bind(&ClearCookiesOnIOThread, delete_begin_, delete_end_, | |
781 base::RetainedRef(std::move(sb_context)), | |
782 UIThreadTrampoline( | |
783 base::Bind(&BrowsingDataRemover::OnClearedCookies, | |
784 weak_ptr_factory_.GetWeakPtr())))); | |
785 } else { | |
786 BrowserThread::PostTask( | |
787 BrowserThread::IO, FROM_HERE, | |
788 base::Bind(&ClearCookiesWithPredicateOnIOThread, delete_begin_, | |
789 delete_end_, filter_builder.BuildCookieFilter(), | |
790 base::RetainedRef(std::move(sb_context)), | |
791 UIThreadTrampoline( | |
792 base::Bind(&BrowsingDataRemover::OnClearedCookies, | |
793 weak_ptr_factory_.GetWeakPtr())))); | |
794 } | |
795 } | |
796 } | |
797 | |
798 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); | |
799 } | |
800 | |
801 // Channel IDs are not separated for protected and unprotected web | 429 // Channel IDs are not separated for protected and unprotected web |
802 // origins. We check the origin_type_mask_ to prevent unintended deletion. | 430 // origins. We check the origin_type_mask_ to prevent unintended deletion. |
803 if (remove_mask & REMOVE_CHANNEL_IDS && | 431 if (remove_mask & REMOVE_CHANNEL_IDS && |
804 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 432 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
805 content::RecordAction( | 433 content::RecordAction( |
806 UserMetricsAction("ClearBrowsingData_ChannelIDs")); | 434 UserMetricsAction("ClearBrowsingData_ChannelIDs")); |
807 // Since we are running on the UI thread don't call GetURLRequestContext(). | 435 // Since we are running on the UI thread don't call GetURLRequestContext(). |
808 scoped_refptr<net::URLRequestContextGetter> rq_context = | 436 scoped_refptr<net::URLRequestContextGetter> rq_context = |
809 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 437 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
810 GetURLRequestContext(); | 438 GetURLRequestContext(); |
811 waiting_for_clear_channel_ids_ = true; | 439 clear_channel_ids_.Start(); |
812 BrowserThread::PostTask( | 440 BrowserThread::PostTask( |
813 BrowserThread::IO, FROM_HERE, | 441 BrowserThread::IO, FROM_HERE, |
814 base::Bind(&ClearChannelIDsOnIOThread, | 442 base::Bind(&ClearChannelIDsOnIOThread, |
815 filter_builder.BuildChannelIDFilter(), | 443 filter_builder.BuildChannelIDFilter(), |
816 delete_begin_, delete_end_, std::move(rq_context), | 444 delete_begin_, delete_end_, std::move(rq_context), |
817 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs, | 445 clear_channel_ids_.GetCompletionCallback())); |
818 weak_ptr_factory_.GetWeakPtr()))); | |
819 } | 446 } |
820 | 447 |
821 if (remove_mask & REMOVE_DURABLE_PERMISSION) { | 448 ////////////////////////////////////////////////////////////////////////////// |
822 HostContentSettingsMapFactory::GetForProfile(profile_) | 449 // STORAGE PARTITION DATA |
823 ->ClearSettingsForOneTypeWithPredicate( | 450 uint32_t storage_partition_remove_mask = 0; |
824 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, | 451 |
825 base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter)); | 452 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, |
453 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB | |
454 // don't accidentally remove the cookies that are associated with the | |
455 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | |
456 // between UNPROTECTED_WEB and PROTECTED_WEB. | |
457 if (remove_mask & REMOVE_COOKIES && | |
458 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | |
459 storage_partition_remove_mask |= | |
460 content::StoragePartition::REMOVE_DATA_MASK_COOKIES; | |
826 } | 461 } |
827 | |
828 if (remove_mask & REMOVE_LOCAL_STORAGE) { | 462 if (remove_mask & REMOVE_LOCAL_STORAGE) { |
829 storage_partition_remove_mask |= | 463 storage_partition_remove_mask |= |
830 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 464 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
831 } | 465 } |
832 | |
833 if (remove_mask & REMOVE_INDEXEDDB) { | 466 if (remove_mask & REMOVE_INDEXEDDB) { |
834 storage_partition_remove_mask |= | 467 storage_partition_remove_mask |= |
835 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; | 468 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; |
836 } | 469 } |
837 if (remove_mask & REMOVE_WEBSQL) { | 470 if (remove_mask & REMOVE_WEBSQL) { |
838 storage_partition_remove_mask |= | 471 storage_partition_remove_mask |= |
839 content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; | 472 content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; |
840 } | 473 } |
841 if (remove_mask & REMOVE_APPCACHE) { | 474 if (remove_mask & REMOVE_APPCACHE) { |
842 storage_partition_remove_mask |= | 475 storage_partition_remove_mask |= |
843 content::StoragePartition::REMOVE_DATA_MASK_APPCACHE; | 476 content::StoragePartition::REMOVE_DATA_MASK_APPCACHE; |
844 } | 477 } |
845 if (remove_mask & REMOVE_SERVICE_WORKERS) { | 478 if (remove_mask & REMOVE_SERVICE_WORKERS) { |
846 storage_partition_remove_mask |= | 479 storage_partition_remove_mask |= |
847 content::StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; | 480 content::StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; |
848 } | 481 } |
849 if (remove_mask & REMOVE_CACHE_STORAGE) { | 482 if (remove_mask & REMOVE_CACHE_STORAGE) { |
850 storage_partition_remove_mask |= | 483 storage_partition_remove_mask |= |
851 content::StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE; | 484 content::StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE; |
852 } | 485 } |
853 if (remove_mask & REMOVE_FILE_SYSTEMS) { | 486 if (remove_mask & REMOVE_FILE_SYSTEMS) { |
854 storage_partition_remove_mask |= | 487 storage_partition_remove_mask |= |
855 content::StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; | 488 content::StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; |
856 } | 489 } |
857 | 490 |
491 // Content Decryption Modules used by Encrypted Media store licenses in a | |
492 // private filesystem. These are different than content licenses used by | |
493 // Flash (which are deleted father down in this method). | |
494 if (remove_mask & REMOVE_MEDIA_LICENSES) { | |
495 storage_partition_remove_mask |= | |
496 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; | |
497 } | |
498 | |
499 if (storage_partition_remove_mask) { | |
500 clear_storage_partition_data_.Start(); | |
501 | |
502 content::StoragePartition* storage_partition; | |
503 if (storage_partition_for_testing_) | |
504 storage_partition = storage_partition_for_testing_; | |
505 else | |
506 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); | |
507 | |
508 uint32_t quota_storage_remove_mask = | |
509 ~content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | |
510 | |
511 if (delete_begin_ == base::Time() || | |
512 origin_type_mask_ & | |
513 (BrowsingDataHelper::PROTECTED_WEB | BrowsingDataHelper::EXTENSION)) { | |
514 // If we're deleting since the beginning of time, or we're removing | |
515 // protected origins, then remove persistent quota data. | |
516 quota_storage_remove_mask |= | |
517 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | |
518 } | |
519 | |
520 // If cookies are supposed to be conditionally deleted from the storage | |
521 // partition, create a cookie matcher function. | |
522 content::StoragePartition::CookieMatcherFunction cookie_matcher; | |
523 if (!filter_builder.IsEmptyBlacklist() && | |
524 (storage_partition_remove_mask & | |
525 content::StoragePartition::REMOVE_DATA_MASK_COOKIES)) { | |
526 cookie_matcher = filter_builder.BuildCookieFilter(); | |
527 } | |
528 | |
529 storage_partition->ClearData( | |
530 storage_partition_remove_mask, quota_storage_remove_mask, | |
531 base::Bind(&DoesOriginMatchMaskAndUrls, origin_type_mask_, filter), | |
532 cookie_matcher, delete_begin_, delete_end_, | |
533 clear_storage_partition_data_.GetCompletionCallback()); | |
534 } | |
535 | |
536 ////////////////////////////////////////////////////////////////////////////// | |
537 // REMOVE_PLUGINS | |
858 #if BUILDFLAG(ENABLE_PLUGINS) | 538 #if BUILDFLAG(ENABLE_PLUGINS) |
859 // Plugin is data not separated for protected and unprotected web origins. We | 539 // Plugin is data not separated for protected and unprotected web origins. We |
860 // check the origin_type_mask_ to prevent unintended deletion. | 540 // check the origin_type_mask_ to prevent unintended deletion. |
861 if (remove_mask & REMOVE_PLUGIN_DATA && | 541 if (remove_mask & REMOVE_PLUGIN_DATA && |
862 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 542 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
863 content::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); | 543 content::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); |
864 waiting_for_clear_plugin_data_count_ = 1; | 544 clear_plugin_data_count_ = 1; |
865 | 545 |
866 if (filter_builder.IsEmptyBlacklist()) { | 546 if (filter_builder.IsEmptyBlacklist()) { |
867 DCHECK(!plugin_data_remover_); | 547 DCHECK(!plugin_data_remover_); |
868 plugin_data_remover_.reset(content::PluginDataRemover::Create(profile_)); | 548 plugin_data_remover_.reset(content::PluginDataRemover::Create(profile_)); |
869 base::WaitableEvent* event = | 549 base::WaitableEvent* event = |
870 plugin_data_remover_->StartRemoving(delete_begin_); | 550 plugin_data_remover_->StartRemoving(delete_begin_); |
871 | 551 |
872 base::WaitableEventWatcher::EventCallback watcher_callback = | 552 base::WaitableEventWatcher::EventCallback watcher_callback = |
873 base::Bind(&BrowsingDataRemover::OnWaitableEventSignaled, | 553 base::Bind(&BrowsingDataRemover::OnWaitableEventSignaled, |
874 weak_ptr_factory_.GetWeakPtr()); | 554 weak_ptr_factory_.GetWeakPtr()); |
875 watcher_.StartWatching(event, watcher_callback); | 555 watcher_.StartWatching(event, watcher_callback); |
876 } else { | 556 } else { |
877 // TODO(msramek): Store filters from the currently executed task on the | 557 // TODO(msramek): Store filters from the currently executed task on the |
878 // object to avoid having to copy them to callback methods. | 558 // object to avoid having to copy them to callback methods. |
879 flash_lso_helper_->StartFetching(base::Bind( | 559 flash_lso_helper_->StartFetching(base::Bind( |
880 &BrowsingDataRemover::OnSitesWithFlashDataFetched, | 560 &BrowsingDataRemover::OnSitesWithFlashDataFetched, |
881 weak_ptr_factory_.GetWeakPtr(), | 561 weak_ptr_factory_.GetWeakPtr(), |
882 filter_builder.BuildPluginFilter())); | 562 filter_builder.BuildPluginFilter())); |
883 } | 563 } |
884 } | 564 } |
885 #endif | 565 #endif |
886 | 566 |
887 if (remove_mask & REMOVE_SITE_USAGE_DATA) { | 567 ////////////////////////////////////////////////////////////////////////////// |
888 HostContentSettingsMapFactory::GetForProfile(profile_) | 568 // CACHE |
889 ->ClearSettingsForOneTypeWithPredicate( | |
890 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, | |
891 base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter)); | |
892 } | |
893 | |
894 if (remove_mask & REMOVE_SITE_USAGE_DATA || remove_mask & REMOVE_HISTORY) { | |
895 HostContentSettingsMapFactory::GetForProfile(profile_) | |
896 ->ClearSettingsForOneTypeWithPredicate( | |
897 CONTENT_SETTINGS_TYPE_APP_BANNER, | |
898 base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter)); | |
899 | |
900 PermissionDecisionAutoBlocker::RemoveCountsByUrl(profile_, filter); | |
901 } | |
902 | |
903 if (remove_mask & REMOVE_PASSWORDS) { | |
904 content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); | |
905 password_manager::PasswordStore* password_store = | |
906 PasswordStoreFactory::GetForProfile( | |
907 profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); | |
908 | |
909 if (password_store) { | |
910 waiting_for_clear_passwords_ = true; | |
911 auto on_cleared_passwords = | |
912 base::Bind(&BrowsingDataRemover::OnClearedPasswords, | |
913 weak_ptr_factory_.GetWeakPtr()); | |
914 password_store->RemoveLoginsByURLAndTime( | |
915 filter, delete_begin_, delete_end_, on_cleared_passwords); | |
916 } | |
917 } | |
918 | |
919 if (remove_mask & REMOVE_COOKIES) { | |
920 password_manager::PasswordStore* password_store = | |
921 PasswordStoreFactory::GetForProfile(profile_, | |
922 ServiceAccessType::EXPLICIT_ACCESS) | |
923 .get(); | |
924 | |
925 if (password_store) { | |
926 waiting_for_clear_auto_sign_in_ = true; | |
927 base::Closure on_cleared_auto_sign_in = | |
928 base::Bind(&BrowsingDataRemover::OnClearedAutoSignIn, | |
929 weak_ptr_factory_.GetWeakPtr()); | |
930 password_store->DisableAutoSignInForOrigins( | |
931 filter, on_cleared_auto_sign_in); | |
932 } | |
933 } | |
934 | |
935 if (remove_mask & REMOVE_HISTORY) { | |
936 password_manager::PasswordStore* password_store = | |
937 PasswordStoreFactory::GetForProfile( | |
938 profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); | |
939 | |
940 if (password_store) { | |
941 waiting_for_clear_passwords_stats_ = true; | |
942 password_store->RemoveStatisticsByOriginAndTime( | |
943 nullable_filter, delete_begin_, delete_end_, | |
944 base::Bind(&BrowsingDataRemover::OnClearedPasswordsStats, | |
945 weak_ptr_factory_.GetWeakPtr())); | |
946 } | |
947 } | |
948 | |
949 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | |
950 if (remove_mask & REMOVE_FORM_DATA) { | |
951 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); | |
952 scoped_refptr<autofill::AutofillWebDataService> web_data_service = | |
953 WebDataServiceFactory::GetAutofillWebDataForProfile( | |
954 profile_, ServiceAccessType::EXPLICIT_ACCESS); | |
955 | |
956 if (web_data_service.get()) { | |
957 waiting_for_clear_form_ = true; | |
958 web_data_service->RemoveFormElementsAddedBetween(delete_begin_, | |
959 delete_end_); | |
960 web_data_service->RemoveAutofillDataModifiedBetween( | |
961 delete_begin_, delete_end_); | |
962 // The above calls are done on the UI thread but do their work on the DB | |
963 // thread. So wait for it. | |
964 BrowserThread::PostTaskAndReply( | |
965 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | |
966 base::Bind(&BrowsingDataRemover::OnClearedFormData, | |
967 weak_ptr_factory_.GetWeakPtr())); | |
968 | |
969 autofill::PersonalDataManager* data_manager = | |
970 autofill::PersonalDataManagerFactory::GetForProfile(profile_); | |
971 if (data_manager) | |
972 data_manager->Refresh(); | |
973 } | |
974 } | |
975 | |
976 if (remove_mask & REMOVE_CACHE) { | 569 if (remove_mask & REMOVE_CACHE) { |
977 // Tell the renderers to clear their cache. | 570 // Tell the renderers to clear their cache. |
978 web_cache::WebCacheManager::GetInstance()->ClearCache(); | 571 web_cache::WebCacheManager::GetInstance()->ClearCache(); |
979 | 572 |
980 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); | 573 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); |
981 | 574 |
982 waiting_for_clear_cache_ = true; | 575 clear_cache_.Start(); |
983 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. | 576 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. |
984 if (filter_builder.IsEmptyBlacklist()) { | 577 if (filter_builder.IsEmptyBlacklist()) { |
985 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( | 578 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( |
986 BrowserContext::GetDefaultStoragePartition(profile_), | 579 BrowserContext::GetDefaultStoragePartition(profile_), |
987 delete_begin_, delete_end_) | 580 delete_begin_, delete_end_) |
988 ->Remove(base::Bind(&BrowsingDataRemover::ClearedCache, | 581 ->Remove(clear_cache_.GetCompletionCallback()); |
989 weak_ptr_factory_.GetWeakPtr())); | |
990 } else { | 582 } else { |
991 browsing_data::StoragePartitionHttpCacheDataRemover:: | 583 browsing_data::StoragePartitionHttpCacheDataRemover:: |
992 CreateForURLsAndRange( | 584 CreateForURLsAndRange( |
993 BrowserContext::GetDefaultStoragePartition(profile_), | 585 BrowserContext::GetDefaultStoragePartition(profile_), |
994 filter, delete_begin_, delete_end_) | 586 filter, delete_begin_, delete_end_) |
995 ->Remove(base::Bind(&BrowsingDataRemover::ClearedCache, | 587 ->Remove(clear_cache_.GetCompletionCallback()); |
996 weak_ptr_factory_.GetWeakPtr())); | |
997 } | |
998 | |
999 #if !defined(DISABLE_NACL) | |
1000 waiting_for_clear_nacl_cache_ = true; | |
1001 | |
1002 BrowserThread::PostTask( | |
1003 BrowserThread::IO, FROM_HERE, | |
1004 base::Bind(&ClearNaClCacheOnIOThread, | |
1005 UIThreadTrampoline( | |
1006 base::Bind(&BrowsingDataRemover::ClearedNaClCache, | |
1007 weak_ptr_factory_.GetWeakPtr())))); | |
1008 | |
1009 waiting_for_clear_pnacl_cache_ = true; | |
1010 BrowserThread::PostTask( | |
1011 BrowserThread::IO, FROM_HERE, | |
1012 base::Bind(&ClearPnaclCacheOnIOThread, delete_begin_, delete_end_, | |
1013 UIThreadTrampoline( | |
1014 base::Bind(&BrowsingDataRemover::ClearedPnaclCache, | |
1015 weak_ptr_factory_.GetWeakPtr())))); | |
1016 #endif | |
1017 | |
1018 // The PrerenderManager may have a page actively being prerendered, which | |
1019 // is essentially a preemptively cached page. | |
1020 prerender::PrerenderManager* prerender_manager = | |
1021 prerender::PrerenderManagerFactory::GetForBrowserContext(profile_); | |
1022 if (prerender_manager) { | |
1023 prerender_manager->ClearData( | |
1024 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS); | |
1025 } | 588 } |
1026 | 589 |
1027 // Tell the shader disk cache to clear. | 590 // Tell the shader disk cache to clear. |
1028 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); | 591 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); |
1029 storage_partition_remove_mask |= | 592 storage_partition_remove_mask |= |
1030 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; | 593 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; |
1031 | |
1032 // When clearing cache, wipe accumulated network related data | |
1033 // (TransportSecurityState and HttpServerPropertiesManager data). | |
1034 waiting_for_clear_networking_history_ = true; | |
1035 profile_->ClearNetworkingHistorySince( | |
1036 delete_begin_, | |
1037 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, | |
1038 weak_ptr_factory_.GetWeakPtr())); | |
1039 | |
1040 ntp_snippets::ContentSuggestionsService* content_suggestions_service = | |
1041 ContentSuggestionsServiceFactory::GetForProfileIfExists(profile_); | |
1042 if (content_suggestions_service) | |
1043 content_suggestions_service->ClearAllCachedSuggestions(); | |
1044 | |
1045 // |ui_nqe_service| may be null if |profile_| is not a regular profile. | |
1046 UINetworkQualityEstimatorService* ui_nqe_service = | |
1047 UINetworkQualityEstimatorServiceFactory::GetForProfile(profile_); | |
1048 DCHECK(profile_->GetProfileType() != | |
1049 Profile::ProfileType::REGULAR_PROFILE || | |
1050 ui_nqe_service != nullptr); | |
1051 if (ui_nqe_service) { | |
1052 // Network Quality Estimator (NQE) stores the quality (RTT, bandwidth | |
1053 // etc.) of different networks in prefs. The stored quality is not | |
1054 // broken down by URLs or timestamps, so clearing the cache should | |
1055 // completely clear the prefs. | |
1056 ui_nqe_service->ClearPrefs(); | |
1057 } | |
1058 } | 594 } |
1059 | 595 |
596 ////////////////////////////////////////////////////////////////////////////// | |
597 // Auth cache. | |
1060 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) { | 598 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) { |
1061 scoped_refptr<net::URLRequestContextGetter> request_context = | 599 scoped_refptr<net::URLRequestContextGetter> request_context = |
1062 profile_->GetRequestContext(); | 600 profile_->GetRequestContext(); |
1063 waiting_for_clear_http_auth_cache_ = true; | 601 clear_http_auth_cache_.Start(); |
1064 BrowserThread::PostTaskAndReply( | 602 BrowserThread::PostTaskAndReply( |
1065 BrowserThread::IO, FROM_HERE, | 603 BrowserThread::IO, FROM_HERE, |
1066 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), | 604 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), |
1067 delete_begin_), | 605 delete_begin_), |
1068 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache, | 606 clear_http_auth_cache_.GetCompletionCallback()); |
1069 weak_ptr_factory_.GetWeakPtr())); | |
1070 } | 607 } |
1071 | 608 |
1072 // Content Decryption Modules used by Encrypted Media store licenses in a | 609 ////////////////////////////////////////////////////////////////////////////// |
1073 // private filesystem. These are different than content licenses used by | 610 // Embedder data. |
1074 // Flash (which are deleted father down in this method). | 611 if (embedder_delegate_) { |
1075 if (remove_mask & REMOVE_MEDIA_LICENSES) { | 612 clear_embedder_data_.Start(); |
1076 storage_partition_remove_mask |= | 613 embedder_delegate_->RemoveEmbedderData( |
1077 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; | 614 delete_begin_, |
1078 } | 615 delete_end_, |
1079 | 616 remove_mask, |
1080 if (storage_partition_remove_mask) { | 617 filter_builder, |
1081 waiting_for_clear_storage_partition_data_ = true; | 618 origin_type_mask, |
1082 | 619 clear_embedder_data_.GetCompletionCallback()); |
1083 content::StoragePartition* storage_partition; | |
1084 if (storage_partition_for_testing_) | |
1085 storage_partition = storage_partition_for_testing_; | |
1086 else | |
1087 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); | |
1088 | |
1089 uint32_t quota_storage_remove_mask = | |
1090 ~content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | |
1091 | |
1092 if (delete_begin_ == base::Time() || | |
1093 origin_type_mask_ & | |
1094 (BrowsingDataHelper::PROTECTED_WEB | BrowsingDataHelper::EXTENSION)) { | |
1095 // If we're deleting since the beginning of time, or we're removing | |
1096 // protected origins, then remove persistent quota data. | |
1097 quota_storage_remove_mask |= | |
1098 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | |
1099 } | |
1100 | |
1101 // If cookies are supposed to be conditionally deleted from the storage | |
1102 // partition, create a cookie matcher function. | |
1103 content::StoragePartition::CookieMatcherFunction cookie_matcher; | |
1104 if (!filter_builder.IsEmptyBlacklist() && | |
1105 (storage_partition_remove_mask & | |
1106 content::StoragePartition::REMOVE_DATA_MASK_COOKIES)) { | |
1107 cookie_matcher = filter_builder.BuildCookieFilter(); | |
1108 } | |
1109 | |
1110 storage_partition->ClearData( | |
1111 storage_partition_remove_mask, quota_storage_remove_mask, | |
1112 base::Bind(&DoesOriginMatchMaskAndUrls, origin_type_mask_, filter), | |
1113 cookie_matcher, delete_begin_, delete_end_, | |
1114 base::Bind(&BrowsingDataRemover::OnClearedStoragePartitionData, | |
1115 weak_ptr_factory_.GetWeakPtr())); | |
1116 } | |
1117 | |
1118 if (remove_mask & REMOVE_MEDIA_LICENSES) { | |
1119 // TODO(jrummell): This UMA should be renamed to indicate it is for Media | |
1120 // Licenses. | |
1121 content::RecordAction( | |
1122 UserMetricsAction("ClearBrowsingData_ContentLicenses")); | |
1123 | |
1124 #if BUILDFLAG(ENABLE_PLUGINS) | |
1125 waiting_for_clear_flash_content_licenses_ = true; | |
1126 if (!pepper_flash_settings_manager_.get()) { | |
1127 pepper_flash_settings_manager_.reset( | |
1128 new PepperFlashSettingsManager(this, profile_)); | |
1129 } | |
1130 deauthorize_flash_content_licenses_request_id_ = | |
1131 pepper_flash_settings_manager_->DeauthorizeContentLicenses(prefs); | |
1132 #if defined(OS_CHROMEOS) | |
1133 // On Chrome OS, also delete any content protection platform keys. | |
1134 const user_manager::User* user = | |
1135 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | |
1136 if (!user) { | |
1137 LOG(WARNING) << "Failed to find user for current profile."; | |
1138 } else { | |
1139 chromeos::DBusThreadManager::Get() | |
1140 ->GetCryptohomeClient() | |
1141 ->TpmAttestationDeleteKeys( | |
1142 chromeos::attestation::KEY_USER, | |
1143 cryptohome::Identification(user->GetAccountId()), | |
1144 chromeos::attestation::kContentProtectionKeyPrefix, | |
1145 base::Bind(&BrowsingDataRemover::OnClearPlatformKeys, | |
1146 weak_ptr_factory_.GetWeakPtr())); | |
1147 waiting_for_clear_platform_keys_ = true; | |
1148 } | |
1149 #endif // defined(OS_CHROMEOS) | |
1150 #endif // BUILDFLAG(ENABLE_PLUGINS) | |
1151 } | |
1152 | |
1153 // Remove omnibox zero-suggest cache results. Filtering is not supported. | |
1154 // This is not a problem, as deleting more data than necessary will just cause | |
1155 // another server round-trip; no data is actually lost. | |
1156 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES))) | |
1157 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); | |
1158 | |
1159 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { | |
1160 domain_reliability::DomainReliabilityService* service = | |
1161 domain_reliability::DomainReliabilityServiceFactory:: | |
1162 GetForBrowserContext(profile_); | |
1163 if (service) { | |
1164 domain_reliability::DomainReliabilityClearMode mode; | |
1165 if (remove_mask & REMOVE_COOKIES) | |
1166 mode = domain_reliability::CLEAR_CONTEXTS; | |
1167 else | |
1168 mode = domain_reliability::CLEAR_BEACONS; | |
1169 | |
1170 waiting_for_clear_domain_reliability_monitor_ = true; | |
1171 service->ClearBrowsingData( | |
1172 mode, | |
1173 filter, | |
1174 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | |
1175 weak_ptr_factory_.GetWeakPtr())); | |
1176 } | |
1177 } | |
1178 | |
1179 #if BUILDFLAG(ANDROID_JAVA_UI) | |
1180 // Clear all data associated with registered webapps. | |
1181 if (remove_mask & REMOVE_WEBAPP_DATA) | |
1182 webapp_registry_->UnregisterWebappsForUrls(filter); | |
1183 | |
1184 // For now we're considering offline pages as cache, so if we're removing | |
1185 // cache we should remove offline pages as well. | |
1186 if ((remove_mask & REMOVE_CACHE)) { | |
1187 waiting_for_clear_offline_page_data_ = true; | |
1188 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) | |
1189 ->DeleteCachedPagesByURLPredicate( | |
1190 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, | |
1191 weak_ptr_factory_.GetWeakPtr())); | |
1192 } | |
1193 #endif | |
1194 | |
1195 // Record the combined deletion of cookies and cache. | |
1196 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; | |
1197 if (remove_mask & REMOVE_COOKIES && | |
1198 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | |
1199 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE | |
1200 : ONLY_COOKIES; | |
1201 } else if (remove_mask & REMOVE_CACHE) { | |
1202 choice = ONLY_CACHE; | |
1203 } | 620 } |
1204 | 621 |
1205 // Notify in case all actions taken were synchronous. | 622 // Notify in case all actions taken were synchronous. |
1206 waiting_for_synchronous_clear_operations_ = false; | 623 synchronous_clear_operations_.GetCompletionCallback().Run(); |
1207 NotifyIfDone(); | |
1208 | |
1209 UMA_HISTOGRAM_ENUMERATION( | |
1210 "History.ClearBrowsingData.UserDeletedCookieOrCache", | |
1211 choice, MAX_CHOICE_VALUE); | |
1212 } | 624 } |
1213 | 625 |
1214 void BrowsingDataRemover::AddObserver(Observer* observer) { | 626 void BrowsingDataRemover::AddObserver(Observer* observer) { |
1215 observer_list_.AddObserver(observer); | 627 observer_list_.AddObserver(observer); |
1216 } | 628 } |
1217 | 629 |
1218 void BrowsingDataRemover::RemoveObserver(Observer* observer) { | 630 void BrowsingDataRemover::RemoveObserver(Observer* observer) { |
1219 observer_list_.RemoveObserver(observer); | 631 observer_list_.RemoveObserver(observer); |
1220 } | 632 } |
1221 | 633 |
1222 void BrowsingDataRemover::OverrideStoragePartitionForTesting( | 634 void BrowsingDataRemover::OverrideStoragePartitionForTesting( |
1223 content::StoragePartition* storage_partition) { | 635 content::StoragePartition* storage_partition) { |
1224 storage_partition_for_testing_ = storage_partition; | 636 storage_partition_for_testing_ = storage_partition; |
1225 } | 637 } |
1226 | 638 |
1227 #if BUILDFLAG(ANDROID_JAVA_UI) | |
1228 void BrowsingDataRemover::OverrideWebappRegistryForTesting( | |
1229 std::unique_ptr<WebappRegistry> webapp_registry) { | |
1230 webapp_registry_ = std::move(webapp_registry); | |
1231 } | |
1232 #endif | |
1233 | |
1234 #if BUILDFLAG(ENABLE_PLUGINS) | 639 #if BUILDFLAG(ENABLE_PLUGINS) |
1235 void BrowsingDataRemover::OverrideFlashLSOHelperForTesting( | 640 void BrowsingDataRemover::OverrideFlashLSOHelperForTesting( |
1236 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper) { | 641 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper) { |
1237 flash_lso_helper_ = flash_lso_helper; | 642 flash_lso_helper_ = flash_lso_helper; |
1238 } | 643 } |
1239 #endif | 644 #endif |
1240 | 645 |
1241 const base::Time& BrowsingDataRemover::GetLastUsedBeginTime() { | 646 const base::Time& BrowsingDataRemover::GetLastUsedBeginTime() { |
1242 return delete_begin_; | 647 return delete_begin_; |
1243 } | 648 } |
(...skipping 18 matching lines...) Expand all Loading... | |
1262 Observer* observer) | 667 Observer* observer) |
1263 : time_range(time_range), | 668 : time_range(time_range), |
1264 remove_mask(remove_mask), | 669 remove_mask(remove_mask), |
1265 origin_type_mask(origin_type_mask), | 670 origin_type_mask(origin_type_mask), |
1266 filter_builder(std::move(filter_builder)), | 671 filter_builder(std::move(filter_builder)), |
1267 observer(observer) {} | 672 observer(observer) {} |
1268 | 673 |
1269 BrowsingDataRemover::RemovalTask::~RemovalTask() {} | 674 BrowsingDataRemover::RemovalTask::~RemovalTask() {} |
1270 | 675 |
1271 bool BrowsingDataRemover::AllDone() { | 676 bool BrowsingDataRemover::AllDone() { |
1272 return !waiting_for_synchronous_clear_operations_ && | 677 return !synchronous_clear_operations_.is_pending() && |
1273 !waiting_for_clear_autofill_origin_urls_ && | 678 !clear_embedder_data_.is_pending() && |
1274 !waiting_for_clear_cache_ && | 679 !clear_cache_.is_pending() && |
1275 !waiting_for_clear_flash_content_licenses_ && | 680 !clear_channel_ids_.is_pending() && |
1276 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && | 681 !clear_http_auth_cache_.is_pending() && |
1277 !waiting_for_clear_domain_reliability_monitor_ && | 682 !clear_storage_partition_data_.is_pending() && |
1278 !waiting_for_clear_form_ && !waiting_for_clear_history_ && | 683 !clear_plugin_data_count_; |
1279 !waiting_for_clear_hostname_resolution_cache_ && | |
1280 !waiting_for_clear_http_auth_cache_ && | |
1281 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && | |
1282 !waiting_for_clear_network_predictor_ && | |
1283 !waiting_for_clear_networking_history_ && | |
1284 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && | |
1285 !waiting_for_clear_platform_keys_ && | |
1286 !waiting_for_clear_plugin_data_count_ && | |
1287 !waiting_for_clear_pnacl_cache_ && | |
1288 #if BUILDFLAG(ANDROID_JAVA_UI) | |
1289 !waiting_for_clear_precache_history_ && | |
1290 !waiting_for_clear_offline_page_data_ && | |
1291 #endif | |
1292 #if BUILDFLAG(ENABLE_WEBRTC) | |
1293 !waiting_for_clear_webrtc_logs_ && | |
1294 #endif | |
1295 !waiting_for_clear_storage_partition_data_ && | |
1296 !waiting_for_clear_auto_sign_in_; | |
1297 } | |
1298 | |
1299 void BrowsingDataRemover::OnKeywordsLoaded( | |
1300 base::Callback<bool(const GURL&)> url_filter) { | |
1301 // Deletes the entries from the model, and if we're not waiting on anything | |
1302 // else notifies observers and deletes this BrowsingDataRemover. | |
1303 TemplateURLService* model = | |
1304 TemplateURLServiceFactory::GetForProfile(profile_); | |
1305 model->RemoveAutoGeneratedForUrlsBetween(url_filter, delete_begin_, | |
1306 delete_end_); | |
1307 waiting_for_clear_keyword_data_ = false; | |
1308 template_url_sub_.reset(); | |
1309 NotifyIfDone(); | |
1310 } | 684 } |
1311 | 685 |
1312 void BrowsingDataRemover::Notify() { | 686 void BrowsingDataRemover::Notify() { |
1313 // Some tests call |RemoveImpl| directly, without using the task scheduler. | 687 // Some tests call |RemoveImpl| directly, without using the task scheduler. |
1314 // TODO(msramek): Improve those tests so we don't have to do this. Tests | 688 // TODO(msramek): Improve those tests so we don't have to do this. Tests |
1315 // relying on |RemoveImpl| do so because they need to pass in | 689 // relying on |RemoveImpl| do so because they need to pass in |
1316 // BrowsingDataFilterBuilder while still keeping ownership of it. Making | 690 // BrowsingDataFilterBuilder while still keeping ownership of it. Making |
1317 // BrowsingDataFilterBuilder copyable would solve this. | 691 // BrowsingDataFilterBuilder copyable would solve this. |
1318 if (!is_removing_) { | 692 if (!is_removing_) { |
1319 DCHECK(task_queue_.empty()); | 693 DCHECK(task_queue_.empty()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1357 if (completion_inhibitor_) { | 731 if (completion_inhibitor_) { |
1358 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( | 732 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( |
1359 this, base::Bind(&BrowsingDataRemover::Notify, | 733 this, base::Bind(&BrowsingDataRemover::Notify, |
1360 weak_ptr_factory_.GetWeakPtr())); | 734 weak_ptr_factory_.GetWeakPtr())); |
1361 return; | 735 return; |
1362 } | 736 } |
1363 | 737 |
1364 Notify(); | 738 Notify(); |
1365 } | 739 } |
1366 | 740 |
1367 void BrowsingDataRemover::OnHistoryDeletionDone() { | |
1368 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1369 waiting_for_clear_history_ = false; | |
1370 NotifyIfDone(); | |
1371 } | |
1372 | |
1373 void BrowsingDataRemover::OnClearedHostnameResolutionCache() { | |
1374 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1375 waiting_for_clear_hostname_resolution_cache_ = false; | |
1376 NotifyIfDone(); | |
1377 } | |
1378 | |
1379 void BrowsingDataRemover::OnClearedHttpAuthCache() { | |
1380 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1381 waiting_for_clear_http_auth_cache_ = false; | |
1382 NotifyIfDone(); | |
1383 } | |
1384 | |
1385 void BrowsingDataRemover::OnClearedNetworkPredictor() { | |
1386 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1387 waiting_for_clear_network_predictor_ = false; | |
1388 NotifyIfDone(); | |
1389 } | |
1390 | |
1391 void BrowsingDataRemover::OnClearedNetworkingHistory() { | |
1392 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1393 waiting_for_clear_networking_history_ = false; | |
1394 NotifyIfDone(); | |
1395 } | |
1396 | |
1397 void BrowsingDataRemover::ClearedCache() { | |
1398 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1399 waiting_for_clear_cache_ = false; | |
1400 NotifyIfDone(); | |
1401 } | |
1402 | |
1403 #if !defined(DISABLE_NACL) | |
1404 void BrowsingDataRemover::ClearedNaClCache() { | |
1405 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1406 waiting_for_clear_nacl_cache_ = false; | |
1407 NotifyIfDone(); | |
1408 } | |
1409 | |
1410 void BrowsingDataRemover::ClearedPnaclCache() { | |
1411 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1412 waiting_for_clear_pnacl_cache_ = false; | |
1413 NotifyIfDone(); | |
1414 } | |
1415 #endif | |
1416 | |
1417 #if BUILDFLAG(ENABLE_PLUGINS) | 741 #if BUILDFLAG(ENABLE_PLUGINS) |
1418 void BrowsingDataRemover::OnWaitableEventSignaled( | 742 void BrowsingDataRemover::OnWaitableEventSignaled( |
1419 base::WaitableEvent* waitable_event) { | 743 base::WaitableEvent* waitable_event) { |
1420 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 744 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1421 | 745 |
1422 DCHECK_EQ(1, waiting_for_clear_plugin_data_count_); | 746 DCHECK_EQ(1, clear_plugin_data_count_); |
1423 waiting_for_clear_plugin_data_count_ = 0; | 747 clear_plugin_data_count_ = 0; |
1424 | 748 |
1425 plugin_data_remover_.reset(); | 749 plugin_data_remover_.reset(); |
1426 watcher_.StopWatching(); | 750 watcher_.StopWatching(); |
1427 NotifyIfDone(); | 751 NotifyIfDone(); |
1428 } | 752 } |
1429 | 753 |
1430 void BrowsingDataRemover::OnSitesWithFlashDataFetched( | 754 void BrowsingDataRemover::OnSitesWithFlashDataFetched( |
1431 base::Callback<bool(const std::string&)> plugin_filter, | 755 base::Callback<bool(const std::string&)> plugin_filter, |
1432 const std::vector<std::string>& sites) { | 756 const std::vector<std::string>& sites) { |
1433 DCHECK_EQ(1, waiting_for_clear_plugin_data_count_); | 757 DCHECK_EQ(1, clear_plugin_data_count_); |
1434 waiting_for_clear_plugin_data_count_ = 0; | 758 clear_plugin_data_count_ = 0; |
1435 | 759 |
1436 std::vector<std::string> sites_to_delete; | 760 std::vector<std::string> sites_to_delete; |
1437 for (const std::string& site : sites) { | 761 for (const std::string& site : sites) { |
1438 if (plugin_filter.Run(site)) | 762 if (plugin_filter.Run(site)) |
1439 sites_to_delete.push_back(site); | 763 sites_to_delete.push_back(site); |
1440 } | 764 } |
1441 | 765 |
1442 waiting_for_clear_plugin_data_count_ = sites_to_delete.size(); | 766 clear_plugin_data_count_ = sites_to_delete.size(); |
1443 | 767 |
1444 for (const std::string& site : sites_to_delete) { | 768 for (const std::string& site : sites_to_delete) { |
1445 flash_lso_helper_->DeleteFlashLSOsForSite( | 769 flash_lso_helper_->DeleteFlashLSOsForSite( |
1446 site, | 770 site, |
1447 base::Bind(&BrowsingDataRemover::OnFlashDataDeleted, | 771 base::Bind(&BrowsingDataRemover::OnFlashDataDeleted, |
1448 weak_ptr_factory_.GetWeakPtr())); | 772 weak_ptr_factory_.GetWeakPtr())); |
1449 } | 773 } |
1450 | 774 |
1451 NotifyIfDone(); | 775 NotifyIfDone(); |
1452 } | 776 } |
1453 | 777 |
1454 void BrowsingDataRemover::OnFlashDataDeleted() { | 778 void BrowsingDataRemover::OnFlashDataDeleted() { |
1455 waiting_for_clear_plugin_data_count_--; | 779 clear_plugin_data_count_--; |
1456 NotifyIfDone(); | |
1457 } | |
1458 | |
1459 void BrowsingDataRemover::OnDeauthorizeFlashContentLicensesCompleted( | |
1460 uint32_t request_id, | |
1461 bool /* success */) { | |
1462 DCHECK(waiting_for_clear_flash_content_licenses_); | |
1463 DCHECK_EQ(request_id, deauthorize_flash_content_licenses_request_id_); | |
1464 | |
1465 waiting_for_clear_flash_content_licenses_ = false; | |
1466 NotifyIfDone(); | 780 NotifyIfDone(); |
1467 } | 781 } |
1468 #endif | 782 #endif |
1469 | |
1470 #if defined(OS_CHROMEOS) | |
1471 void BrowsingDataRemover::OnClearPlatformKeys( | |
1472 chromeos::DBusMethodCallStatus call_status, | |
1473 bool result) { | |
1474 DCHECK(waiting_for_clear_platform_keys_); | |
1475 LOG_IF(ERROR, call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || !result) | |
1476 << "Failed to clear platform keys."; | |
1477 waiting_for_clear_platform_keys_ = false; | |
1478 NotifyIfDone(); | |
1479 } | |
1480 #endif | |
1481 | |
1482 | |
1483 void BrowsingDataRemover::OnClearedPasswords() { | |
1484 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1485 waiting_for_clear_passwords_ = false; | |
1486 NotifyIfDone(); | |
1487 } | |
1488 | |
1489 void BrowsingDataRemover::OnClearedPasswordsStats() { | |
1490 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1491 waiting_for_clear_passwords_stats_ = false; | |
1492 NotifyIfDone(); | |
1493 } | |
1494 | |
1495 void BrowsingDataRemover::OnClearedAutoSignIn() { | |
1496 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1497 waiting_for_clear_auto_sign_in_ = false; | |
1498 NotifyIfDone(); | |
1499 } | |
1500 | |
1501 void BrowsingDataRemover::OnClearedCookies() { | |
1502 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1503 | |
1504 DCHECK_GT(waiting_for_clear_cookies_count_, 0); | |
1505 --waiting_for_clear_cookies_count_; | |
1506 NotifyIfDone(); | |
1507 } | |
1508 | |
1509 void BrowsingDataRemover::OnClearedChannelIDs() { | |
1510 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1511 waiting_for_clear_channel_ids_ = false; | |
1512 NotifyIfDone(); | |
1513 } | |
1514 | |
1515 void BrowsingDataRemover::OnClearedFormData() { | |
1516 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1517 waiting_for_clear_form_ = false; | |
1518 NotifyIfDone(); | |
1519 } | |
1520 | |
1521 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { | |
1522 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1523 waiting_for_clear_autofill_origin_urls_ = false; | |
1524 NotifyIfDone(); | |
1525 } | |
1526 | |
1527 void BrowsingDataRemover::OnClearedStoragePartitionData() { | |
1528 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1529 waiting_for_clear_storage_partition_data_ = false; | |
1530 NotifyIfDone(); | |
1531 } | |
1532 | |
1533 #if BUILDFLAG(ENABLE_WEBRTC) | |
1534 void BrowsingDataRemover::OnClearedWebRtcLogs() { | |
1535 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1536 waiting_for_clear_webrtc_logs_ = false; | |
1537 NotifyIfDone(); | |
1538 } | |
1539 #endif | |
1540 | |
1541 #if BUILDFLAG(ANDROID_JAVA_UI) | |
1542 void BrowsingDataRemover::OnClearedPrecacheHistory() { | |
1543 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1544 waiting_for_clear_precache_history_ = false; | |
1545 NotifyIfDone(); | |
1546 } | |
1547 | |
1548 void BrowsingDataRemover::OnClearedOfflinePageData( | |
1549 offline_pages::OfflinePageModel::DeletePageResult result) { | |
1550 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1551 waiting_for_clear_offline_page_data_ = false; | |
1552 NotifyIfDone(); | |
1553 } | |
1554 #endif | |
1555 | |
1556 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | |
1557 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1558 waiting_for_clear_domain_reliability_monitor_ = false; | |
1559 NotifyIfDone(); | |
1560 } | |
OLD | NEW |