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

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: More unittest fixes 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "components/web_cache/browser/web_cache_manager.h" 66 #include "components/web_cache/browser/web_cache_manager.h"
67 #include "content/public/browser/browser_thread.h" 67 #include "content/public/browser/browser_thread.h"
68 #include "content/public/browser/download_manager.h" 68 #include "content/public/browser/download_manager.h"
69 #include "content/public/browser/notification_service.h" 69 #include "content/public/browser/notification_service.h"
70 #include "content/public/browser/plugin_data_remover.h" 70 #include "content/public/browser/plugin_data_remover.h"
71 #include "content/public/browser/ssl_host_state_delegate.h" 71 #include "content/public/browser/ssl_host_state_delegate.h"
72 #include "content/public/browser/storage_partition.h" 72 #include "content/public/browser/storage_partition.h"
73 #include "content/public/browser/user_metrics.h" 73 #include "content/public/browser/user_metrics.h"
74 #include "net/base/net_errors.h" 74 #include "net/base/net_errors.h"
75 #include "net/cookies/cookie_store.h" 75 #include "net/cookies/cookie_store.h"
76 #include "net/http/http_network_session.h"
77 #include "net/http/http_transaction_factory.h"
76 #include "net/http/transport_security_state.h" 78 #include "net/http/transport_security_state.h"
77 #include "net/ssl/channel_id_service.h" 79 #include "net/ssl/channel_id_service.h"
78 #include "net/ssl/channel_id_store.h" 80 #include "net/ssl/channel_id_store.h"
79 #include "net/url_request/url_request_context.h" 81 #include "net/url_request/url_request_context.h"
80 #include "net/url_request/url_request_context_getter.h" 82 #include "net/url_request/url_request_context_getter.h"
81 #include "storage/browser/quota/special_storage_policy.h" 83 #include "storage/browser/quota/special_storage_policy.h"
82 #include "url/origin.h" 84 #include "url/origin.h"
83 85
84 #if BUILDFLAG(ANDROID_JAVA_UI) 86 #if BUILDFLAG(ANDROID_JAVA_UI)
85 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 87 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const ContentSettingsPattern& secondary_pattern) { 169 const ContentSettingsPattern& secondary_pattern) {
168 return predicate.Run(primary_pattern); 170 return predicate.Run(primary_pattern);
169 } 171 }
170 172
171 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) { 173 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) {
172 DCHECK_CURRENTLY_ON(BrowserThread::IO); 174 DCHECK_CURRENTLY_ON(BrowserThread::IO);
173 175
174 io_thread->ClearHostCache(); 176 io_thread->ClearHostCache();
175 } 177 }
176 178
179 void ClearHttpAuthCacheOnIOThread(
180 scoped_refptr<net::URLRequestContextGetter> context_getter,
181 base::Time delete_begin) {
182 DCHECK_CURRENTLY_ON(BrowserThread::IO);
183
184 net::HttpNetworkSession* http_session = context_getter->GetURLRequestContext()
185 ->http_transaction_factory()
186 ->GetSession();
187 DCHECK(http_session);
188 http_session->http_auth_cache()->ClearEntriesAddedWithin(base::Time::Now() -
189 delete_begin);
190 http_session->CloseAllConnections();
191 }
192
177 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { 193 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) {
178 DCHECK_CURRENTLY_ON(BrowserThread::IO); 194 DCHECK_CURRENTLY_ON(BrowserThread::IO);
179 DCHECK(predictor); 195 DCHECK(predictor);
180 196
181 predictor->DiscardInitialNavigationHistory(); 197 predictor->DiscardInitialNavigationHistory();
182 predictor->DiscardAllResults(); 198 predictor->DiscardAllResults();
183 } 199 }
184 200
185 #if !defined(DISABLE_NACL) 201 #if !defined(DISABLE_NACL)
186 void ClearNaClCacheOnIOThread(const base::Closure& callback) { 202 void ClearNaClCacheOnIOThread(const base::Closure& callback) {
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 978
963 // When clearing cache, wipe accumulated network related data 979 // When clearing cache, wipe accumulated network related data
964 // (TransportSecurityState and HttpServerPropertiesManager data). 980 // (TransportSecurityState and HttpServerPropertiesManager data).
965 waiting_for_clear_networking_history_ = true; 981 waiting_for_clear_networking_history_ = true;
966 profile_->ClearNetworkingHistorySince( 982 profile_->ClearNetworkingHistorySince(
967 delete_begin_, 983 delete_begin_,
968 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 984 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
969 weak_ptr_factory_.GetWeakPtr())); 985 weak_ptr_factory_.GetWeakPtr()));
970 } 986 }
971 987
988 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) {
989 scoped_refptr<net::URLRequestContextGetter> request_context =
990 profile_->GetRequestContext();
991 waiting_for_clear_http_auth_cache_ = true;
992 BrowserThread::PostTaskAndReply(
993 BrowserThread::IO, FROM_HERE,
994 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context),
995 delete_begin_),
996 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache,
997 weak_ptr_factory_.GetWeakPtr()));
998 }
999
972 // Content Decryption Modules used by Encrypted Media store licenses in a 1000 // Content Decryption Modules used by Encrypted Media store licenses in a
973 // private filesystem. These are different than content licenses used by 1001 // private filesystem. These are different than content licenses used by
974 // Flash (which are deleted father down in this method). 1002 // Flash (which are deleted father down in this method).
975 if (remove_mask & REMOVE_MEDIA_LICENSES) { 1003 if (remove_mask & REMOVE_MEDIA_LICENSES) {
976 storage_partition_remove_mask |= 1004 storage_partition_remove_mask |=
977 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; 1005 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA;
978 } 1006 }
979 1007
980 if (storage_partition_remove_mask) { 1008 if (storage_partition_remove_mask) {
981 waiting_for_clear_storage_partition_data_ = true; 1009 waiting_for_clear_storage_partition_data_ = true;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 1223
1196 bool BrowsingDataRemover::AllDone() { 1224 bool BrowsingDataRemover::AllDone() {
1197 return !waiting_for_synchronous_clear_operations_ && 1225 return !waiting_for_synchronous_clear_operations_ &&
1198 !waiting_for_clear_autofill_origin_urls_ && 1226 !waiting_for_clear_autofill_origin_urls_ &&
1199 !waiting_for_clear_cache_ && 1227 !waiting_for_clear_cache_ &&
1200 !waiting_for_clear_flash_content_licenses_ && 1228 !waiting_for_clear_flash_content_licenses_ &&
1201 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && 1229 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ &&
1202 !waiting_for_clear_domain_reliability_monitor_ && 1230 !waiting_for_clear_domain_reliability_monitor_ &&
1203 !waiting_for_clear_form_ && !waiting_for_clear_history_ && 1231 !waiting_for_clear_form_ && !waiting_for_clear_history_ &&
1204 !waiting_for_clear_hostname_resolution_cache_ && 1232 !waiting_for_clear_hostname_resolution_cache_ &&
1233 !waiting_for_clear_http_auth_cache_ &&
1205 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && 1234 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ &&
1206 !waiting_for_clear_network_predictor_ && 1235 !waiting_for_clear_network_predictor_ &&
1207 !waiting_for_clear_networking_history_ && 1236 !waiting_for_clear_networking_history_ &&
1208 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && 1237 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ &&
1209 !waiting_for_clear_platform_keys_ && 1238 !waiting_for_clear_platform_keys_ &&
1210 !waiting_for_clear_plugin_data_count_ && 1239 !waiting_for_clear_plugin_data_count_ &&
1211 !waiting_for_clear_pnacl_cache_ && 1240 !waiting_for_clear_pnacl_cache_ &&
1212 #if BUILDFLAG(ANDROID_JAVA_UI) 1241 #if BUILDFLAG(ANDROID_JAVA_UI)
1213 !waiting_for_clear_precache_history_ && 1242 !waiting_for_clear_precache_history_ &&
1214 !waiting_for_clear_webapp_data_ && 1243 !waiting_for_clear_webapp_data_ &&
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 waiting_for_clear_history_ = false; 1322 waiting_for_clear_history_ = false;
1294 NotifyIfDone(); 1323 NotifyIfDone();
1295 } 1324 }
1296 1325
1297 void BrowsingDataRemover::OnClearedHostnameResolutionCache() { 1326 void BrowsingDataRemover::OnClearedHostnameResolutionCache() {
1298 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1327 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1299 waiting_for_clear_hostname_resolution_cache_ = false; 1328 waiting_for_clear_hostname_resolution_cache_ = false;
1300 NotifyIfDone(); 1329 NotifyIfDone();
1301 } 1330 }
1302 1331
1332 void BrowsingDataRemover::OnClearedHttpAuthCache() {
1333 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1334 waiting_for_clear_http_auth_cache_ = false;
1335 NotifyIfDone();
1336 }
1337
1303 void BrowsingDataRemover::OnClearedNetworkPredictor() { 1338 void BrowsingDataRemover::OnClearedNetworkPredictor() {
1304 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1339 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1305 waiting_for_clear_network_predictor_ = false; 1340 waiting_for_clear_network_predictor_ = false;
1306 NotifyIfDone(); 1341 NotifyIfDone();
1307 } 1342 }
1308 1343
1309 void BrowsingDataRemover::OnClearedNetworkingHistory() { 1344 void BrowsingDataRemover::OnClearedNetworkingHistory() {
1310 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1345 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1311 waiting_for_clear_networking_history_ = false; 1346 waiting_for_clear_networking_history_ = false;
1312 NotifyIfDone(); 1347 NotifyIfDone();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 waiting_for_clear_offline_page_data_ = false; 1516 waiting_for_clear_offline_page_data_ = false;
1482 NotifyIfDone(); 1517 NotifyIfDone();
1483 } 1518 }
1484 #endif 1519 #endif
1485 1520
1486 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1521 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1487 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1522 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1488 waiting_for_clear_domain_reliability_monitor_ = false; 1523 waiting_for_clear_domain_reliability_monitor_ = false;
1489 NotifyIfDone(); 1524 NotifyIfDone();
1490 } 1525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698