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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 #include "content/public/browser/plugin_data_remover.h" | 74 #include "content/public/browser/plugin_data_remover.h" |
75 #include "content/public/browser/session_storage_usage_info.h" | 75 #include "content/public/browser/session_storage_usage_info.h" |
76 #include "content/public/browser/storage_partition.h" | 76 #include "content/public/browser/storage_partition.h" |
77 #include "content/public/browser/user_metrics.h" | 77 #include "content/public/browser/user_metrics.h" |
78 #include "net/base/net_errors.h" | 78 #include "net/base/net_errors.h" |
79 #include "net/base/sdch_manager.h" | 79 #include "net/base/sdch_manager.h" |
80 #include "net/cookies/cookie_store.h" | 80 #include "net/cookies/cookie_store.h" |
81 #include "net/disk_cache/disk_cache.h" | 81 #include "net/disk_cache/disk_cache.h" |
82 #include "net/http/http_cache.h" | 82 #include "net/http/http_cache.h" |
83 #include "net/http/transport_security_state.h" | 83 #include "net/http/transport_security_state.h" |
84 #include "net/ssl/server_bound_cert_service.h" | 84 #include "net/ssl/channel_id_service.h" |
85 #include "net/ssl/server_bound_cert_store.h" | 85 #include "net/ssl/channel_id_store.h" |
86 #include "net/url_request/url_request_context.h" | 86 #include "net/url_request/url_request_context.h" |
87 #include "net/url_request/url_request_context_getter.h" | 87 #include "net/url_request/url_request_context_getter.h" |
88 #include "webkit/browser/quota/quota_manager.h" | 88 #include "webkit/browser/quota/quota_manager.h" |
89 #include "webkit/browser/quota/special_storage_policy.h" | 89 #include "webkit/browser/quota/special_storage_policy.h" |
90 #include "webkit/common/quota/quota_types.h" | 90 #include "webkit/common/quota/quota_types.h" |
91 | 91 |
92 using base::UserMetricsAction; | 92 using base::UserMetricsAction; |
93 using content::BrowserContext; | 93 using content::BrowserContext; |
94 using content::BrowserThread; | 94 using content::BrowserThread; |
95 using content::DOMStorageContext; | 95 using content::DOMStorageContext; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 waiting_for_clear_history_(false), | 196 waiting_for_clear_history_(false), |
197 waiting_for_clear_hostname_resolution_cache_(false), | 197 waiting_for_clear_hostname_resolution_cache_(false), |
198 waiting_for_clear_keyword_data_(false), | 198 waiting_for_clear_keyword_data_(false), |
199 waiting_for_clear_logged_in_predictor_(false), | 199 waiting_for_clear_logged_in_predictor_(false), |
200 waiting_for_clear_nacl_cache_(false), | 200 waiting_for_clear_nacl_cache_(false), |
201 waiting_for_clear_network_predictor_(false), | 201 waiting_for_clear_network_predictor_(false), |
202 waiting_for_clear_networking_history_(false), | 202 waiting_for_clear_networking_history_(false), |
203 waiting_for_clear_platform_keys_(false), | 203 waiting_for_clear_platform_keys_(false), |
204 waiting_for_clear_plugin_data_(false), | 204 waiting_for_clear_plugin_data_(false), |
205 waiting_for_clear_pnacl_cache_(false), | 205 waiting_for_clear_pnacl_cache_(false), |
206 waiting_for_clear_server_bound_certs_(false), | 206 waiting_for_clear_channel_ids_(false), |
207 waiting_for_clear_storage_partition_data_(false), | 207 waiting_for_clear_storage_partition_data_(false), |
208 #if defined(ENABLE_WEBRTC) | 208 #if defined(ENABLE_WEBRTC) |
209 waiting_for_clear_webrtc_logs_(false), | 209 waiting_for_clear_webrtc_logs_(false), |
210 #endif | 210 #endif |
211 remove_mask_(0), | 211 remove_mask_(0), |
212 remove_origin_(GURL()), | 212 remove_origin_(GURL()), |
213 origin_set_mask_(0), | 213 origin_set_mask_(0), |
214 storage_partition_for_testing_(NULL) { | 214 storage_partition_for_testing_(NULL) { |
215 DCHECK(profile); | 215 DCHECK(profile); |
216 // crbug.com/140910: Many places were calling this with base::Time() as | 216 // crbug.com/140910: Many places were calling this with base::Time() as |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread, | 448 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread, |
449 base::Unretained(this), base::Unretained(sb_context))); | 449 base::Unretained(this), base::Unretained(sb_context))); |
450 } | 450 } |
451 } | 451 } |
452 #endif | 452 #endif |
453 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); | 453 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); |
454 } | 454 } |
455 | 455 |
456 // Server bound certs are not separated for protected and unprotected web | 456 // Server bound certs are not separated for protected and unprotected web |
457 // origins. We check the origin_set_mask_ to prevent unintended deletion. | 457 // origins. We check the origin_set_mask_ to prevent unintended deletion. |
458 if (remove_mask & REMOVE_SERVER_BOUND_CERTS && | 458 if (remove_mask & REMOVE_CHANNEL_IDS && |
459 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 459 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
460 content::RecordAction( | 460 content::RecordAction( |
461 UserMetricsAction("ClearBrowsingData_ServerBoundCerts")); | 461 UserMetricsAction("ClearBrowsingData_ChannelIDs")); |
462 // Since we are running on the UI thread don't call GetURLRequestContext(). | 462 // Since we are running on the UI thread don't call GetURLRequestContext(). |
463 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); | 463 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); |
464 if (rq_context) { | 464 if (rq_context) { |
465 waiting_for_clear_server_bound_certs_ = true; | 465 waiting_for_clear_channel_ids_ = true; |
466 BrowserThread::PostTask( | 466 BrowserThread::PostTask( |
467 BrowserThread::IO, FROM_HERE, | 467 BrowserThread::IO, FROM_HERE, |
468 base::Bind(&BrowsingDataRemover::ClearServerBoundCertsOnIOThread, | 468 base::Bind(&BrowsingDataRemover::ClearChannelIDsOnIOThread, |
469 base::Unretained(this), base::Unretained(rq_context))); | 469 base::Unretained(this), base::Unretained(rq_context))); |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 if (remove_mask & REMOVE_LOCAL_STORAGE) { | 473 if (remove_mask & REMOVE_LOCAL_STORAGE) { |
474 storage_partition_remove_mask |= | 474 storage_partition_remove_mask |= |
475 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 475 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
476 } | 476 } |
477 | 477 |
478 if (remove_mask & REMOVE_INDEXEDDB) { | 478 if (remove_mask & REMOVE_INDEXEDDB) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 } | 744 } |
745 | 745 |
746 bool BrowsingDataRemover::AllDone() { | 746 bool BrowsingDataRemover::AllDone() { |
747 return !waiting_for_clear_keyword_data_ && | 747 return !waiting_for_clear_keyword_data_ && |
748 !waiting_for_clear_autofill_origin_urls_ && | 748 !waiting_for_clear_autofill_origin_urls_ && |
749 !waiting_for_clear_cache_ && !waiting_for_clear_nacl_cache_ && | 749 !waiting_for_clear_cache_ && !waiting_for_clear_nacl_cache_ && |
750 !waiting_for_clear_cookies_count_ && !waiting_for_clear_history_ && | 750 !waiting_for_clear_cookies_count_ && !waiting_for_clear_history_ && |
751 !waiting_for_clear_domain_reliability_monitor_ && | 751 !waiting_for_clear_domain_reliability_monitor_ && |
752 !waiting_for_clear_logged_in_predictor_ && | 752 !waiting_for_clear_logged_in_predictor_ && |
753 !waiting_for_clear_networking_history_ && | 753 !waiting_for_clear_networking_history_ && |
754 !waiting_for_clear_server_bound_certs_ && | 754 !waiting_for_clear_channel_ids_ && |
wtc
2014/07/01 19:50:48
Nit: sort these, if you still have the patience.
Ryan Hamilton
2014/07/21 19:12:04
Done.
| |
755 !waiting_for_clear_plugin_data_ && | 755 !waiting_for_clear_plugin_data_ && |
756 !waiting_for_clear_pnacl_cache_ && | 756 !waiting_for_clear_pnacl_cache_ && |
757 !waiting_for_clear_content_licenses_ && !waiting_for_clear_form_ && | 757 !waiting_for_clear_content_licenses_ && !waiting_for_clear_form_ && |
758 !waiting_for_clear_hostname_resolution_cache_ && | 758 !waiting_for_clear_hostname_resolution_cache_ && |
759 !waiting_for_clear_network_predictor_ && | 759 !waiting_for_clear_network_predictor_ && |
760 !waiting_for_clear_platform_keys_ && | 760 !waiting_for_clear_platform_keys_ && |
761 #if defined(ENABLE_WEBRTC) | 761 #if defined(ENABLE_WEBRTC) |
762 !waiting_for_clear_webrtc_logs_ && | 762 !waiting_for_clear_webrtc_logs_ && |
763 #endif | 763 #endif |
764 !waiting_for_clear_storage_partition_data_; | 764 !waiting_for_clear_storage_partition_data_; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1101 net::URLRequestContextGetter* rq_context) { | 1101 net::URLRequestContextGetter* rq_context) { |
1102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1103 net::CookieStore* cookie_store = rq_context-> | 1103 net::CookieStore* cookie_store = rq_context-> |
1104 GetURLRequestContext()->cookie_store(); | 1104 GetURLRequestContext()->cookie_store(); |
1105 cookie_store->DeleteAllCreatedBetweenAsync( | 1105 cookie_store->DeleteAllCreatedBetweenAsync( |
1106 delete_begin_, delete_end_, | 1106 delete_begin_, delete_end_, |
1107 base::Bind(&BrowsingDataRemover::OnClearedCookies, | 1107 base::Bind(&BrowsingDataRemover::OnClearedCookies, |
1108 base::Unretained(this))); | 1108 base::Unretained(this))); |
1109 } | 1109 } |
1110 | 1110 |
1111 void BrowsingDataRemover::ClearServerBoundCertsOnIOThread( | 1111 void BrowsingDataRemover::ClearChannelIDsOnIOThread( |
1112 net::URLRequestContextGetter* rq_context) { | 1112 net::URLRequestContextGetter* rq_context) { |
1113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1114 net::ServerBoundCertService* server_bound_cert_service = | 1114 net::ChannelIDService* channel_id_service = |
1115 rq_context->GetURLRequestContext()->server_bound_cert_service(); | 1115 rq_context->GetURLRequestContext()->channel_id_service(); |
1116 server_bound_cert_service->GetCertStore()->DeleteAllCreatedBetween( | 1116 channel_id_service->GetCertStore()->DeleteAllCreatedBetween( |
1117 delete_begin_, delete_end_, | 1117 delete_begin_, delete_end_, |
1118 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCertsOnIOThread, | 1118 base::Bind(&BrowsingDataRemover::OnClearedChannelIDsOnIOThread, |
1119 base::Unretained(this), base::Unretained(rq_context))); | 1119 base::Unretained(this), base::Unretained(rq_context))); |
1120 } | 1120 } |
1121 | 1121 |
1122 void BrowsingDataRemover::OnClearedServerBoundCertsOnIOThread( | 1122 void BrowsingDataRemover::OnClearedChannelIDsOnIOThread( |
1123 net::URLRequestContextGetter* rq_context) { | 1123 net::URLRequestContextGetter* rq_context) { |
1124 // Need to close open SSL connections which may be using the channel ids we | 1124 // Need to close open SSL connections which may be using the channel ids we |
1125 // are deleting. | 1125 // are deleting. |
1126 // TODO(mattm): http://crbug.com/166069 Make the server bound cert | 1126 // TODO(mattm): http://crbug.com/166069 Make the server bound cert |
1127 // service/store have observers that can notify relevant things directly. | 1127 // service/store have observers that can notify relevant things directly. |
1128 rq_context->GetURLRequestContext()->ssl_config_service()-> | 1128 rq_context->GetURLRequestContext()->ssl_config_service()-> |
1129 NotifySSLConfigChange(); | 1129 NotifySSLConfigChange(); |
1130 BrowserThread::PostTask( | 1130 BrowserThread::PostTask( |
1131 BrowserThread::UI, FROM_HERE, | 1131 BrowserThread::UI, FROM_HERE, |
1132 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, | 1132 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs, |
1133 base::Unretained(this))); | 1133 base::Unretained(this))); |
1134 } | 1134 } |
1135 | 1135 |
1136 void BrowsingDataRemover::OnClearedServerBoundCerts() { | 1136 void BrowsingDataRemover::OnClearedChannelIDs() { |
1137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1138 waiting_for_clear_server_bound_certs_ = false; | 1138 waiting_for_clear_channel_ids_ = false; |
1139 NotifyAndDeleteIfDone(); | 1139 NotifyAndDeleteIfDone(); |
1140 } | 1140 } |
1141 | 1141 |
1142 void BrowsingDataRemover::OnClearedFormData() { | 1142 void BrowsingDataRemover::OnClearedFormData() { |
1143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1144 waiting_for_clear_form_ = false; | 1144 waiting_for_clear_form_ = false; |
1145 NotifyAndDeleteIfDone(); | 1145 NotifyAndDeleteIfDone(); |
1146 } | 1146 } |
1147 | 1147 |
1148 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { | 1148 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { |
(...skipping 14 matching lines...) Expand all Loading... | |
1163 waiting_for_clear_webrtc_logs_ = false; | 1163 waiting_for_clear_webrtc_logs_ = false; |
1164 NotifyAndDeleteIfDone(); | 1164 NotifyAndDeleteIfDone(); |
1165 } | 1165 } |
1166 #endif | 1166 #endif |
1167 | 1167 |
1168 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1168 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
1169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1170 waiting_for_clear_domain_reliability_monitor_ = false; | 1170 waiting_for_clear_domain_reliability_monitor_ = false; |
1171 NotifyAndDeleteIfDone(); | 1171 NotifyAndDeleteIfDone(); |
1172 } | 1172 } |
OLD | NEW |