Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 356713005: Rename ServerBoundCert => ChannelID to reflect the current name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix cookies_list.js Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "content/public/browser/plugin_data_remover.h" 60 #include "content/public/browser/plugin_data_remover.h"
61 #include "content/public/browser/session_storage_usage_info.h" 61 #include "content/public/browser/session_storage_usage_info.h"
62 #include "content/public/browser/storage_partition.h" 62 #include "content/public/browser/storage_partition.h"
63 #include "content/public/browser/user_metrics.h" 63 #include "content/public/browser/user_metrics.h"
64 #include "net/base/net_errors.h" 64 #include "net/base/net_errors.h"
65 #include "net/base/sdch_manager.h" 65 #include "net/base/sdch_manager.h"
66 #include "net/cookies/cookie_store.h" 66 #include "net/cookies/cookie_store.h"
67 #include "net/disk_cache/disk_cache.h" 67 #include "net/disk_cache/disk_cache.h"
68 #include "net/http/http_cache.h" 68 #include "net/http/http_cache.h"
69 #include "net/http/transport_security_state.h" 69 #include "net/http/transport_security_state.h"
70 #include "net/ssl/server_bound_cert_service.h" 70 #include "net/ssl/channel_id_service.h"
71 #include "net/ssl/server_bound_cert_store.h" 71 #include "net/ssl/channel_id_store.h"
72 #include "net/url_request/url_request_context.h" 72 #include "net/url_request/url_request_context.h"
73 #include "net/url_request/url_request_context_getter.h" 73 #include "net/url_request/url_request_context_getter.h"
74 #include "webkit/browser/quota/quota_manager.h" 74 #include "webkit/browser/quota/quota_manager.h"
75 #include "webkit/browser/quota/special_storage_policy.h" 75 #include "webkit/browser/quota/special_storage_policy.h"
76 #include "webkit/common/quota/quota_types.h" 76 #include "webkit/common/quota/quota_types.h"
77 77
78 #if defined(OS_CHROMEOS) 78 #if defined(OS_CHROMEOS)
79 #include "chrome/browser/chromeos/login/users/user_manager.h" 79 #include "chrome/browser/chromeos/login/users/user_manager.h"
80 #include "chrome/browser/chromeos/profiles/profile_helper.h" 80 #include "chrome/browser/chromeos/profiles/profile_helper.h"
81 #include "chromeos/attestation/attestation_constants.h" 81 #include "chromeos/attestation/attestation_constants.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), 187 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()),
188 delete_begin_(delete_begin), 188 delete_begin_(delete_begin),
189 delete_end_(delete_end), 189 delete_end_(delete_end),
190 next_cache_state_(STATE_NONE), 190 next_cache_state_(STATE_NONE),
191 cache_(NULL), 191 cache_(NULL),
192 main_context_getter_(profile->GetRequestContext()), 192 main_context_getter_(profile->GetRequestContext()),
193 media_context_getter_(profile->GetMediaRequestContext()), 193 media_context_getter_(profile->GetMediaRequestContext()),
194 deauthorize_content_licenses_request_id_(0), 194 deauthorize_content_licenses_request_id_(0),
195 waiting_for_clear_autofill_origin_urls_(false), 195 waiting_for_clear_autofill_origin_urls_(false),
196 waiting_for_clear_cache_(false), 196 waiting_for_clear_cache_(false),
197 waiting_for_clear_channel_ids_(false),
197 waiting_for_clear_content_licenses_(false), 198 waiting_for_clear_content_licenses_(false),
198 waiting_for_clear_cookies_count_(0), 199 waiting_for_clear_cookies_count_(0),
199 waiting_for_clear_domain_reliability_monitor_(false), 200 waiting_for_clear_domain_reliability_monitor_(false),
200 waiting_for_clear_form_(false), 201 waiting_for_clear_form_(false),
201 waiting_for_clear_history_(false), 202 waiting_for_clear_history_(false),
202 waiting_for_clear_hostname_resolution_cache_(false), 203 waiting_for_clear_hostname_resolution_cache_(false),
203 waiting_for_clear_keyword_data_(false), 204 waiting_for_clear_keyword_data_(false),
204 waiting_for_clear_logged_in_predictor_(false), 205 waiting_for_clear_logged_in_predictor_(false),
205 waiting_for_clear_nacl_cache_(false), 206 waiting_for_clear_nacl_cache_(false),
206 waiting_for_clear_network_predictor_(false), 207 waiting_for_clear_network_predictor_(false),
207 waiting_for_clear_networking_history_(false), 208 waiting_for_clear_networking_history_(false),
208 waiting_for_clear_platform_keys_(false), 209 waiting_for_clear_platform_keys_(false),
209 waiting_for_clear_plugin_data_(false), 210 waiting_for_clear_plugin_data_(false),
210 waiting_for_clear_pnacl_cache_(false), 211 waiting_for_clear_pnacl_cache_(false),
211 waiting_for_clear_server_bound_certs_(false),
212 waiting_for_clear_storage_partition_data_(false), 212 waiting_for_clear_storage_partition_data_(false),
213 #if defined(ENABLE_WEBRTC) 213 #if defined(ENABLE_WEBRTC)
214 waiting_for_clear_webrtc_logs_(false), 214 waiting_for_clear_webrtc_logs_(false),
215 #endif 215 #endif
216 remove_mask_(0), 216 remove_mask_(0),
217 remove_origin_(GURL()), 217 remove_origin_(GURL()),
218 origin_set_mask_(0), 218 origin_set_mask_(0),
219 storage_partition_for_testing_(NULL) { 219 storage_partition_for_testing_(NULL) {
220 DCHECK(profile); 220 DCHECK(profile);
221 // crbug.com/140910: Many places were calling this with base::Time() as 221 // crbug.com/140910: Many places were calling this with base::Time() as
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 BrowserThread::PostTask( 451 BrowserThread::PostTask(
452 BrowserThread::IO, FROM_HERE, 452 BrowserThread::IO, FROM_HERE,
453 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread, 453 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread,
454 base::Unretained(this), base::Unretained(sb_context))); 454 base::Unretained(this), base::Unretained(sb_context)));
455 } 455 }
456 } 456 }
457 #endif 457 #endif
458 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); 458 MediaDeviceIDSalt::Reset(profile_->GetPrefs());
459 } 459 }
460 460
461 // Server bound certs are not separated for protected and unprotected web 461 // Channel IDs are not separated for protected and unprotected web
462 // origins. We check the origin_set_mask_ to prevent unintended deletion. 462 // origins. We check the origin_set_mask_ to prevent unintended deletion.
463 if (remove_mask & REMOVE_SERVER_BOUND_CERTS && 463 if (remove_mask & REMOVE_CHANNEL_IDS &&
464 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { 464 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) {
465 content::RecordAction( 465 content::RecordAction(
466 UserMetricsAction("ClearBrowsingData_ServerBoundCerts")); 466 UserMetricsAction("ClearBrowsingData_ChannelIDs"));
467 // Since we are running on the UI thread don't call GetURLRequestContext(). 467 // Since we are running on the UI thread don't call GetURLRequestContext().
468 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); 468 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext();
469 if (rq_context) { 469 if (rq_context) {
470 waiting_for_clear_server_bound_certs_ = true; 470 waiting_for_clear_channel_ids_ = true;
471 BrowserThread::PostTask( 471 BrowserThread::PostTask(
472 BrowserThread::IO, FROM_HERE, 472 BrowserThread::IO, FROM_HERE,
473 base::Bind(&BrowsingDataRemover::ClearServerBoundCertsOnIOThread, 473 base::Bind(&BrowsingDataRemover::ClearChannelIDsOnIOThread,
474 base::Unretained(this), base::Unretained(rq_context))); 474 base::Unretained(this), base::Unretained(rq_context)));
475 } 475 }
476 } 476 }
477 477
478 if (remove_mask & REMOVE_LOCAL_STORAGE) { 478 if (remove_mask & REMOVE_LOCAL_STORAGE) {
479 storage_partition_remove_mask |= 479 storage_partition_remove_mask |=
480 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; 480 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE;
481 } 481 }
482 482
483 if (remove_mask & REMOVE_INDEXEDDB) { 483 if (remove_mask & REMOVE_INDEXEDDB) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 delete_begin_time = base::Time(); 747 delete_begin_time = base::Time();
748 break; 748 break;
749 default: 749 default:
750 NOTREACHED() << L"Missing item"; 750 NOTREACHED() << L"Missing item";
751 break; 751 break;
752 } 752 }
753 return delete_begin_time - diff; 753 return delete_begin_time - diff;
754 } 754 }
755 755
756 bool BrowsingDataRemover::AllDone() { 756 bool BrowsingDataRemover::AllDone() {
757 return !waiting_for_clear_keyword_data_ && 757 return !waiting_for_clear_autofill_origin_urls_ &&
758 !waiting_for_clear_autofill_origin_urls_ && 758 !waiting_for_clear_cache_ &&
759 !waiting_for_clear_cache_ && !waiting_for_clear_nacl_cache_ && 759 !waiting_for_clear_content_licenses_ &&
760 !waiting_for_clear_cookies_count_ && !waiting_for_clear_history_ && 760 !waiting_for_clear_channel_ids_ &&
761 !waiting_for_clear_cookies_count_ &&
761 !waiting_for_clear_domain_reliability_monitor_ && 762 !waiting_for_clear_domain_reliability_monitor_ &&
763 !waiting_for_clear_form_ &&
764 !waiting_for_clear_history_ &&
765 !waiting_for_clear_hostname_resolution_cache_ &&
766 !waiting_for_clear_keyword_data_ &&
762 !waiting_for_clear_logged_in_predictor_ && 767 !waiting_for_clear_logged_in_predictor_ &&
768 !waiting_for_clear_nacl_cache_ &&
769 !waiting_for_clear_network_predictor_ &&
763 !waiting_for_clear_networking_history_ && 770 !waiting_for_clear_networking_history_ &&
764 !waiting_for_clear_server_bound_certs_ && 771 !waiting_for_clear_platform_keys_ &&
765 !waiting_for_clear_plugin_data_ && 772 !waiting_for_clear_plugin_data_ &&
766 !waiting_for_clear_pnacl_cache_ && 773 !waiting_for_clear_pnacl_cache_ &&
767 !waiting_for_clear_content_licenses_ && !waiting_for_clear_form_ &&
768 !waiting_for_clear_hostname_resolution_cache_ &&
769 !waiting_for_clear_network_predictor_ &&
770 !waiting_for_clear_platform_keys_ &&
771 #if defined(ENABLE_WEBRTC) 774 #if defined(ENABLE_WEBRTC)
772 !waiting_for_clear_webrtc_logs_ && 775 !waiting_for_clear_webrtc_logs_ &&
773 #endif 776 #endif
774 !waiting_for_clear_storage_partition_data_; 777 !waiting_for_clear_storage_partition_data_;
775 } 778 }
776 779
777 void BrowsingDataRemover::OnKeywordsLoaded() { 780 void BrowsingDataRemover::OnKeywordsLoaded() {
778 // Deletes the entries from the model, and if we're not waiting on anything 781 // Deletes the entries from the model, and if we're not waiting on anything
779 // else notifies observers and deletes this BrowsingDataRemover. 782 // else notifies observers and deletes this BrowsingDataRemover.
780 TemplateURLService* model = 783 TemplateURLService* model =
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 net::URLRequestContextGetter* rq_context) { 1113 net::URLRequestContextGetter* rq_context) {
1111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1112 net::CookieStore* cookie_store = rq_context-> 1115 net::CookieStore* cookie_store = rq_context->
1113 GetURLRequestContext()->cookie_store(); 1116 GetURLRequestContext()->cookie_store();
1114 cookie_store->DeleteAllCreatedBetweenAsync( 1117 cookie_store->DeleteAllCreatedBetweenAsync(
1115 delete_begin_, delete_end_, 1118 delete_begin_, delete_end_,
1116 base::Bind(&BrowsingDataRemover::OnClearedCookies, 1119 base::Bind(&BrowsingDataRemover::OnClearedCookies,
1117 base::Unretained(this))); 1120 base::Unretained(this)));
1118 } 1121 }
1119 1122
1120 void BrowsingDataRemover::ClearServerBoundCertsOnIOThread( 1123 void BrowsingDataRemover::ClearChannelIDsOnIOThread(
1121 net::URLRequestContextGetter* rq_context) { 1124 net::URLRequestContextGetter* rq_context) {
1122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1123 net::ServerBoundCertService* server_bound_cert_service = 1126 net::ChannelIDService* channel_id_service =
1124 rq_context->GetURLRequestContext()->server_bound_cert_service(); 1127 rq_context->GetURLRequestContext()->channel_id_service();
1125 server_bound_cert_service->GetCertStore()->DeleteAllCreatedBetween( 1128 channel_id_service->GetChannelIDStore()->DeleteAllCreatedBetween(
1126 delete_begin_, delete_end_, 1129 delete_begin_, delete_end_,
1127 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCertsOnIOThread, 1130 base::Bind(&BrowsingDataRemover::OnClearedChannelIDsOnIOThread,
1128 base::Unretained(this), base::Unretained(rq_context))); 1131 base::Unretained(this), base::Unretained(rq_context)));
1129 } 1132 }
1130 1133
1131 void BrowsingDataRemover::OnClearedServerBoundCertsOnIOThread( 1134 void BrowsingDataRemover::OnClearedChannelIDsOnIOThread(
1132 net::URLRequestContextGetter* rq_context) { 1135 net::URLRequestContextGetter* rq_context) {
1133 // Need to close open SSL connections which may be using the channel ids we 1136 // Need to close open SSL connections which may be using the channel ids we
1134 // are deleting. 1137 // are deleting.
1135 // TODO(mattm): http://crbug.com/166069 Make the server bound cert 1138 // TODO(mattm): http://crbug.com/166069 Make the server bound cert
1136 // service/store have observers that can notify relevant things directly. 1139 // service/store have observers that can notify relevant things directly.
1137 rq_context->GetURLRequestContext()->ssl_config_service()-> 1140 rq_context->GetURLRequestContext()->ssl_config_service()->
1138 NotifySSLConfigChange(); 1141 NotifySSLConfigChange();
1139 BrowserThread::PostTask( 1142 BrowserThread::PostTask(
1140 BrowserThread::UI, FROM_HERE, 1143 BrowserThread::UI, FROM_HERE,
1141 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, 1144 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs,
1142 base::Unretained(this))); 1145 base::Unretained(this)));
1143 } 1146 }
1144 1147
1145 void BrowsingDataRemover::OnClearedServerBoundCerts() { 1148 void BrowsingDataRemover::OnClearedChannelIDs() {
1146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1147 waiting_for_clear_server_bound_certs_ = false; 1150 waiting_for_clear_channel_ids_ = false;
1148 NotifyAndDeleteIfDone(); 1151 NotifyAndDeleteIfDone();
1149 } 1152 }
1150 1153
1151 void BrowsingDataRemover::OnClearedFormData() { 1154 void BrowsingDataRemover::OnClearedFormData() {
1152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1153 waiting_for_clear_form_ = false; 1156 waiting_for_clear_form_ = false;
1154 NotifyAndDeleteIfDone(); 1157 NotifyAndDeleteIfDone();
1155 } 1158 }
1156 1159
1157 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { 1160 void BrowsingDataRemover::OnClearedAutofillOriginURLs() {
(...skipping 14 matching lines...) Expand all
1172 waiting_for_clear_webrtc_logs_ = false; 1175 waiting_for_clear_webrtc_logs_ = false;
1173 NotifyAndDeleteIfDone(); 1176 NotifyAndDeleteIfDone();
1174 } 1177 }
1175 #endif 1178 #endif
1176 1179
1177 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1180 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1179 waiting_for_clear_domain_reliability_monitor_ = false; 1182 waiting_for_clear_domain_reliability_monitor_ = false;
1180 NotifyAndDeleteIfDone(); 1183 NotifyAndDeleteIfDone();
1181 } 1184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698