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

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: Rebase 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.h" 79 #include "chrome/browser/chromeos/login/users/user.h"
80 #include "chrome/browser/chromeos/login/users/user_manager.h" 80 #include "chrome/browser/chromeos/login/users/user_manager.h"
81 #include "chrome/browser/chromeos/profiles/profile_helper.h" 81 #include "chrome/browser/chromeos/profiles/profile_helper.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), 186 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()),
187 delete_begin_(delete_begin), 187 delete_begin_(delete_begin),
188 delete_end_(delete_end), 188 delete_end_(delete_end),
189 next_cache_state_(STATE_NONE), 189 next_cache_state_(STATE_NONE),
190 cache_(NULL), 190 cache_(NULL),
191 main_context_getter_(profile->GetRequestContext()), 191 main_context_getter_(profile->GetRequestContext()),
192 media_context_getter_(profile->GetMediaRequestContext()), 192 media_context_getter_(profile->GetMediaRequestContext()),
193 deauthorize_content_licenses_request_id_(0), 193 deauthorize_content_licenses_request_id_(0),
194 waiting_for_clear_autofill_origin_urls_(false), 194 waiting_for_clear_autofill_origin_urls_(false),
195 waiting_for_clear_cache_(false), 195 waiting_for_clear_cache_(false),
196 waiting_for_clear_channel_ids_(false),
196 waiting_for_clear_content_licenses_(false), 197 waiting_for_clear_content_licenses_(false),
197 waiting_for_clear_cookies_count_(0), 198 waiting_for_clear_cookies_count_(0),
198 waiting_for_clear_domain_reliability_monitor_(false), 199 waiting_for_clear_domain_reliability_monitor_(false),
199 waiting_for_clear_form_(false), 200 waiting_for_clear_form_(false),
200 waiting_for_clear_history_(false), 201 waiting_for_clear_history_(false),
201 waiting_for_clear_hostname_resolution_cache_(false), 202 waiting_for_clear_hostname_resolution_cache_(false),
202 waiting_for_clear_keyword_data_(false), 203 waiting_for_clear_keyword_data_(false),
203 waiting_for_clear_logged_in_predictor_(false), 204 waiting_for_clear_logged_in_predictor_(false),
204 waiting_for_clear_nacl_cache_(false), 205 waiting_for_clear_nacl_cache_(false),
205 waiting_for_clear_network_predictor_(false), 206 waiting_for_clear_network_predictor_(false),
206 waiting_for_clear_networking_history_(false), 207 waiting_for_clear_networking_history_(false),
207 waiting_for_clear_platform_keys_(false), 208 waiting_for_clear_platform_keys_(false),
208 waiting_for_clear_plugin_data_(false), 209 waiting_for_clear_plugin_data_(false),
209 waiting_for_clear_pnacl_cache_(false), 210 waiting_for_clear_pnacl_cache_(false),
210 waiting_for_clear_server_bound_certs_(false),
211 waiting_for_clear_storage_partition_data_(false), 211 waiting_for_clear_storage_partition_data_(false),
212 #if defined(ENABLE_WEBRTC) 212 #if defined(ENABLE_WEBRTC)
213 waiting_for_clear_webrtc_logs_(false), 213 waiting_for_clear_webrtc_logs_(false),
214 #endif 214 #endif
215 remove_mask_(0), 215 remove_mask_(0),
216 remove_origin_(GURL()), 216 remove_origin_(GURL()),
217 origin_set_mask_(0), 217 origin_set_mask_(0),
218 storage_partition_for_testing_(NULL) { 218 storage_partition_for_testing_(NULL) {
219 DCHECK(profile); 219 DCHECK(profile);
220 // crbug.com/140910: Many places were calling this with base::Time() as 220 // crbug.com/140910: Many places were calling this with base::Time() as
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread, 452 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread,
453 base::Unretained(this), base::Unretained(sb_context))); 453 base::Unretained(this), base::Unretained(sb_context)));
454 } 454 }
455 } 455 }
456 #endif 456 #endif
457 MediaDeviceIDSalt::Reset(profile_->GetPrefs()); 457 MediaDeviceIDSalt::Reset(profile_->GetPrefs());
458 } 458 }
459 459
460 // Server bound certs are not separated for protected and unprotected web 460 // Server bound certs are not separated for protected and unprotected web
461 // origins. We check the origin_set_mask_ to prevent unintended deletion. 461 // origins. We check the origin_set_mask_ to prevent unintended deletion.
462 if (remove_mask & REMOVE_SERVER_BOUND_CERTS && 462 if (remove_mask & REMOVE_CHANNEL_IDS &&
463 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { 463 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) {
464 content::RecordAction( 464 content::RecordAction(
465 UserMetricsAction("ClearBrowsingData_ServerBoundCerts")); 465 UserMetricsAction("ClearBrowsingData_ChannelIDs"));
466 // Since we are running on the UI thread don't call GetURLRequestContext(). 466 // Since we are running on the UI thread don't call GetURLRequestContext().
467 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); 467 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext();
468 if (rq_context) { 468 if (rq_context) {
469 waiting_for_clear_server_bound_certs_ = true; 469 waiting_for_clear_channel_ids_ = true;
470 BrowserThread::PostTask( 470 BrowserThread::PostTask(
471 BrowserThread::IO, FROM_HERE, 471 BrowserThread::IO, FROM_HERE,
472 base::Bind(&BrowsingDataRemover::ClearServerBoundCertsOnIOThread, 472 base::Bind(&BrowsingDataRemover::ClearChannelIDsOnIOThread,
473 base::Unretained(this), base::Unretained(rq_context))); 473 base::Unretained(this), base::Unretained(rq_context)));
474 } 474 }
475 } 475 }
476 476
477 if (remove_mask & REMOVE_LOCAL_STORAGE) { 477 if (remove_mask & REMOVE_LOCAL_STORAGE) {
478 storage_partition_remove_mask |= 478 storage_partition_remove_mask |=
479 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; 479 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE;
480 } 480 }
481 481
482 if (remove_mask & REMOVE_INDEXEDDB) { 482 if (remove_mask & REMOVE_INDEXEDDB) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 delete_begin_time = base::Time(); 741 delete_begin_time = base::Time();
742 break; 742 break;
743 default: 743 default:
744 NOTREACHED() << L"Missing item"; 744 NOTREACHED() << L"Missing item";
745 break; 745 break;
746 } 746 }
747 return delete_begin_time - diff; 747 return delete_begin_time - diff;
748 } 748 }
749 749
750 bool BrowsingDataRemover::AllDone() { 750 bool BrowsingDataRemover::AllDone() {
751 return !waiting_for_clear_keyword_data_ && 751 return !waiting_for_clear_autofill_origin_urls_ &&
752 !waiting_for_clear_autofill_origin_urls_ && 752 !waiting_for_clear_cache_ &&
753 !waiting_for_clear_cache_ && !waiting_for_clear_nacl_cache_ && 753 !waiting_for_clear_content_licenses_ &&
754 !waiting_for_clear_cookies_count_ && !waiting_for_clear_history_ && 754 !waiting_for_clear_channel_ids_ &&
755 !waiting_for_clear_cookies_count_ &&
755 !waiting_for_clear_domain_reliability_monitor_ && 756 !waiting_for_clear_domain_reliability_monitor_ &&
757 !waiting_for_clear_form_ &&
758 !waiting_for_clear_history_ &&
759 !waiting_for_clear_hostname_resolution_cache_ &&
760 !waiting_for_clear_keyword_data_ &&
756 !waiting_for_clear_logged_in_predictor_ && 761 !waiting_for_clear_logged_in_predictor_ &&
762 !waiting_for_clear_nacl_cache_ &&
763 !waiting_for_clear_network_predictor_ &&
757 !waiting_for_clear_networking_history_ && 764 !waiting_for_clear_networking_history_ &&
758 !waiting_for_clear_server_bound_certs_ && 765 !waiting_for_clear_platform_keys_ &&
759 !waiting_for_clear_plugin_data_ && 766 !waiting_for_clear_plugin_data_ &&
760 !waiting_for_clear_pnacl_cache_ && 767 !waiting_for_clear_pnacl_cache_ &&
761 !waiting_for_clear_content_licenses_ && !waiting_for_clear_form_ &&
762 !waiting_for_clear_hostname_resolution_cache_ &&
763 !waiting_for_clear_network_predictor_ &&
764 !waiting_for_clear_platform_keys_ &&
765 #if defined(ENABLE_WEBRTC) 768 #if defined(ENABLE_WEBRTC)
766 !waiting_for_clear_webrtc_logs_ && 769 !waiting_for_clear_webrtc_logs_ &&
767 #endif 770 #endif
768 !waiting_for_clear_storage_partition_data_; 771 !waiting_for_clear_storage_partition_data_;
769 } 772 }
770 773
771 void BrowsingDataRemover::OnKeywordsLoaded() { 774 void BrowsingDataRemover::OnKeywordsLoaded() {
772 // Deletes the entries from the model, and if we're not waiting on anything 775 // Deletes the entries from the model, and if we're not waiting on anything
773 // else notifies observers and deletes this BrowsingDataRemover. 776 // else notifies observers and deletes this BrowsingDataRemover.
774 TemplateURLService* model = 777 TemplateURLService* model =
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 net::URLRequestContextGetter* rq_context) { 1107 net::URLRequestContextGetter* rq_context) {
1105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1106 net::CookieStore* cookie_store = rq_context-> 1109 net::CookieStore* cookie_store = rq_context->
1107 GetURLRequestContext()->cookie_store(); 1110 GetURLRequestContext()->cookie_store();
1108 cookie_store->DeleteAllCreatedBetweenAsync( 1111 cookie_store->DeleteAllCreatedBetweenAsync(
1109 delete_begin_, delete_end_, 1112 delete_begin_, delete_end_,
1110 base::Bind(&BrowsingDataRemover::OnClearedCookies, 1113 base::Bind(&BrowsingDataRemover::OnClearedCookies,
1111 base::Unretained(this))); 1114 base::Unretained(this)));
1112 } 1115 }
1113 1116
1114 void BrowsingDataRemover::ClearServerBoundCertsOnIOThread( 1117 void BrowsingDataRemover::ClearChannelIDsOnIOThread(
1115 net::URLRequestContextGetter* rq_context) { 1118 net::URLRequestContextGetter* rq_context) {
1116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1117 net::ServerBoundCertService* server_bound_cert_service = 1120 net::ChannelIDService* channel_id_service =
1118 rq_context->GetURLRequestContext()->server_bound_cert_service(); 1121 rq_context->GetURLRequestContext()->channel_id_service();
1119 server_bound_cert_service->GetCertStore()->DeleteAllCreatedBetween( 1122 channel_id_service->GetChannelIDStore()->DeleteAllCreatedBetween(
1120 delete_begin_, delete_end_, 1123 delete_begin_, delete_end_,
1121 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCertsOnIOThread, 1124 base::Bind(&BrowsingDataRemover::OnClearedChannelIDsOnIOThread,
1122 base::Unretained(this), base::Unretained(rq_context))); 1125 base::Unretained(this), base::Unretained(rq_context)));
1123 } 1126 }
1124 1127
1125 void BrowsingDataRemover::OnClearedServerBoundCertsOnIOThread( 1128 void BrowsingDataRemover::OnClearedChannelIDsOnIOThread(
1126 net::URLRequestContextGetter* rq_context) { 1129 net::URLRequestContextGetter* rq_context) {
1127 // Need to close open SSL connections which may be using the channel ids we 1130 // Need to close open SSL connections which may be using the channel ids we
1128 // are deleting. 1131 // are deleting.
1129 // TODO(mattm): http://crbug.com/166069 Make the server bound cert 1132 // TODO(mattm): http://crbug.com/166069 Make the server bound cert
1130 // service/store have observers that can notify relevant things directly. 1133 // service/store have observers that can notify relevant things directly.
1131 rq_context->GetURLRequestContext()->ssl_config_service()-> 1134 rq_context->GetURLRequestContext()->ssl_config_service()->
1132 NotifySSLConfigChange(); 1135 NotifySSLConfigChange();
1133 BrowserThread::PostTask( 1136 BrowserThread::PostTask(
1134 BrowserThread::UI, FROM_HERE, 1137 BrowserThread::UI, FROM_HERE,
1135 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, 1138 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs,
1136 base::Unretained(this))); 1139 base::Unretained(this)));
1137 } 1140 }
1138 1141
1139 void BrowsingDataRemover::OnClearedServerBoundCerts() { 1142 void BrowsingDataRemover::OnClearedChannelIDs() {
1140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1141 waiting_for_clear_server_bound_certs_ = false; 1144 waiting_for_clear_channel_ids_ = false;
1142 NotifyAndDeleteIfDone(); 1145 NotifyAndDeleteIfDone();
1143 } 1146 }
1144 1147
1145 void BrowsingDataRemover::OnClearedFormData() { 1148 void BrowsingDataRemover::OnClearedFormData() {
1146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1147 waiting_for_clear_form_ = false; 1150 waiting_for_clear_form_ = false;
1148 NotifyAndDeleteIfDone(); 1151 NotifyAndDeleteIfDone();
1149 } 1152 }
1150 1153
1151 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { 1154 void BrowsingDataRemover::OnClearedAutofillOriginURLs() {
(...skipping 14 matching lines...) Expand all
1166 waiting_for_clear_webrtc_logs_ = false; 1169 waiting_for_clear_webrtc_logs_ = false;
1167 NotifyAndDeleteIfDone(); 1170 NotifyAndDeleteIfDone();
1168 } 1171 }
1169 #endif 1172 #endif
1170 1173
1171 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1174 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1173 waiting_for_clear_domain_reliability_monitor_ = false; 1176 waiting_for_clear_domain_reliability_monitor_ = false;
1174 NotifyAndDeleteIfDone(); 1177 NotifyAndDeleteIfDone();
1175 } 1178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698