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

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: Replace FRIEND_TEST_ALL_PREFIXES with set_creation_time_for_testing 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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 delete_begin_, 998 delete_begin_,
983 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 999 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
984 weak_ptr_factory_.GetWeakPtr())); 1000 weak_ptr_factory_.GetWeakPtr()));
985 1001
986 ntp_snippets::ContentSuggestionsService* content_suggestions_service = 1002 ntp_snippets::ContentSuggestionsService* content_suggestions_service =
987 ContentSuggestionsServiceFactory::GetForProfile(profile_); 1003 ContentSuggestionsServiceFactory::GetForProfile(profile_);
988 if (content_suggestions_service) 1004 if (content_suggestions_service)
989 content_suggestions_service->ClearAllCachedSuggestions(); 1005 content_suggestions_service->ClearAllCachedSuggestions();
990 } 1006 }
991 1007
1008 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) {
1009 scoped_refptr<net::URLRequestContextGetter> request_context =
1010 profile_->GetRequestContext();
1011 waiting_for_clear_http_auth_cache_ = true;
1012 BrowserThread::PostTaskAndReply(
1013 BrowserThread::IO, FROM_HERE,
1014 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context),
1015 delete_begin_),
1016 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache,
1017 weak_ptr_factory_.GetWeakPtr()));
1018 }
1019
992 // Content Decryption Modules used by Encrypted Media store licenses in a 1020 // Content Decryption Modules used by Encrypted Media store licenses in a
993 // private filesystem. These are different than content licenses used by 1021 // private filesystem. These are different than content licenses used by
994 // Flash (which are deleted father down in this method). 1022 // Flash (which are deleted father down in this method).
995 if (remove_mask & REMOVE_MEDIA_LICENSES) { 1023 if (remove_mask & REMOVE_MEDIA_LICENSES) {
996 storage_partition_remove_mask |= 1024 storage_partition_remove_mask |=
997 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; 1025 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA;
998 } 1026 }
999 1027
1000 if (storage_partition_remove_mask) { 1028 if (storage_partition_remove_mask) {
1001 waiting_for_clear_storage_partition_data_ = true; 1029 waiting_for_clear_storage_partition_data_ = true;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 1242
1215 bool BrowsingDataRemover::AllDone() { 1243 bool BrowsingDataRemover::AllDone() {
1216 return !waiting_for_synchronous_clear_operations_ && 1244 return !waiting_for_synchronous_clear_operations_ &&
1217 !waiting_for_clear_autofill_origin_urls_ && 1245 !waiting_for_clear_autofill_origin_urls_ &&
1218 !waiting_for_clear_cache_ && 1246 !waiting_for_clear_cache_ &&
1219 !waiting_for_clear_flash_content_licenses_ && 1247 !waiting_for_clear_flash_content_licenses_ &&
1220 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && 1248 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ &&
1221 !waiting_for_clear_domain_reliability_monitor_ && 1249 !waiting_for_clear_domain_reliability_monitor_ &&
1222 !waiting_for_clear_form_ && !waiting_for_clear_history_ && 1250 !waiting_for_clear_form_ && !waiting_for_clear_history_ &&
1223 !waiting_for_clear_hostname_resolution_cache_ && 1251 !waiting_for_clear_hostname_resolution_cache_ &&
1252 !waiting_for_clear_http_auth_cache_ &&
1224 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && 1253 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ &&
1225 !waiting_for_clear_network_predictor_ && 1254 !waiting_for_clear_network_predictor_ &&
1226 !waiting_for_clear_networking_history_ && 1255 !waiting_for_clear_networking_history_ &&
1227 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && 1256 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ &&
1228 !waiting_for_clear_platform_keys_ && 1257 !waiting_for_clear_platform_keys_ &&
1229 !waiting_for_clear_plugin_data_count_ && 1258 !waiting_for_clear_plugin_data_count_ &&
1230 !waiting_for_clear_pnacl_cache_ && 1259 !waiting_for_clear_pnacl_cache_ &&
1231 #if BUILDFLAG(ANDROID_JAVA_UI) 1260 #if BUILDFLAG(ANDROID_JAVA_UI)
1232 !waiting_for_clear_precache_history_ && 1261 !waiting_for_clear_precache_history_ &&
1233 !waiting_for_clear_webapp_data_ && 1262 !waiting_for_clear_webapp_data_ &&
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 waiting_for_clear_history_ = false; 1343 waiting_for_clear_history_ = false;
1315 NotifyIfDone(); 1344 NotifyIfDone();
1316 } 1345 }
1317 1346
1318 void BrowsingDataRemover::OnClearedHostnameResolutionCache() { 1347 void BrowsingDataRemover::OnClearedHostnameResolutionCache() {
1319 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1348 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1320 waiting_for_clear_hostname_resolution_cache_ = false; 1349 waiting_for_clear_hostname_resolution_cache_ = false;
1321 NotifyIfDone(); 1350 NotifyIfDone();
1322 } 1351 }
1323 1352
1353 void BrowsingDataRemover::OnClearedHttpAuthCache() {
1354 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1355 waiting_for_clear_http_auth_cache_ = false;
1356 NotifyIfDone();
1357 }
1358
1324 void BrowsingDataRemover::OnClearedNetworkPredictor() { 1359 void BrowsingDataRemover::OnClearedNetworkPredictor() {
1325 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1360 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1326 waiting_for_clear_network_predictor_ = false; 1361 waiting_for_clear_network_predictor_ = false;
1327 NotifyIfDone(); 1362 NotifyIfDone();
1328 } 1363 }
1329 1364
1330 void BrowsingDataRemover::OnClearedNetworkingHistory() { 1365 void BrowsingDataRemover::OnClearedNetworkingHistory() {
1331 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1366 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1332 waiting_for_clear_networking_history_ = false; 1367 waiting_for_clear_networking_history_ = false;
1333 NotifyIfDone(); 1368 NotifyIfDone();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 waiting_for_clear_offline_page_data_ = false; 1537 waiting_for_clear_offline_page_data_ = false;
1503 NotifyIfDone(); 1538 NotifyIfDone();
1504 } 1539 }
1505 #endif 1540 #endif
1506 1541
1507 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1542 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1508 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1543 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1509 waiting_for_clear_domain_reliability_monitor_ = false; 1544 waiting_for_clear_domain_reliability_monitor_ = false;
1510 NotifyIfDone(); 1545 NotifyIfDone();
1511 } 1546 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698