| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 if (!precache_manager) { | 553 if (!precache_manager) { |
| 554 waiting_for_clear_precache_history_ = true; | 554 waiting_for_clear_precache_history_ = true; |
| 555 precache_manager->ClearHistory(); | 555 precache_manager->ClearHistory(); |
| 556 // The above calls are done on the UI thread but do their work on the DB | 556 // The above calls are done on the UI thread but do their work on the DB |
| 557 // thread. So wait for it. | 557 // thread. So wait for it. |
| 558 BrowserThread::PostTaskAndReply( | 558 BrowserThread::PostTaskAndReply( |
| 559 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | 559 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), |
| 560 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, | 560 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, |
| 561 weak_ptr_factory_.GetWeakPtr())); | 561 weak_ptr_factory_.GetWeakPtr())); |
| 562 } | 562 } |
| 563 |
| 564 // Clear the history information (last launch time and origin URL) of any |
| 565 // registered webapps. The webapp_registry makes a JNI call into a Java-side |
| 566 // AsyncTask, so don't wait for the reply. |
| 567 waiting_for_clear_webapp_history_ = true; |
| 568 webapp_registry_->ClearWebappHistory( |
| 569 base::Bind(&BrowsingDataRemover::OnClearedWebappHistory, |
| 570 weak_ptr_factory_.GetWeakPtr())); |
| 563 #endif | 571 #endif |
| 564 | 572 |
| 565 data_reduction_proxy::DataReductionProxySettings* | 573 data_reduction_proxy::DataReductionProxySettings* |
| 566 data_reduction_proxy_settings = | 574 data_reduction_proxy_settings = |
| 567 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 575 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 568 profile_); | 576 profile_); |
| 569 // |data_reduction_proxy_settings| is null if |profile_| is off the record. | 577 // |data_reduction_proxy_settings| is null if |profile_| is off the record. |
| 570 if (data_reduction_proxy_settings) { | 578 if (data_reduction_proxy_settings) { |
| 571 data_reduction_proxy::DataReductionProxyService* | 579 data_reduction_proxy::DataReductionProxyService* |
| 572 data_reduction_proxy_service = | 580 data_reduction_proxy_service = |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 waiting_for_clear_domain_reliability_monitor_ = true; | 930 waiting_for_clear_domain_reliability_monitor_ = true; |
| 923 service->ClearBrowsingData( | 931 service->ClearBrowsingData( |
| 924 mode, | 932 mode, |
| 925 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | 933 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
| 926 weak_ptr_factory_.GetWeakPtr())); | 934 weak_ptr_factory_.GetWeakPtr())); |
| 927 } | 935 } |
| 928 } | 936 } |
| 929 | 937 |
| 930 #if BUILDFLAG(ANDROID_JAVA_UI) | 938 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 931 if (remove_mask & REMOVE_WEBAPP_DATA) { | 939 if (remove_mask & REMOVE_WEBAPP_DATA) { |
| 940 // Clear all data associated with registered webapps. The webapp_registry |
| 941 // makes a JNI call into a Java-side AsyncTask, so don't wait for the reply. |
| 932 waiting_for_clear_webapp_data_ = true; | 942 waiting_for_clear_webapp_data_ = true; |
| 933 webapp_registry_->UnregisterWebapps( | 943 webapp_registry_->UnregisterWebapps( |
| 934 base::Bind(&BrowsingDataRemover::OnClearedWebappData, | 944 base::Bind(&BrowsingDataRemover::OnClearedWebappData, |
| 935 weak_ptr_factory_.GetWeakPtr())); | 945 weak_ptr_factory_.GetWeakPtr())); |
| 936 } | 946 } |
| 937 | 947 |
| 938 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && | 948 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && |
| 939 offline_pages::IsOfflinePagesEnabled()) { | 949 offline_pages::IsOfflinePagesEnabled()) { |
| 940 waiting_for_clear_offline_page_data_ = true; | 950 waiting_for_clear_offline_page_data_ = true; |
| 941 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) | 951 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 !waiting_for_clear_hostname_resolution_cache_ && | 1022 !waiting_for_clear_hostname_resolution_cache_ && |
| 1013 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && | 1023 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && |
| 1014 !waiting_for_clear_network_predictor_ && | 1024 !waiting_for_clear_network_predictor_ && |
| 1015 !waiting_for_clear_networking_history_ && | 1025 !waiting_for_clear_networking_history_ && |
| 1016 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && | 1026 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && |
| 1017 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && | 1027 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && |
| 1018 !waiting_for_clear_pnacl_cache_ && | 1028 !waiting_for_clear_pnacl_cache_ && |
| 1019 #if BUILDFLAG(ANDROID_JAVA_UI) | 1029 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1020 !waiting_for_clear_precache_history_ && | 1030 !waiting_for_clear_precache_history_ && |
| 1021 !waiting_for_clear_webapp_data_ && | 1031 !waiting_for_clear_webapp_data_ && |
| 1032 !waiting_for_clear_webapp_history_ && |
| 1022 !waiting_for_clear_offline_page_data_ && | 1033 !waiting_for_clear_offline_page_data_ && |
| 1023 #endif | 1034 #endif |
| 1024 #if defined(ENABLE_WEBRTC) | 1035 #if defined(ENABLE_WEBRTC) |
| 1025 !waiting_for_clear_webrtc_logs_ && | 1036 !waiting_for_clear_webrtc_logs_ && |
| 1026 #endif | 1037 #endif |
| 1027 !waiting_for_clear_storage_partition_data_ && | 1038 !waiting_for_clear_storage_partition_data_ && |
| 1028 !waiting_for_clear_auto_sign_in_; | 1039 !waiting_for_clear_auto_sign_in_; |
| 1029 } | 1040 } |
| 1030 | 1041 |
| 1031 void BrowsingDataRemover::OnKeywordsLoaded() { | 1042 void BrowsingDataRemover::OnKeywordsLoaded() { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 waiting_for_clear_precache_history_ = false; | 1222 waiting_for_clear_precache_history_ = false; |
| 1212 NotifyIfDone(); | 1223 NotifyIfDone(); |
| 1213 } | 1224 } |
| 1214 | 1225 |
| 1215 void BrowsingDataRemover::OnClearedWebappData() { | 1226 void BrowsingDataRemover::OnClearedWebappData() { |
| 1216 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1227 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1217 waiting_for_clear_webapp_data_ = false; | 1228 waiting_for_clear_webapp_data_ = false; |
| 1218 NotifyIfDone(); | 1229 NotifyIfDone(); |
| 1219 } | 1230 } |
| 1220 | 1231 |
| 1232 void BrowsingDataRemover::OnClearedWebappHistory() { |
| 1233 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1234 waiting_for_clear_webapp_history_ = false; |
| 1235 NotifyIfDone(); |
| 1236 } |
| 1237 |
| 1221 void BrowsingDataRemover::OnClearedOfflinePageData() { | 1238 void BrowsingDataRemover::OnClearedOfflinePageData() { |
| 1222 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1239 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1223 waiting_for_clear_offline_page_data_ = false; | 1240 waiting_for_clear_offline_page_data_ = false; |
| 1224 NotifyIfDone(); | 1241 NotifyIfDone(); |
| 1225 } | 1242 } |
| 1226 #endif | 1243 #endif |
| 1227 | 1244 |
| 1228 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1245 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1229 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1246 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1230 waiting_for_clear_domain_reliability_monitor_ = false; | 1247 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1231 NotifyIfDone(); | 1248 NotifyIfDone(); |
| 1232 } | 1249 } |
| 1233 | 1250 |
| 1234 // static | 1251 // static |
| 1235 BrowsingDataRemover::CallbackSubscription | 1252 BrowsingDataRemover::CallbackSubscription |
| 1236 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1253 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 1237 const BrowsingDataRemover::Callback& callback) { | 1254 const BrowsingDataRemover::Callback& callback) { |
| 1238 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1255 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 1239 } | 1256 } |
| OLD | NEW |