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

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

Issue 2097043002: Clear HTTP auth data on clearing browsing data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixup to HttpAuthCacheTest.ClearEntriesAddedWithin Created 4 years, 3 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
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 #include <string> 9 #include <string>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "components/web_cache/browser/web_cache_manager.h" 68 #include "components/web_cache/browser/web_cache_manager.h"
69 #include "content/public/browser/browser_thread.h" 69 #include "content/public/browser/browser_thread.h"
70 #include "content/public/browser/download_manager.h" 70 #include "content/public/browser/download_manager.h"
71 #include "content/public/browser/notification_service.h" 71 #include "content/public/browser/notification_service.h"
72 #include "content/public/browser/plugin_data_remover.h" 72 #include "content/public/browser/plugin_data_remover.h"
73 #include "content/public/browser/ssl_host_state_delegate.h" 73 #include "content/public/browser/ssl_host_state_delegate.h"
74 #include "content/public/browser/storage_partition.h" 74 #include "content/public/browser/storage_partition.h"
75 #include "content/public/browser/user_metrics.h" 75 #include "content/public/browser/user_metrics.h"
76 #include "net/base/net_errors.h" 76 #include "net/base/net_errors.h"
77 #include "net/cookies/cookie_store.h" 77 #include "net/cookies/cookie_store.h"
78 #include "net/http/http_network_session.h"
79 #include "net/http/http_transaction_factory.h"
78 #include "net/http/transport_security_state.h" 80 #include "net/http/transport_security_state.h"
79 #include "net/ssl/channel_id_service.h" 81 #include "net/ssl/channel_id_service.h"
80 #include "net/ssl/channel_id_store.h" 82 #include "net/ssl/channel_id_store.h"
81 #include "net/url_request/url_request_context.h" 83 #include "net/url_request/url_request_context.h"
82 #include "net/url_request/url_request_context_getter.h" 84 #include "net/url_request/url_request_context_getter.h"
83 #include "storage/browser/quota/special_storage_policy.h" 85 #include "storage/browser/quota/special_storage_policy.h"
84 #include "url/origin.h" 86 #include "url/origin.h"
85 87
86 #if BUILDFLAG(ANDROID_JAVA_UI) 88 #if BUILDFLAG(ANDROID_JAVA_UI)
87 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 89 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const ContentSettingsPattern& secondary_pattern) { 171 const ContentSettingsPattern& secondary_pattern) {
170 return predicate.Run(primary_pattern); 172 return predicate.Run(primary_pattern);
171 } 173 }
172 174
173 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) { 175 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) {
174 DCHECK_CURRENTLY_ON(BrowserThread::IO); 176 DCHECK_CURRENTLY_ON(BrowserThread::IO);
175 177
176 io_thread->ClearHostCache(); 178 io_thread->ClearHostCache();
177 } 179 }
178 180
181 void ClearHttpAuthCacheOnIOThread(
182 scoped_refptr<net::URLRequestContextGetter> context_getter,
183 base::Time delete_begin) {
184 DCHECK_CURRENTLY_ON(BrowserThread::IO);
185
186 net::HttpNetworkSession* http_session = context_getter->GetURLRequestContext()
187 ->http_transaction_factory()
188 ->GetSession();
189 DCHECK(http_session);
190 http_session->http_auth_cache()->ClearEntriesAddedWithin(base::Time::Now() -
191 delete_begin);
192 http_session->CloseAllConnections();
193 }
194
179 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { 195 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) {
180 DCHECK_CURRENTLY_ON(BrowserThread::IO); 196 DCHECK_CURRENTLY_ON(BrowserThread::IO);
181 DCHECK(predictor); 197 DCHECK(predictor);
182 198
183 predictor->DiscardInitialNavigationHistory(); 199 predictor->DiscardInitialNavigationHistory();
184 predictor->DiscardAllResults(); 200 predictor->DiscardAllResults();
185 } 201 }
186 202
187 #if !defined(DISABLE_NACL) 203 #if !defined(DISABLE_NACL)
188 void ClearNaClCacheOnIOThread(const base::Closure& callback) { 204 void ClearNaClCacheOnIOThread(const base::Closure& callback) {
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 delete_begin_, 990 delete_begin_,
975 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 991 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
976 weak_ptr_factory_.GetWeakPtr())); 992 weak_ptr_factory_.GetWeakPtr()));
977 993
978 ntp_snippets::ContentSuggestionsService* content_suggestions_service = 994 ntp_snippets::ContentSuggestionsService* content_suggestions_service =
979 ContentSuggestionsServiceFactory::GetForProfile(profile_); 995 ContentSuggestionsServiceFactory::GetForProfile(profile_);
980 if (content_suggestions_service) 996 if (content_suggestions_service)
981 content_suggestions_service->ClearAllCachedSuggestions(); 997 content_suggestions_service->ClearAllCachedSuggestions();
982 } 998 }
983 999
1000 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) {
1001 scoped_refptr<net::URLRequestContextGetter> request_context =
1002 profile_->GetRequestContext();
1003 waiting_for_clear_http_auth_cache_ = true;
1004 BrowserThread::PostTaskAndReply(
1005 BrowserThread::IO, FROM_HERE,
1006 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context),
1007 delete_begin_),
1008 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache,
1009 weak_ptr_factory_.GetWeakPtr()));
1010 }
1011
984 // Content Decryption Modules used by Encrypted Media store licenses in a 1012 // Content Decryption Modules used by Encrypted Media store licenses in a
985 // private filesystem. These are different than content licenses used by 1013 // private filesystem. These are different than content licenses used by
986 // Flash (which are deleted father down in this method). 1014 // Flash (which are deleted father down in this method).
987 if (remove_mask & REMOVE_MEDIA_LICENSES) { 1015 if (remove_mask & REMOVE_MEDIA_LICENSES) {
988 storage_partition_remove_mask |= 1016 storage_partition_remove_mask |=
989 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; 1017 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA;
990 } 1018 }
991 1019
992 if (storage_partition_remove_mask) { 1020 if (storage_partition_remove_mask) {
993 waiting_for_clear_storage_partition_data_ = true; 1021 waiting_for_clear_storage_partition_data_ = true;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 1234
1207 bool BrowsingDataRemover::AllDone() { 1235 bool BrowsingDataRemover::AllDone() {
1208 return !waiting_for_synchronous_clear_operations_ && 1236 return !waiting_for_synchronous_clear_operations_ &&
1209 !waiting_for_clear_autofill_origin_urls_ && 1237 !waiting_for_clear_autofill_origin_urls_ &&
1210 !waiting_for_clear_cache_ && 1238 !waiting_for_clear_cache_ &&
1211 !waiting_for_clear_flash_content_licenses_ && 1239 !waiting_for_clear_flash_content_licenses_ &&
1212 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && 1240 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ &&
1213 !waiting_for_clear_domain_reliability_monitor_ && 1241 !waiting_for_clear_domain_reliability_monitor_ &&
1214 !waiting_for_clear_form_ && !waiting_for_clear_history_ && 1242 !waiting_for_clear_form_ && !waiting_for_clear_history_ &&
1215 !waiting_for_clear_hostname_resolution_cache_ && 1243 !waiting_for_clear_hostname_resolution_cache_ &&
1244 !waiting_for_clear_http_auth_cache_ &&
1216 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && 1245 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ &&
1217 !waiting_for_clear_network_predictor_ && 1246 !waiting_for_clear_network_predictor_ &&
1218 !waiting_for_clear_networking_history_ && 1247 !waiting_for_clear_networking_history_ &&
1219 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && 1248 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ &&
1220 !waiting_for_clear_platform_keys_ && 1249 !waiting_for_clear_platform_keys_ &&
1221 !waiting_for_clear_plugin_data_count_ && 1250 !waiting_for_clear_plugin_data_count_ &&
1222 !waiting_for_clear_pnacl_cache_ && 1251 !waiting_for_clear_pnacl_cache_ &&
1223 #if BUILDFLAG(ANDROID_JAVA_UI) 1252 #if BUILDFLAG(ANDROID_JAVA_UI)
1224 !waiting_for_clear_precache_history_ && 1253 !waiting_for_clear_precache_history_ &&
1225 !waiting_for_clear_webapp_data_ && 1254 !waiting_for_clear_webapp_data_ &&
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 waiting_for_clear_history_ = false; 1333 waiting_for_clear_history_ = false;
1305 NotifyIfDone(); 1334 NotifyIfDone();
1306 } 1335 }
1307 1336
1308 void BrowsingDataRemover::OnClearedHostnameResolutionCache() { 1337 void BrowsingDataRemover::OnClearedHostnameResolutionCache() {
1309 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1338 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1310 waiting_for_clear_hostname_resolution_cache_ = false; 1339 waiting_for_clear_hostname_resolution_cache_ = false;
1311 NotifyIfDone(); 1340 NotifyIfDone();
1312 } 1341 }
1313 1342
1343 void BrowsingDataRemover::OnClearedHttpAuthCache() {
1344 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1345 waiting_for_clear_http_auth_cache_ = false;
1346 NotifyIfDone();
1347 }
1348
1314 void BrowsingDataRemover::OnClearedNetworkPredictor() { 1349 void BrowsingDataRemover::OnClearedNetworkPredictor() {
1315 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1350 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1316 waiting_for_clear_network_predictor_ = false; 1351 waiting_for_clear_network_predictor_ = false;
1317 NotifyIfDone(); 1352 NotifyIfDone();
1318 } 1353 }
1319 1354
1320 void BrowsingDataRemover::OnClearedNetworkingHistory() { 1355 void BrowsingDataRemover::OnClearedNetworkingHistory() {
1321 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1356 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1322 waiting_for_clear_networking_history_ = false; 1357 waiting_for_clear_networking_history_ = false;
1323 NotifyIfDone(); 1358 NotifyIfDone();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 waiting_for_clear_offline_page_data_ = false; 1527 waiting_for_clear_offline_page_data_ = false;
1493 NotifyIfDone(); 1528 NotifyIfDone();
1494 } 1529 }
1495 #endif 1530 #endif
1496 1531
1497 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1532 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1498 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1533 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1499 waiting_for_clear_domain_reliability_monitor_ = false; 1534 waiting_for_clear_domain_reliability_monitor_ = false;
1500 NotifyIfDone(); 1535 NotifyIfDone();
1501 } 1536 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698