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

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: Minor unit tests fixes Created 4 years, 4 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "components/web_cache/browser/web_cache_manager.h" 65 #include "components/web_cache/browser/web_cache_manager.h"
66 #include "content/public/browser/browser_thread.h" 66 #include "content/public/browser/browser_thread.h"
67 #include "content/public/browser/download_manager.h" 67 #include "content/public/browser/download_manager.h"
68 #include "content/public/browser/notification_service.h" 68 #include "content/public/browser/notification_service.h"
69 #include "content/public/browser/plugin_data_remover.h" 69 #include "content/public/browser/plugin_data_remover.h"
70 #include "content/public/browser/ssl_host_state_delegate.h" 70 #include "content/public/browser/ssl_host_state_delegate.h"
71 #include "content/public/browser/storage_partition.h" 71 #include "content/public/browser/storage_partition.h"
72 #include "content/public/browser/user_metrics.h" 72 #include "content/public/browser/user_metrics.h"
73 #include "net/base/net_errors.h" 73 #include "net/base/net_errors.h"
74 #include "net/cookies/cookie_store.h" 74 #include "net/cookies/cookie_store.h"
75 #include "net/http/http_network_session.h"
76 #include "net/http/http_transaction_factory.h"
75 #include "net/http/transport_security_state.h" 77 #include "net/http/transport_security_state.h"
76 #include "net/ssl/channel_id_service.h" 78 #include "net/ssl/channel_id_service.h"
77 #include "net/ssl/channel_id_store.h" 79 #include "net/ssl/channel_id_store.h"
78 #include "net/url_request/url_request_context.h" 80 #include "net/url_request/url_request_context.h"
79 #include "net/url_request/url_request_context_getter.h" 81 #include "net/url_request/url_request_context_getter.h"
80 #include "storage/browser/quota/special_storage_policy.h" 82 #include "storage/browser/quota/special_storage_policy.h"
81 #include "url/origin.h" 83 #include "url/origin.h"
82 84
83 #if BUILDFLAG(ANDROID_JAVA_UI) 85 #if BUILDFLAG(ANDROID_JAVA_UI)
84 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 86 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 const ContentSettingsPattern& secondary_pattern) { 164 const ContentSettingsPattern& secondary_pattern) {
163 return predicate.Run(primary_pattern); 165 return predicate.Run(primary_pattern);
164 } 166 }
165 167
166 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) { 168 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) {
167 DCHECK_CURRENTLY_ON(BrowserThread::IO); 169 DCHECK_CURRENTLY_ON(BrowserThread::IO);
168 170
169 io_thread->ClearHostCache(); 171 io_thread->ClearHostCache();
170 } 172 }
171 173
174 void ClearHttpAuthCacheOnIOThread(
175 scoped_refptr<net::URLRequestContextGetter> context_getter,
176 base::Time delete_begin) {
177 DCHECK_CURRENTLY_ON(BrowserThread::IO);
178
179 net::HttpNetworkSession* http_session = context_getter->GetURLRequestContext()
180 ->http_transaction_factory()
181 ->GetSession();
182 DCHECK(http_session);
183 http_session->http_auth_cache()->ClearEntriesAddedWithin(base::Time::Now() -
184 delete_begin);
185 http_session->CloseAllConnections();
186 }
187
172 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { 188 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) {
173 DCHECK_CURRENTLY_ON(BrowserThread::IO); 189 DCHECK_CURRENTLY_ON(BrowserThread::IO);
174 DCHECK(predictor); 190 DCHECK(predictor);
175 191
176 predictor->DiscardInitialNavigationHistory(); 192 predictor->DiscardInitialNavigationHistory();
177 predictor->DiscardAllResults(); 193 predictor->DiscardAllResults();
178 } 194 }
179 195
180 #if !defined(DISABLE_NACL) 196 #if !defined(DISABLE_NACL)
181 void ClearNaClCacheOnIOThread(const base::Closure& callback) { 197 void ClearNaClCacheOnIOThread(const base::Closure& callback) {
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 947
932 // When clearing cache, wipe accumulated network related data 948 // When clearing cache, wipe accumulated network related data
933 // (TransportSecurityState and HttpServerPropertiesManager data). 949 // (TransportSecurityState and HttpServerPropertiesManager data).
934 waiting_for_clear_networking_history_ = true; 950 waiting_for_clear_networking_history_ = true;
935 profile_->ClearNetworkingHistorySince( 951 profile_->ClearNetworkingHistorySince(
936 delete_begin_, 952 delete_begin_,
937 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 953 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
938 weak_ptr_factory_.GetWeakPtr())); 954 weak_ptr_factory_.GetWeakPtr()));
939 } 955 }
940 956
957 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) {
958 scoped_refptr<net::URLRequestContextGetter> request_context =
959 profile_->GetRequestContext();
960 waiting_for_clear_http_auth_cache_ = true;
961 BrowserThread::PostTaskAndReply(
962 BrowserThread::IO, FROM_HERE,
963 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context),
964 delete_begin_),
965 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache,
966 weak_ptr_factory_.GetWeakPtr()));
967 }
968
941 // Content Decryption Modules used by Encrypted Media store licenses in a 969 // Content Decryption Modules used by Encrypted Media store licenses in a
942 // private filesystem. These are different than content licenses used by 970 // private filesystem. These are different than content licenses used by
943 // Flash (which are deleted father down in this method). 971 // Flash (which are deleted father down in this method).
944 if (remove_mask & REMOVE_MEDIA_LICENSES) { 972 if (remove_mask & REMOVE_MEDIA_LICENSES) {
945 storage_partition_remove_mask |= 973 storage_partition_remove_mask |=
946 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; 974 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA;
947 } 975 }
948 976
949 if (storage_partition_remove_mask) { 977 if (storage_partition_remove_mask) {
950 waiting_for_clear_storage_partition_data_ = true; 978 waiting_for_clear_storage_partition_data_ = true;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1183
1156 bool BrowsingDataRemover::AllDone() { 1184 bool BrowsingDataRemover::AllDone() {
1157 return !waiting_for_synchronous_clear_operations_ && 1185 return !waiting_for_synchronous_clear_operations_ &&
1158 !waiting_for_clear_autofill_origin_urls_ && 1186 !waiting_for_clear_autofill_origin_urls_ &&
1159 !waiting_for_clear_cache_ && 1187 !waiting_for_clear_cache_ &&
1160 !waiting_for_clear_flash_content_licenses_ && 1188 !waiting_for_clear_flash_content_licenses_ &&
1161 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && 1189 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ &&
1162 !waiting_for_clear_domain_reliability_monitor_ && 1190 !waiting_for_clear_domain_reliability_monitor_ &&
1163 !waiting_for_clear_form_ && !waiting_for_clear_history_ && 1191 !waiting_for_clear_form_ && !waiting_for_clear_history_ &&
1164 !waiting_for_clear_hostname_resolution_cache_ && 1192 !waiting_for_clear_hostname_resolution_cache_ &&
1193 !waiting_for_clear_http_auth_cache_ &&
1165 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && 1194 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ &&
1166 !waiting_for_clear_network_predictor_ && 1195 !waiting_for_clear_network_predictor_ &&
1167 !waiting_for_clear_networking_history_ && 1196 !waiting_for_clear_networking_history_ &&
1168 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && 1197 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ &&
1169 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && 1198 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ &&
1170 !waiting_for_clear_pnacl_cache_ && 1199 !waiting_for_clear_pnacl_cache_ &&
1171 #if BUILDFLAG(ANDROID_JAVA_UI) 1200 #if BUILDFLAG(ANDROID_JAVA_UI)
1172 !waiting_for_clear_precache_history_ && 1201 !waiting_for_clear_precache_history_ &&
1173 !waiting_for_clear_webapp_data_ && 1202 !waiting_for_clear_webapp_data_ &&
1174 !waiting_for_clear_webapp_history_ && 1203 !waiting_for_clear_webapp_history_ &&
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 waiting_for_clear_history_ = false; 1281 waiting_for_clear_history_ = false;
1253 NotifyIfDone(); 1282 NotifyIfDone();
1254 } 1283 }
1255 1284
1256 void BrowsingDataRemover::OnClearedHostnameResolutionCache() { 1285 void BrowsingDataRemover::OnClearedHostnameResolutionCache() {
1257 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1286 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1258 waiting_for_clear_hostname_resolution_cache_ = false; 1287 waiting_for_clear_hostname_resolution_cache_ = false;
1259 NotifyIfDone(); 1288 NotifyIfDone();
1260 } 1289 }
1261 1290
1291 void BrowsingDataRemover::OnClearedHttpAuthCache() {
1292 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1293 waiting_for_clear_http_auth_cache_ = false;
1294 NotifyIfDone();
1295 }
1296
1262 void BrowsingDataRemover::OnClearedNetworkPredictor() { 1297 void BrowsingDataRemover::OnClearedNetworkPredictor() {
1263 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1298 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1264 waiting_for_clear_network_predictor_ = false; 1299 waiting_for_clear_network_predictor_ = false;
1265 NotifyIfDone(); 1300 NotifyIfDone();
1266 } 1301 }
1267 1302
1268 void BrowsingDataRemover::OnClearedNetworkingHistory() { 1303 void BrowsingDataRemover::OnClearedNetworkingHistory() {
1269 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1304 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1270 waiting_for_clear_networking_history_ = false; 1305 waiting_for_clear_networking_history_ = false;
1271 NotifyIfDone(); 1306 NotifyIfDone();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 waiting_for_clear_offline_page_data_ = false; 1443 waiting_for_clear_offline_page_data_ = false;
1409 NotifyIfDone(); 1444 NotifyIfDone();
1410 } 1445 }
1411 #endif 1446 #endif
1412 1447
1413 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1448 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1414 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1449 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1415 waiting_for_clear_domain_reliability_monitor_ = false; 1450 waiting_for_clear_domain_reliability_monitor_ = false;
1416 NotifyIfDone(); 1451 NotifyIfDone();
1417 } 1452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698