OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include "net/base/net_errors.h" | 69 #include "net/base/net_errors.h" |
70 #include "net/cookies/cookie_store.h" | 70 #include "net/cookies/cookie_store.h" |
71 #include "net/http/transport_security_state.h" | 71 #include "net/http/transport_security_state.h" |
72 #include "net/ssl/channel_id_service.h" | 72 #include "net/ssl/channel_id_service.h" |
73 #include "net/ssl/channel_id_store.h" | 73 #include "net/ssl/channel_id_store.h" |
74 #include "net/url_request/url_request_context.h" | 74 #include "net/url_request/url_request_context.h" |
75 #include "net/url_request/url_request_context_getter.h" | 75 #include "net/url_request/url_request_context_getter.h" |
76 #include "storage/browser/quota/special_storage_policy.h" | 76 #include "storage/browser/quota/special_storage_policy.h" |
77 #include "url/origin.h" | 77 #include "url/origin.h" |
78 | 78 |
79 #if defined(OS_ANDROID) | 79 #if defined(ANDROID_JAVA_UI) |
80 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 80 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
81 #include "chrome/browser/android/webapps/webapp_registry.h" | 81 #include "chrome/browser/android/webapps/webapp_registry.h" |
82 #include "chrome/browser/precache/precache_manager_factory.h" | 82 #include "chrome/browser/precache/precache_manager_factory.h" |
83 #include "components/offline_pages/offline_page_feature.h" | 83 #include "components/offline_pages/offline_page_feature.h" |
84 #include "components/offline_pages/offline_page_model.h" | 84 #include "components/offline_pages/offline_page_model.h" |
85 #include "components/precache/content/precache_manager.h" | 85 #include "components/precache/content/precache_manager.h" |
86 #endif | 86 #endif |
87 | 87 |
88 #if defined(OS_CHROMEOS) | 88 #if defined(OS_CHROMEOS) |
89 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 89 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 delete_begin_), | 422 delete_begin_), |
423 base::Bind(&BrowsingDataRemover::OnClearedWebRtcLogs, | 423 base::Bind(&BrowsingDataRemover::OnClearedWebRtcLogs, |
424 base::Unretained(this))); | 424 base::Unretained(this))); |
425 #endif | 425 #endif |
426 | 426 |
427 // The SSL Host State that tracks SSL interstitial "proceed" decisions may | 427 // The SSL Host State that tracks SSL interstitial "proceed" decisions may |
428 // include origins that the user has visited, so it must be cleared. | 428 // include origins that the user has visited, so it must be cleared. |
429 if (profile_->GetSSLHostStateDelegate()) | 429 if (profile_->GetSSLHostStateDelegate()) |
430 profile_->GetSSLHostStateDelegate()->Clear(); | 430 profile_->GetSSLHostStateDelegate()->Clear(); |
431 | 431 |
432 #if defined(OS_ANDROID) | 432 #if defined(ANDROID_JAVA_UI) |
433 precache::PrecacheManager* precache_manager = | 433 precache::PrecacheManager* precache_manager = |
434 precache::PrecacheManagerFactory::GetForBrowserContext(profile_); | 434 precache::PrecacheManagerFactory::GetForBrowserContext(profile_); |
435 // |precache_manager| could be nullptr if the profile is off the record. | 435 // |precache_manager| could be nullptr if the profile is off the record. |
436 if (!precache_manager) { | 436 if (!precache_manager) { |
437 waiting_for_clear_precache_history_ = true; | 437 waiting_for_clear_precache_history_ = true; |
438 precache_manager->ClearHistory(); | 438 precache_manager->ClearHistory(); |
439 // The above calls are done on the UI thread but do their work on the DB | 439 // The above calls are done on the UI thread but do their work on the DB |
440 // thread. So wait for it. | 440 // thread. So wait for it. |
441 BrowserThread::PostTaskAndReply( | 441 BrowserThread::PostTaskAndReply( |
442 BrowserThread::DB, FROM_HERE, | 442 BrowserThread::DB, FROM_HERE, |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 mode = domain_reliability::CLEAR_BEACONS; | 794 mode = domain_reliability::CLEAR_BEACONS; |
795 | 795 |
796 waiting_for_clear_domain_reliability_monitor_ = true; | 796 waiting_for_clear_domain_reliability_monitor_ = true; |
797 service->ClearBrowsingData( | 797 service->ClearBrowsingData( |
798 mode, | 798 mode, |
799 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | 799 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
800 base::Unretained(this))); | 800 base::Unretained(this))); |
801 } | 801 } |
802 } | 802 } |
803 | 803 |
804 #if defined(OS_ANDROID) | 804 #if defined(ANDROID_JAVA_UI) |
805 if (remove_mask & REMOVE_WEBAPP_DATA) { | 805 if (remove_mask & REMOVE_WEBAPP_DATA) { |
806 waiting_for_clear_webapp_data_ = true; | 806 waiting_for_clear_webapp_data_ = true; |
807 WebappRegistry::UnregisterWebapps( | 807 WebappRegistry::UnregisterWebapps( |
808 base::Bind(&BrowsingDataRemover::OnClearedWebappData, | 808 base::Bind(&BrowsingDataRemover::OnClearedWebappData, |
809 base::Unretained(this))); | 809 base::Unretained(this))); |
810 } | 810 } |
811 | 811 |
812 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && | 812 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && |
813 offline_pages::IsOfflinePagesEnabled()) { | 813 offline_pages::IsOfflinePagesEnabled()) { |
814 waiting_for_clear_offline_page_data_ = true; | 814 waiting_for_clear_offline_page_data_ = true; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 !waiting_for_clear_hostname_resolution_cache_ && | 890 !waiting_for_clear_hostname_resolution_cache_ && |
891 !waiting_for_clear_keyword_data_ && | 891 !waiting_for_clear_keyword_data_ && |
892 !waiting_for_clear_nacl_cache_ && | 892 !waiting_for_clear_nacl_cache_ && |
893 !waiting_for_clear_network_predictor_ && | 893 !waiting_for_clear_network_predictor_ && |
894 !waiting_for_clear_networking_history_ && | 894 !waiting_for_clear_networking_history_ && |
895 !waiting_for_clear_passwords_ && | 895 !waiting_for_clear_passwords_ && |
896 !waiting_for_clear_passwords_stats_ && | 896 !waiting_for_clear_passwords_stats_ && |
897 !waiting_for_clear_platform_keys_ && | 897 !waiting_for_clear_platform_keys_ && |
898 !waiting_for_clear_plugin_data_ && | 898 !waiting_for_clear_plugin_data_ && |
899 !waiting_for_clear_pnacl_cache_ && | 899 !waiting_for_clear_pnacl_cache_ && |
900 #if defined(OS_ANDROID) | 900 #if defined(ANDROID_JAVA_UI) |
901 !waiting_for_clear_precache_history_ && | 901 !waiting_for_clear_precache_history_ && |
902 !waiting_for_clear_webapp_data_ && | 902 !waiting_for_clear_webapp_data_ && |
903 !waiting_for_clear_offline_page_data_ && | 903 !waiting_for_clear_offline_page_data_ && |
904 #endif | 904 #endif |
905 #if defined(ENABLE_WEBRTC) | 905 #if defined(ENABLE_WEBRTC) |
906 !waiting_for_clear_webrtc_logs_ && | 906 !waiting_for_clear_webrtc_logs_ && |
907 #endif | 907 #endif |
908 !waiting_for_clear_storage_partition_data_; | 908 !waiting_for_clear_storage_partition_data_; |
909 } | 909 } |
910 | 910 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 } | 1186 } |
1187 | 1187 |
1188 #if defined(ENABLE_WEBRTC) | 1188 #if defined(ENABLE_WEBRTC) |
1189 void BrowsingDataRemover::OnClearedWebRtcLogs() { | 1189 void BrowsingDataRemover::OnClearedWebRtcLogs() { |
1190 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1190 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1191 waiting_for_clear_webrtc_logs_ = false; | 1191 waiting_for_clear_webrtc_logs_ = false; |
1192 NotifyAndDeleteIfDone(); | 1192 NotifyAndDeleteIfDone(); |
1193 } | 1193 } |
1194 #endif | 1194 #endif |
1195 | 1195 |
1196 #if defined(OS_ANDROID) | 1196 #if defined(ANDROID_JAVA_UI) |
1197 void BrowsingDataRemover::OnClearedPrecacheHistory() { | 1197 void BrowsingDataRemover::OnClearedPrecacheHistory() { |
1198 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1198 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1199 waiting_for_clear_precache_history_ = false; | 1199 waiting_for_clear_precache_history_ = false; |
1200 NotifyAndDeleteIfDone(); | 1200 NotifyAndDeleteIfDone(); |
1201 } | 1201 } |
1202 | 1202 |
1203 void BrowsingDataRemover::OnClearedWebappData() { | 1203 void BrowsingDataRemover::OnClearedWebappData() { |
1204 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1204 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1205 waiting_for_clear_webapp_data_ = false; | 1205 waiting_for_clear_webapp_data_ = false; |
1206 NotifyAndDeleteIfDone(); | 1206 NotifyAndDeleteIfDone(); |
(...skipping 11 matching lines...) Expand all Loading... |
1218 waiting_for_clear_domain_reliability_monitor_ = false; | 1218 waiting_for_clear_domain_reliability_monitor_ = false; |
1219 NotifyAndDeleteIfDone(); | 1219 NotifyAndDeleteIfDone(); |
1220 } | 1220 } |
1221 | 1221 |
1222 // static | 1222 // static |
1223 BrowsingDataRemover::CallbackSubscription | 1223 BrowsingDataRemover::CallbackSubscription |
1224 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1224 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
1225 const BrowsingDataRemover::Callback& callback) { | 1225 const BrowsingDataRemover::Callback& callback) { |
1226 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1226 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
1227 } | 1227 } |
OLD | NEW |