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

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: Clear auth data directly from BrowsingDataRemover Created 4 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
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | net/http/http_auth_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const ContentSettingsPattern& secondary_pattern) { 178 const ContentSettingsPattern& secondary_pattern) {
177 return predicate.Run(primary_pattern); 179 return predicate.Run(primary_pattern);
178 } 180 }
179 181
180 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) { 182 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) {
181 DCHECK_CURRENTLY_ON(BrowserThread::IO); 183 DCHECK_CURRENTLY_ON(BrowserThread::IO);
182 184
183 io_thread->ClearHostCache(); 185 io_thread->ClearHostCache();
184 } 186 }
185 187
188 void ClearHttpAuthCacheOnIOThread(
189 scoped_refptr<net::URLRequestContextGetter> context_getter,
190 base::Time delete_begin,
191 base::Time delete_end) {
192 DCHECK_CURRENTLY_ON(BrowserThread::IO);
193
194 net::HttpNetworkSession* http_session = context_getter->GetURLRequestContext()
195 ->http_transaction_factory()
196 ->GetSession();
197 DCHECK(http_session);
198 http_session->http_auth_cache()->Clear(delete_begin, delete_end);
199 }
200
186 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { 201 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) {
187 DCHECK_CURRENTLY_ON(BrowserThread::IO); 202 DCHECK_CURRENTLY_ON(BrowserThread::IO);
188 DCHECK(predictor); 203 DCHECK(predictor);
189 204
190 predictor->DiscardInitialNavigationHistory(); 205 predictor->DiscardInitialNavigationHistory();
191 predictor->DiscardAllResults(); 206 predictor->DiscardAllResults();
192 } 207 }
193 208
194 #if !defined(DISABLE_NACL) 209 #if !defined(DISABLE_NACL)
195 void ClearNaClCacheOnIOThread(const base::Closure& callback) { 210 void ClearNaClCacheOnIOThread(const base::Closure& callback) {
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 908
894 // When clearing cache, wipe accumulated network related data 909 // When clearing cache, wipe accumulated network related data
895 // (TransportSecurityState and HttpServerPropertiesManager data). 910 // (TransportSecurityState and HttpServerPropertiesManager data).
896 waiting_for_clear_networking_history_ = true; 911 waiting_for_clear_networking_history_ = true;
897 profile_->ClearNetworkingHistorySince( 912 profile_->ClearNetworkingHistorySince(
898 delete_begin_, 913 delete_begin_,
899 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 914 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
900 weak_ptr_factory_.GetWeakPtr())); 915 weak_ptr_factory_.GetWeakPtr()));
901 } 916 }
902 917
918 if (remove_mask & REMOVE_CACHE || remove_mask & REMOVE_COOKIES ||
919 remove_mask & REMOVE_PASSWORDS && g_browser_process->io_thread()) {
msramek 2016/07/01 13:19:40 The g_browser_process->io_thread() is not necessar
Tomasz Moniuszko 2016/07/01 14:54:40 Done.
920 scoped_refptr<net::URLRequestContextGetter> request_context =
msramek 2016/07/01 13:19:40 This is not really related to storage partition, s
Tomasz Moniuszko 2016/07/01 14:54:40 Done.
921 content::BrowserContext::GetDefaultStoragePartition(profile_)
922 ->GetURLRequestContext();
923 waiting_for_clear_http_auth_cache_ = true;
924 BrowserThread::PostTaskAndReply(
925 BrowserThread::IO, FROM_HERE,
926 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context),
927 delete_begin_, delete_end_),
928 base::Bind(&BrowsingDataRemover::OnClearedHttpAuthCache,
929 weak_ptr_factory_.GetWeakPtr()));
930 }
931
903 if (remove_mask & REMOVE_WEBRTC_IDENTITY) { 932 if (remove_mask & REMOVE_WEBRTC_IDENTITY) {
904 storage_partition_remove_mask |= 933 storage_partition_remove_mask |=
905 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; 934 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY;
906 } 935 }
907 936
908 if (storage_partition_remove_mask) { 937 if (storage_partition_remove_mask) {
909 waiting_for_clear_storage_partition_data_ = true; 938 waiting_for_clear_storage_partition_data_ = true;
910 939
911 content::StoragePartition* storage_partition; 940 content::StoragePartition* storage_partition;
912 if (storage_partition_for_testing_) 941 if (storage_partition_for_testing_)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 return delete_begin_time - diff; 1130 return delete_begin_time - diff;
1102 } 1131 }
1103 1132
1104 bool BrowsingDataRemover::AllDone() { 1133 bool BrowsingDataRemover::AllDone() {
1105 return !waiting_for_clear_autofill_origin_urls_ && 1134 return !waiting_for_clear_autofill_origin_urls_ &&
1106 !waiting_for_clear_cache_ && !waiting_for_clear_content_licenses_ && 1135 !waiting_for_clear_cache_ && !waiting_for_clear_content_licenses_ &&
1107 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && 1136 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ &&
1108 !waiting_for_clear_domain_reliability_monitor_ && 1137 !waiting_for_clear_domain_reliability_monitor_ &&
1109 !waiting_for_clear_form_ && !waiting_for_clear_history_ && 1138 !waiting_for_clear_form_ && !waiting_for_clear_history_ &&
1110 !waiting_for_clear_hostname_resolution_cache_ && 1139 !waiting_for_clear_hostname_resolution_cache_ &&
1140 !waiting_for_clear_http_auth_cache_ &&
1111 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && 1141 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ &&
1112 !waiting_for_clear_network_predictor_ && 1142 !waiting_for_clear_network_predictor_ &&
1113 !waiting_for_clear_networking_history_ && 1143 !waiting_for_clear_networking_history_ &&
1114 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && 1144 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ &&
1115 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && 1145 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ &&
1116 !waiting_for_clear_pnacl_cache_ && 1146 !waiting_for_clear_pnacl_cache_ &&
1117 #if BUILDFLAG(ANDROID_JAVA_UI) 1147 #if BUILDFLAG(ANDROID_JAVA_UI)
1118 !waiting_for_clear_precache_history_ && 1148 !waiting_for_clear_precache_history_ &&
1119 !waiting_for_clear_webapp_data_ && 1149 !waiting_for_clear_webapp_data_ &&
1120 !waiting_for_clear_webapp_history_ && 1150 !waiting_for_clear_webapp_history_ &&
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 waiting_for_clear_history_ = false; 1203 waiting_for_clear_history_ = false;
1174 NotifyIfDone(); 1204 NotifyIfDone();
1175 } 1205 }
1176 1206
1177 void BrowsingDataRemover::OnClearedHostnameResolutionCache() { 1207 void BrowsingDataRemover::OnClearedHostnameResolutionCache() {
1178 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1208 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1179 waiting_for_clear_hostname_resolution_cache_ = false; 1209 waiting_for_clear_hostname_resolution_cache_ = false;
1180 NotifyIfDone(); 1210 NotifyIfDone();
1181 } 1211 }
1182 1212
1213 void BrowsingDataRemover::OnClearedHttpAuthCache() {
1214 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1215 waiting_for_clear_http_auth_cache_ = false;
1216 NotifyIfDone();
1217 }
1218
1183 void BrowsingDataRemover::OnClearedNetworkPredictor() { 1219 void BrowsingDataRemover::OnClearedNetworkPredictor() {
1184 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1220 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1185 waiting_for_clear_network_predictor_ = false; 1221 waiting_for_clear_network_predictor_ = false;
1186 NotifyIfDone(); 1222 NotifyIfDone();
1187 } 1223 }
1188 1224
1189 void BrowsingDataRemover::OnClearedNetworkingHistory() { 1225 void BrowsingDataRemover::OnClearedNetworkingHistory() {
1190 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1226 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1191 waiting_for_clear_networking_history_ = false; 1227 waiting_for_clear_networking_history_ = false;
1192 NotifyIfDone(); 1228 NotifyIfDone();
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 waiting_for_clear_domain_reliability_monitor_ = false; 1372 waiting_for_clear_domain_reliability_monitor_ = false;
1337 NotifyIfDone(); 1373 NotifyIfDone();
1338 } 1374 }
1339 1375
1340 // static 1376 // static
1341 BrowsingDataRemover::CallbackSubscription 1377 BrowsingDataRemover::CallbackSubscription
1342 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( 1378 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
1343 const BrowsingDataRemover::Callback& callback) { 1379 const BrowsingDataRemover::Callback& callback) {
1344 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); 1380 return GetOnBrowsingDataRemovedCallbacks()->Add(callback);
1345 } 1381 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | net/http/http_auth_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698