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 14 matching lines...) Expand all Loading... |
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* |
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 DCHECK(!forward_callback_.is_null()); |
| 137 } |
| 138 |
| 139 BrowsingDataRemover::SubTask::~SubTask() {} |
| 140 |
| 141 void BrowsingDataRemover::SubTask::Start() { |
| 142 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 143 DCHECK(!is_pending_); |
| 144 is_pending_ = true; |
| 145 } |
| 146 |
| 147 base::Closure BrowsingDataRemover::SubTask::GetCompletionCallback() { |
| 148 return base::Bind(&BrowsingDataRemover::SubTask::CompletionCallback, |
| 149 weak_ptr_factory_.GetWeakPtr()); |
| 150 } |
| 151 |
| 152 void BrowsingDataRemover::SubTask::CompletionCallback() { |
| 153 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 154 DCHECK(is_pending_); |
| 155 is_pending_ = false; |
| 156 forward_callback_.Run(); |
| 157 } |
| 158 |
290 bool BrowsingDataRemover::TimeRange::operator==( | 159 bool BrowsingDataRemover::TimeRange::operator==( |
291 const BrowsingDataRemover::TimeRange& other) const { | 160 const BrowsingDataRemover::TimeRange& other) const { |
292 return begin == other.begin && end == other.end; | 161 return begin == other.begin && end == other.end; |
293 } | 162 } |
294 | 163 |
295 // static | 164 // static |
296 BrowsingDataRemover::TimeRange BrowsingDataRemover::Unbounded() { | 165 BrowsingDataRemover::TimeRange BrowsingDataRemover::Unbounded() { |
297 return TimeRange(base::Time(), base::Time::Max()); | 166 return TimeRange(base::Time(), base::Time::Max()); |
298 } | 167 } |
299 | 168 |
(...skipping 22 matching lines...) Expand all Loading... |
322 | 191 |
323 BrowsingDataRemover::BrowsingDataRemover( | 192 BrowsingDataRemover::BrowsingDataRemover( |
324 content::BrowserContext* browser_context) | 193 content::BrowserContext* browser_context) |
325 : profile_(Profile::FromBrowserContext(browser_context)), | 194 : profile_(Profile::FromBrowserContext(browser_context)), |
326 remove_mask_(-1), | 195 remove_mask_(-1), |
327 origin_type_mask_(-1), | 196 origin_type_mask_(-1), |
328 is_removing_(false), | 197 is_removing_(false), |
329 #if BUILDFLAG(ENABLE_PLUGINS) | 198 #if BUILDFLAG(ENABLE_PLUGINS) |
330 flash_lso_helper_(BrowsingDataFlashLSOHelper::Create(profile_)), | 199 flash_lso_helper_(BrowsingDataFlashLSOHelper::Create(profile_)), |
331 #endif | 200 #endif |
332 #if BUILDFLAG(ANDROID_JAVA_UI) | 201 sub_task_forward_callback_( |
333 webapp_registry_(new WebappRegistry()), | 202 base::Bind(&BrowsingDataRemover::NotifyIfDone, |
334 #endif | 203 base::Unretained(this))), |
| 204 synchronous_clear_operations_(sub_task_forward_callback_), |
| 205 clear_embedder_data_(sub_task_forward_callback_), |
| 206 clear_cache_(sub_task_forward_callback_), |
| 207 clear_channel_ids_(sub_task_forward_callback_), |
| 208 clear_http_auth_cache_(sub_task_forward_callback_), |
| 209 clear_storage_partition_data_(sub_task_forward_callback_), |
335 weak_ptr_factory_(this) { | 210 weak_ptr_factory_(this) { |
336 DCHECK(browser_context); | 211 DCHECK(browser_context); |
337 } | 212 } |
338 | 213 |
339 BrowsingDataRemover::~BrowsingDataRemover() { | 214 BrowsingDataRemover::~BrowsingDataRemover() { |
340 if (!task_queue_.empty()) { | 215 if (!task_queue_.empty()) { |
341 VLOG(1) << "BrowsingDataRemover shuts down with " << task_queue_.size() | 216 VLOG(1) << "BrowsingDataRemover shuts down with " << task_queue_.size() |
342 << " pending tasks"; | 217 << " pending tasks"; |
343 } | 218 } |
344 | 219 |
345 // If we are still removing data, notify observers that their task has been | 220 // If we are still removing data, notify observers that their task has been |
346 // (albeit unsucessfuly) processed, so they can unregister themselves. | 221 // (albeit unsucessfuly) processed, so they can unregister themselves. |
347 // TODO(bauerb): If it becomes a problem that browsing data might not actually | 222 // 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. | 223 // be fully cleared when an observer is notified, add a success flag. |
349 while (!task_queue_.empty()) { | 224 while (!task_queue_.empty()) { |
350 if (observer_list_.HasObserver(task_queue_.front().observer)) | 225 if (observer_list_.HasObserver(task_queue_.front().observer)) |
351 task_queue_.front().observer->OnBrowsingDataRemoverDone(); | 226 task_queue_.front().observer->OnBrowsingDataRemoverDone(); |
352 task_queue_.pop(); | 227 task_queue_.pop(); |
353 } | 228 } |
354 } | 229 } |
355 | 230 |
356 void BrowsingDataRemover::Shutdown() { | 231 void BrowsingDataRemover::Shutdown() { |
357 history_task_tracker_.TryCancelAll(); | 232 embedder_delegate_.reset(); |
358 template_url_sub_.reset(); | |
359 } | 233 } |
360 | 234 |
361 void BrowsingDataRemover::SetRemoving(bool is_removing) { | 235 void BrowsingDataRemover::SetRemoving(bool is_removing) { |
362 DCHECK_NE(is_removing_, is_removing); | 236 DCHECK_NE(is_removing_, is_removing); |
363 is_removing_ = is_removing; | 237 is_removing_ = is_removing; |
364 } | 238 } |
365 | 239 |
366 void BrowsingDataRemover::Remove(const TimeRange& time_range, | 240 void BrowsingDataRemover::Remove(const TimeRange& time_range, |
367 int remove_mask, | 241 int remove_mask, |
368 int origin_type_mask) { | 242 int origin_type_mask) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 // =============== README before adding more storage backends =============== | 330 // =============== README before adding more storage backends =============== |
457 // | 331 // |
458 // If you're adding a data storage backend that is included among | 332 // If you're adding a data storage backend that is included among |
459 // RemoveDataMask::FILTERABLE_DATATYPES, you must do one of the following: | 333 // RemoveDataMask::FILTERABLE_DATATYPES, you must do one of the following: |
460 // 1. Support one of the filters generated by |filter_builder|. | 334 // 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 | 335 // 2. Add a comment explaining why is it acceptable in your case to delete all |
462 // data without filtering URLs / origins / domains. | 336 // data without filtering URLs / origins / domains. |
463 // 3. Do not support partial deletion, i.e. only delete your data if | 337 // 3. Do not support partial deletion, i.e. only delete your data if |
464 // |filter_builder.IsEmptyBlacklist()|. Add a comment explaining why this | 338 // |filter_builder.IsEmptyBlacklist()|. Add a comment explaining why this |
465 // is acceptable. | 339 // is acceptable. |
466 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 340 synchronous_clear_operations_.Start(); |
467 waiting_for_synchronous_clear_operations_ = true; | |
468 | 341 |
469 // crbug.com/140910: Many places were calling this with base::Time() as | 342 // crbug.com/140910: Many places were calling this with base::Time() as |
470 // delete_end, even though they should've used base::Time::Max(). | 343 // delete_end, even though they should've used base::Time::Max(). |
471 DCHECK_NE(base::Time(), time_range.end); | 344 DCHECK_NE(base::Time(), time_range.end); |
472 | 345 |
473 delete_begin_ = time_range.begin; | 346 delete_begin_ = time_range.begin; |
474 delete_end_ = time_range.end; | 347 delete_end_ = time_range.end; |
475 remove_mask_ = remove_mask; | 348 remove_mask_ = remove_mask; |
476 origin_type_mask_ = origin_type_mask; | 349 origin_type_mask_ = origin_type_mask; |
477 | 350 |
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) { | 351 if (origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
499 content::RecordAction( | 352 content::RecordAction( |
500 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); | 353 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); |
501 } | 354 } |
502 if (origin_type_mask_ & BrowsingDataHelper::PROTECTED_WEB) { | 355 if (origin_type_mask_ & BrowsingDataHelper::PROTECTED_WEB) { |
503 content::RecordAction( | 356 content::RecordAction( |
504 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); | 357 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); |
505 } | 358 } |
506 if (origin_type_mask_ & BrowsingDataHelper::EXTENSION) { | 359 if (origin_type_mask_ & BrowsingDataHelper::EXTENSION) { |
507 content::RecordAction( | 360 content::RecordAction( |
508 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); | 361 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); |
509 } | 362 } |
510 // If this fires, we added a new BrowsingDataHelper::OriginTypeMask without | 363 // If this fires, we added a new BrowsingDataHelper::OriginTypeMask without |
511 // updating the user metrics above. | 364 // updating the user metrics above. |
512 static_assert( | 365 static_assert( |
513 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | | 366 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | |
514 BrowsingDataHelper::PROTECTED_WEB | | 367 BrowsingDataHelper::PROTECTED_WEB | |
515 BrowsingDataHelper::EXTENSION), | 368 BrowsingDataHelper::EXTENSION), |
516 "OriginTypeMask has been updated without updating user metrics"); | 369 "OriginTypeMask has been updated without updating user metrics"); |
517 | 370 |
| 371 // Record the combined deletion of cookies and cache. |
| 372 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; |
| 373 if (remove_mask & REMOVE_COOKIES && |
| 374 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 375 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE |
| 376 : ONLY_COOKIES; |
| 377 } else if (remove_mask & REMOVE_CACHE) { |
| 378 choice = ONLY_CACHE; |
| 379 } |
| 380 |
| 381 UMA_HISTOGRAM_ENUMERATION( |
| 382 "History.ClearBrowsingData.UserDeletedCookieOrCache", |
| 383 choice, MAX_CHOICE_VALUE); |
| 384 |
| 385 // Managed devices and supervised users can have restrictions on history |
| 386 // deletion. |
| 387 PrefService* prefs = profile_->GetPrefs(); |
| 388 bool may_delete_history = prefs->GetBoolean( |
| 389 prefs::kAllowDeletingBrowserHistory); |
| 390 |
| 391 // All the UI entry points into the BrowsingDataRemover should be disabled, |
| 392 // but this will fire if something was missed or added. |
| 393 DCHECK(may_delete_history || (remove_mask & REMOVE_NOCHECKS) || |
| 394 (!(remove_mask & REMOVE_HISTORY) && !(remove_mask & REMOVE_DOWNLOADS))); |
| 395 |
| 396 ////////////////////////////////////////////////////////////////////////////// |
| 397 // INITIALIZATION |
| 398 base::Callback<bool(const GURL& url)> filter = |
| 399 filter_builder.BuildGeneralFilter(); |
| 400 |
518 if ((remove_mask & REMOVE_HISTORY) && may_delete_history) { | 401 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 | 402 // The SSL Host State that tracks SSL interstitial "proceed" decisions may |
686 // include origins that the user has visited, so it must be cleared. | 403 // 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 | 404 // 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. | 405 // and SSL host state are scoped to hosts and represent them as std::string. |
689 // Rename the method to indicate its more general usage. | 406 // Rename the method to indicate its more general usage. |
690 if (profile_->GetSSLHostStateDelegate()) { | 407 if (profile_->GetSSLHostStateDelegate()) { |
691 profile_->GetSSLHostStateDelegate()->Clear( | 408 profile_->GetSSLHostStateDelegate()->Clear( |
692 filter_builder.IsEmptyBlacklist() | 409 filter_builder.IsEmptyBlacklist() |
693 ? base::Callback<bool(const std::string&)>() | 410 ? base::Callback<bool(const std::string&)>() |
694 : filter_builder.BuildPluginFilter()); | 411 : filter_builder.BuildPluginFilter()); |
695 } | 412 } |
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 } | 413 } |
740 | 414 |
| 415 ////////////////////////////////////////////////////////////////////////////// |
| 416 // REMOVE_DOWNLOADS |
741 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { | 417 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { |
742 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); | 418 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); |
743 content::DownloadManager* download_manager = | 419 content::DownloadManager* download_manager = |
744 BrowserContext::GetDownloadManager(profile_); | 420 BrowserContext::GetDownloadManager(profile_); |
745 download_manager->RemoveDownloadsByURLAndTime(filter, | 421 download_manager->RemoveDownloadsByURLAndTime(filter, |
746 delete_begin_, delete_end_); | 422 delete_begin_, delete_end_); |
747 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( | 423 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( |
748 download_manager); | 424 download_manager); |
749 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); | 425 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); |
750 } | 426 } |
751 | 427 |
752 uint32_t storage_partition_remove_mask = 0; | 428 ////////////////////////////////////////////////////////////////////////////// |
753 | 429 // 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 | 430 // Channel IDs are not separated for protected and unprotected web |
802 // origins. We check the origin_type_mask_ to prevent unintended deletion. | 431 // origins. We check the origin_type_mask_ to prevent unintended deletion. |
803 if (remove_mask & REMOVE_CHANNEL_IDS && | 432 if (remove_mask & REMOVE_CHANNEL_IDS && |
804 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 433 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
805 content::RecordAction( | 434 content::RecordAction( |
806 UserMetricsAction("ClearBrowsingData_ChannelIDs")); | 435 UserMetricsAction("ClearBrowsingData_ChannelIDs")); |
807 // Since we are running on the UI thread don't call GetURLRequestContext(). | 436 // Since we are running on the UI thread don't call GetURLRequestContext(). |
808 scoped_refptr<net::URLRequestContextGetter> rq_context = | 437 scoped_refptr<net::URLRequestContextGetter> rq_context = |
809 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 438 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
810 GetURLRequestContext(); | 439 GetURLRequestContext(); |
811 waiting_for_clear_channel_ids_ = true; | 440 clear_channel_ids_.Start(); |
812 BrowserThread::PostTask( | 441 BrowserThread::PostTask( |
813 BrowserThread::IO, FROM_HERE, | 442 BrowserThread::IO, FROM_HERE, |
814 base::Bind(&ClearChannelIDsOnIOThread, | 443 base::Bind(&ClearChannelIDsOnIOThread, |
815 filter_builder.BuildChannelIDFilter(), | 444 filter_builder.BuildChannelIDFilter(), |
816 delete_begin_, delete_end_, std::move(rq_context), | 445 delete_begin_, delete_end_, std::move(rq_context), |
817 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs, | 446 clear_channel_ids_.GetCompletionCallback())); |
818 weak_ptr_factory_.GetWeakPtr()))); | |
819 } | 447 } |
820 | 448 |
821 if (remove_mask & REMOVE_DURABLE_PERMISSION) { | 449 ////////////////////////////////////////////////////////////////////////////// |
822 HostContentSettingsMapFactory::GetForProfile(profile_) | 450 // STORAGE PARTITION DATA |
823 ->ClearSettingsForOneTypeWithPredicate( | 451 uint32_t storage_partition_remove_mask = 0; |
824 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, | 452 |
825 base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter)); | 453 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, |
| 454 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB |
| 455 // don't accidentally remove the cookies that are associated with the |
| 456 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated |
| 457 // between UNPROTECTED_WEB and PROTECTED_WEB. |
| 458 if (remove_mask & REMOVE_COOKIES && |
| 459 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 460 storage_partition_remove_mask |= |
| 461 content::StoragePartition::REMOVE_DATA_MASK_COOKIES; |
826 } | 462 } |
827 | |
828 if (remove_mask & REMOVE_LOCAL_STORAGE) { | 463 if (remove_mask & REMOVE_LOCAL_STORAGE) { |
829 storage_partition_remove_mask |= | 464 storage_partition_remove_mask |= |
830 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 465 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
831 } | 466 } |
832 | |
833 if (remove_mask & REMOVE_INDEXEDDB) { | 467 if (remove_mask & REMOVE_INDEXEDDB) { |
834 storage_partition_remove_mask |= | 468 storage_partition_remove_mask |= |
835 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; | 469 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; |
836 } | 470 } |
837 if (remove_mask & REMOVE_WEBSQL) { | 471 if (remove_mask & REMOVE_WEBSQL) { |
838 storage_partition_remove_mask |= | 472 storage_partition_remove_mask |= |
839 content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; | 473 content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; |
840 } | 474 } |
841 if (remove_mask & REMOVE_APPCACHE) { | 475 if (remove_mask & REMOVE_APPCACHE) { |
842 storage_partition_remove_mask |= | 476 storage_partition_remove_mask |= |
843 content::StoragePartition::REMOVE_DATA_MASK_APPCACHE; | 477 content::StoragePartition::REMOVE_DATA_MASK_APPCACHE; |
844 } | 478 } |
845 if (remove_mask & REMOVE_SERVICE_WORKERS) { | 479 if (remove_mask & REMOVE_SERVICE_WORKERS) { |
846 storage_partition_remove_mask |= | 480 storage_partition_remove_mask |= |
847 content::StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; | 481 content::StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; |
848 } | 482 } |
849 if (remove_mask & REMOVE_CACHE_STORAGE) { | 483 if (remove_mask & REMOVE_CACHE_STORAGE) { |
850 storage_partition_remove_mask |= | 484 storage_partition_remove_mask |= |
851 content::StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE; | 485 content::StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE; |
852 } | 486 } |
853 if (remove_mask & REMOVE_FILE_SYSTEMS) { | 487 if (remove_mask & REMOVE_FILE_SYSTEMS) { |
854 storage_partition_remove_mask |= | 488 storage_partition_remove_mask |= |
855 content::StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; | 489 content::StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; |
856 } | 490 } |
857 | 491 |
| 492 // Content Decryption Modules used by Encrypted Media store licenses in a |
| 493 // private filesystem. These are different than content licenses used by |
| 494 // Flash (which are deleted father down in this method). |
| 495 if (remove_mask & REMOVE_MEDIA_LICENSES) { |
| 496 storage_partition_remove_mask |= |
| 497 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; |
| 498 } |
| 499 |
| 500 if (storage_partition_remove_mask) { |
| 501 clear_storage_partition_data_.Start(); |
| 502 |
| 503 content::StoragePartition* storage_partition; |
| 504 if (storage_partition_for_testing_) |
| 505 storage_partition = storage_partition_for_testing_; |
| 506 else |
| 507 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); |
| 508 |
| 509 uint32_t quota_storage_remove_mask = |
| 510 ~content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
| 511 |
| 512 if (delete_begin_ == base::Time() || |
| 513 origin_type_mask_ & |
| 514 (BrowsingDataHelper::PROTECTED_WEB | BrowsingDataHelper::EXTENSION)) { |
| 515 // If we're deleting since the beginning of time, or we're removing |
| 516 // protected origins, then remove persistent quota data. |
| 517 quota_storage_remove_mask |= |
| 518 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
| 519 } |
| 520 |
| 521 // If cookies are supposed to be conditionally deleted from the storage |
| 522 // partition, create a cookie matcher function. |
| 523 content::StoragePartition::CookieMatcherFunction cookie_matcher; |
| 524 if (!filter_builder.IsEmptyBlacklist() && |
| 525 (storage_partition_remove_mask & |
| 526 content::StoragePartition::REMOVE_DATA_MASK_COOKIES)) { |
| 527 cookie_matcher = filter_builder.BuildCookieFilter(); |
| 528 } |
| 529 |
| 530 storage_partition->ClearData( |
| 531 storage_partition_remove_mask, quota_storage_remove_mask, |
| 532 base::Bind(&DoesOriginMatchMaskAndUrls, origin_type_mask_, filter), |
| 533 cookie_matcher, delete_begin_, delete_end_, |
| 534 clear_storage_partition_data_.GetCompletionCallback()); |
| 535 } |
| 536 |
| 537 ////////////////////////////////////////////////////////////////////////////// |
| 538 // REMOVE_PLUGINS |
858 #if BUILDFLAG(ENABLE_PLUGINS) | 539 #if BUILDFLAG(ENABLE_PLUGINS) |
859 // Plugin is data not separated for protected and unprotected web origins. We | 540 // Plugin is data not separated for protected and unprotected web origins. We |
860 // check the origin_type_mask_ to prevent unintended deletion. | 541 // check the origin_type_mask_ to prevent unintended deletion. |
861 if (remove_mask & REMOVE_PLUGIN_DATA && | 542 if (remove_mask & REMOVE_PLUGIN_DATA && |
862 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 543 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
863 content::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); | 544 content::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); |
864 waiting_for_clear_plugin_data_count_ = 1; | 545 clear_plugin_data_count_ = 1; |
865 | 546 |
866 if (filter_builder.IsEmptyBlacklist()) { | 547 if (filter_builder.IsEmptyBlacklist()) { |
867 DCHECK(!plugin_data_remover_); | 548 DCHECK(!plugin_data_remover_); |
868 plugin_data_remover_.reset(content::PluginDataRemover::Create(profile_)); | 549 plugin_data_remover_.reset(content::PluginDataRemover::Create(profile_)); |
869 base::WaitableEvent* event = | 550 base::WaitableEvent* event = |
870 plugin_data_remover_->StartRemoving(delete_begin_); | 551 plugin_data_remover_->StartRemoving(delete_begin_); |
871 | 552 |
872 base::WaitableEventWatcher::EventCallback watcher_callback = | 553 base::WaitableEventWatcher::EventCallback watcher_callback = |
873 base::Bind(&BrowsingDataRemover::OnWaitableEventSignaled, | 554 base::Bind(&BrowsingDataRemover::OnWaitableEventSignaled, |
874 weak_ptr_factory_.GetWeakPtr()); | 555 weak_ptr_factory_.GetWeakPtr()); |
875 watcher_.StartWatching(event, watcher_callback); | 556 watcher_.StartWatching(event, watcher_callback); |
876 } else { | 557 } else { |
877 // TODO(msramek): Store filters from the currently executed task on the | 558 // TODO(msramek): Store filters from the currently executed task on the |
878 // object to avoid having to copy them to callback methods. | 559 // object to avoid having to copy them to callback methods. |
879 flash_lso_helper_->StartFetching(base::Bind( | 560 flash_lso_helper_->StartFetching(base::Bind( |
880 &BrowsingDataRemover::OnSitesWithFlashDataFetched, | 561 &BrowsingDataRemover::OnSitesWithFlashDataFetched, |
881 weak_ptr_factory_.GetWeakPtr(), | 562 weak_ptr_factory_.GetWeakPtr(), |
882 filter_builder.BuildPluginFilter())); | 563 filter_builder.BuildPluginFilter())); |
883 } | 564 } |
884 } | 565 } |
885 #endif | 566 #endif |
886 | 567 |
887 if (remove_mask & REMOVE_SITE_USAGE_DATA) { | 568 ////////////////////////////////////////////////////////////////////////////// |
888 HostContentSettingsMapFactory::GetForProfile(profile_) | 569 // 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) { | 570 if (remove_mask & REMOVE_CACHE) { |
977 // Tell the renderers to clear their cache. | 571 // Tell the renderers to clear their cache. |
978 web_cache::WebCacheManager::GetInstance()->ClearCache(); | 572 web_cache::WebCacheManager::GetInstance()->ClearCache(); |
979 | 573 |
980 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); | 574 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); |
981 | 575 |
982 waiting_for_clear_cache_ = true; | 576 clear_cache_.Start(); |
983 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. | 577 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. |
984 if (filter_builder.IsEmptyBlacklist()) { | 578 if (filter_builder.IsEmptyBlacklist()) { |
985 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( | 579 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( |
986 BrowserContext::GetDefaultStoragePartition(profile_), | 580 BrowserContext::GetDefaultStoragePartition(profile_), |
987 delete_begin_, delete_end_) | 581 delete_begin_, delete_end_) |
988 ->Remove(base::Bind(&BrowsingDataRemover::ClearedCache, | 582 ->Remove(clear_cache_.GetCompletionCallback()); |
989 weak_ptr_factory_.GetWeakPtr())); | |
990 } else { | 583 } else { |
991 browsing_data::StoragePartitionHttpCacheDataRemover:: | 584 browsing_data::StoragePartitionHttpCacheDataRemover:: |
992 CreateForURLsAndRange( | 585 CreateForURLsAndRange( |
993 BrowserContext::GetDefaultStoragePartition(profile_), | 586 BrowserContext::GetDefaultStoragePartition(profile_), |
994 filter, delete_begin_, delete_end_) | 587 filter, delete_begin_, delete_end_) |
995 ->Remove(base::Bind(&BrowsingDataRemover::ClearedCache, | 588 ->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 } | 589 } |
1026 | 590 |
1027 // Tell the shader disk cache to clear. | 591 // Tell the shader disk cache to clear. |
1028 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); | 592 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); |
1029 storage_partition_remove_mask |= | 593 storage_partition_remove_mask |= |
1030 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; | 594 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 } | 595 } |
1059 | 596 |
| 597 ////////////////////////////////////////////////////////////////////////////// |
| 598 // Auth cache. |
1060 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) { | 599 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) { |
1061 scoped_refptr<net::URLRequestContextGetter> request_context = | 600 scoped_refptr<net::URLRequestContextGetter> request_context = |
1062 profile_->GetRequestContext(); | 601 profile_->GetRequestContext(); |
1063 waiting_for_clear_http_auth_cache_ = true; | 602 clear_http_auth_cache_.Start(); |
1064 BrowserThread::PostTaskAndReply( | 603 BrowserThread::PostTaskAndReply( |
1065 BrowserThread::IO, FROM_HERE, | 604 BrowserThread::IO, FROM_HERE, |
1066 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), | 605 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), |
1067 delete_begin_), | 606 delete_begin_), |
1068 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache, | 607 clear_http_auth_cache_.GetCompletionCallback()); |
1069 weak_ptr_factory_.GetWeakPtr())); | |
1070 } | 608 } |
1071 | 609 |
1072 // Content Decryption Modules used by Encrypted Media store licenses in a | 610 ////////////////////////////////////////////////////////////////////////////// |
1073 // private filesystem. These are different than content licenses used by | 611 // Embedder data. |
1074 // Flash (which are deleted father down in this method). | 612 if (embedder_delegate_) { |
1075 if (remove_mask & REMOVE_MEDIA_LICENSES) { | 613 clear_embedder_data_.Start(); |
1076 storage_partition_remove_mask |= | 614 embedder_delegate_->RemoveEmbedderData( |
1077 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; | 615 delete_begin_, |
1078 } | 616 delete_end_, |
1079 | 617 remove_mask, |
1080 if (storage_partition_remove_mask) { | 618 filter_builder, |
1081 waiting_for_clear_storage_partition_data_ = true; | 619 origin_type_mask, |
1082 | 620 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 } | 621 } |
1204 | 622 |
1205 // Notify in case all actions taken were synchronous. | 623 // Notify in case all actions taken were synchronous. |
1206 waiting_for_synchronous_clear_operations_ = false; | 624 synchronous_clear_operations_.GetCompletionCallback().Run(); |
1207 NotifyIfDone(); | |
1208 | |
1209 UMA_HISTOGRAM_ENUMERATION( | |
1210 "History.ClearBrowsingData.UserDeletedCookieOrCache", | |
1211 choice, MAX_CHOICE_VALUE); | |
1212 } | 625 } |
1213 | 626 |
1214 void BrowsingDataRemover::AddObserver(Observer* observer) { | 627 void BrowsingDataRemover::AddObserver(Observer* observer) { |
1215 observer_list_.AddObserver(observer); | 628 observer_list_.AddObserver(observer); |
1216 } | 629 } |
1217 | 630 |
1218 void BrowsingDataRemover::RemoveObserver(Observer* observer) { | 631 void BrowsingDataRemover::RemoveObserver(Observer* observer) { |
1219 observer_list_.RemoveObserver(observer); | 632 observer_list_.RemoveObserver(observer); |
1220 } | 633 } |
1221 | 634 |
1222 void BrowsingDataRemover::OverrideStoragePartitionForTesting( | 635 void BrowsingDataRemover::OverrideStoragePartitionForTesting( |
1223 content::StoragePartition* storage_partition) { | 636 content::StoragePartition* storage_partition) { |
1224 storage_partition_for_testing_ = storage_partition; | 637 storage_partition_for_testing_ = storage_partition; |
1225 } | 638 } |
1226 | 639 |
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) | 640 #if BUILDFLAG(ENABLE_PLUGINS) |
1235 void BrowsingDataRemover::OverrideFlashLSOHelperForTesting( | 641 void BrowsingDataRemover::OverrideFlashLSOHelperForTesting( |
1236 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper) { | 642 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper) { |
1237 flash_lso_helper_ = flash_lso_helper; | 643 flash_lso_helper_ = flash_lso_helper; |
1238 } | 644 } |
1239 #endif | 645 #endif |
1240 | 646 |
1241 const base::Time& BrowsingDataRemover::GetLastUsedBeginTime() { | 647 const base::Time& BrowsingDataRemover::GetLastUsedBeginTime() { |
1242 return delete_begin_; | 648 return delete_begin_; |
1243 } | 649 } |
(...skipping 18 matching lines...) Expand all Loading... |
1262 Observer* observer) | 668 Observer* observer) |
1263 : time_range(time_range), | 669 : time_range(time_range), |
1264 remove_mask(remove_mask), | 670 remove_mask(remove_mask), |
1265 origin_type_mask(origin_type_mask), | 671 origin_type_mask(origin_type_mask), |
1266 filter_builder(std::move(filter_builder)), | 672 filter_builder(std::move(filter_builder)), |
1267 observer(observer) {} | 673 observer(observer) {} |
1268 | 674 |
1269 BrowsingDataRemover::RemovalTask::~RemovalTask() {} | 675 BrowsingDataRemover::RemovalTask::~RemovalTask() {} |
1270 | 676 |
1271 bool BrowsingDataRemover::AllDone() { | 677 bool BrowsingDataRemover::AllDone() { |
1272 return !waiting_for_synchronous_clear_operations_ && | 678 return !synchronous_clear_operations_.is_pending() && |
1273 !waiting_for_clear_autofill_origin_urls_ && | 679 !clear_embedder_data_.is_pending() && |
1274 !waiting_for_clear_cache_ && | 680 !clear_cache_.is_pending() && |
1275 !waiting_for_clear_flash_content_licenses_ && | 681 !clear_channel_ids_.is_pending() && |
1276 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && | 682 !clear_http_auth_cache_.is_pending() && |
1277 !waiting_for_clear_domain_reliability_monitor_ && | 683 !clear_storage_partition_data_.is_pending() && |
1278 !waiting_for_clear_form_ && !waiting_for_clear_history_ && | 684 !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 } | 685 } |
1311 | 686 |
1312 void BrowsingDataRemover::Notify() { | 687 void BrowsingDataRemover::Notify() { |
1313 // Some tests call |RemoveImpl| directly, without using the task scheduler. | 688 // 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 | 689 // 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 | 690 // relying on |RemoveImpl| do so because they need to pass in |
1316 // BrowsingDataFilterBuilder while still keeping ownership of it. Making | 691 // BrowsingDataFilterBuilder while still keeping ownership of it. Making |
1317 // BrowsingDataFilterBuilder copyable would solve this. | 692 // BrowsingDataFilterBuilder copyable would solve this. |
1318 if (!is_removing_) { | 693 if (!is_removing_) { |
1319 DCHECK(task_queue_.empty()); | 694 DCHECK(task_queue_.empty()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 if (completion_inhibitor_) { | 732 if (completion_inhibitor_) { |
1358 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( | 733 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( |
1359 this, base::Bind(&BrowsingDataRemover::Notify, | 734 this, base::Bind(&BrowsingDataRemover::Notify, |
1360 weak_ptr_factory_.GetWeakPtr())); | 735 weak_ptr_factory_.GetWeakPtr())); |
1361 return; | 736 return; |
1362 } | 737 } |
1363 | 738 |
1364 Notify(); | 739 Notify(); |
1365 } | 740 } |
1366 | 741 |
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) | 742 #if BUILDFLAG(ENABLE_PLUGINS) |
1418 void BrowsingDataRemover::OnWaitableEventSignaled( | 743 void BrowsingDataRemover::OnWaitableEventSignaled( |
1419 base::WaitableEvent* waitable_event) { | 744 base::WaitableEvent* waitable_event) { |
1420 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 745 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1421 | 746 |
1422 DCHECK_EQ(1, waiting_for_clear_plugin_data_count_); | 747 DCHECK_EQ(1, clear_plugin_data_count_); |
1423 waiting_for_clear_plugin_data_count_ = 0; | 748 clear_plugin_data_count_ = 0; |
1424 | 749 |
1425 plugin_data_remover_.reset(); | 750 plugin_data_remover_.reset(); |
1426 watcher_.StopWatching(); | 751 watcher_.StopWatching(); |
1427 NotifyIfDone(); | 752 NotifyIfDone(); |
1428 } | 753 } |
1429 | 754 |
1430 void BrowsingDataRemover::OnSitesWithFlashDataFetched( | 755 void BrowsingDataRemover::OnSitesWithFlashDataFetched( |
1431 base::Callback<bool(const std::string&)> plugin_filter, | 756 base::Callback<bool(const std::string&)> plugin_filter, |
1432 const std::vector<std::string>& sites) { | 757 const std::vector<std::string>& sites) { |
1433 DCHECK_EQ(1, waiting_for_clear_plugin_data_count_); | 758 DCHECK_EQ(1, clear_plugin_data_count_); |
1434 waiting_for_clear_plugin_data_count_ = 0; | 759 clear_plugin_data_count_ = 0; |
1435 | 760 |
1436 std::vector<std::string> sites_to_delete; | 761 std::vector<std::string> sites_to_delete; |
1437 for (const std::string& site : sites) { | 762 for (const std::string& site : sites) { |
1438 if (plugin_filter.Run(site)) | 763 if (plugin_filter.Run(site)) |
1439 sites_to_delete.push_back(site); | 764 sites_to_delete.push_back(site); |
1440 } | 765 } |
1441 | 766 |
1442 waiting_for_clear_plugin_data_count_ = sites_to_delete.size(); | 767 clear_plugin_data_count_ = sites_to_delete.size(); |
1443 | 768 |
1444 for (const std::string& site : sites_to_delete) { | 769 for (const std::string& site : sites_to_delete) { |
1445 flash_lso_helper_->DeleteFlashLSOsForSite( | 770 flash_lso_helper_->DeleteFlashLSOsForSite( |
1446 site, | 771 site, |
1447 base::Bind(&BrowsingDataRemover::OnFlashDataDeleted, | 772 base::Bind(&BrowsingDataRemover::OnFlashDataDeleted, |
1448 weak_ptr_factory_.GetWeakPtr())); | 773 weak_ptr_factory_.GetWeakPtr())); |
1449 } | 774 } |
1450 | 775 |
1451 NotifyIfDone(); | 776 NotifyIfDone(); |
1452 } | 777 } |
1453 | 778 |
1454 void BrowsingDataRemover::OnFlashDataDeleted() { | 779 void BrowsingDataRemover::OnFlashDataDeleted() { |
1455 waiting_for_clear_plugin_data_count_--; | 780 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(); | 781 NotifyIfDone(); |
1467 } | 782 } |
1468 #endif | 783 #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 |