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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

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