| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(OS_ANDROID) |
| 80 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 80 #include "chrome/browser/android/webapps/webapp_registry.h" | 81 #include "chrome/browser/android/webapps/webapp_registry.h" |
| 81 #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" |
| 84 #include "components/offline_pages/offline_page_model.h" |
| 82 #include "components/precache/content/precache_manager.h" | 85 #include "components/precache/content/precache_manager.h" |
| 83 #endif | 86 #endif |
| 84 | 87 |
| 85 #if defined(OS_CHROMEOS) | 88 #if defined(OS_CHROMEOS) |
| 86 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 89 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 87 #include "chromeos/attestation/attestation_constants.h" | 90 #include "chromeos/attestation/attestation_constants.h" |
| 88 #include "chromeos/dbus/cryptohome_client.h" | 91 #include "chromeos/dbus/cryptohome_client.h" |
| 89 #include "chromeos/dbus/dbus_thread_manager.h" | 92 #include "chromeos/dbus/dbus_thread_manager.h" |
| 90 #include "components/user_manager/user.h" | 93 #include "components/user_manager/user.h" |
| 91 #endif | 94 #endif |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 784 } |
| 782 } | 785 } |
| 783 | 786 |
| 784 #if defined(OS_ANDROID) | 787 #if defined(OS_ANDROID) |
| 785 if (remove_mask & REMOVE_WEBAPP_DATA) { | 788 if (remove_mask & REMOVE_WEBAPP_DATA) { |
| 786 waiting_for_clear_webapp_data_ = true; | 789 waiting_for_clear_webapp_data_ = true; |
| 787 WebappRegistry::UnregisterWebapps( | 790 WebappRegistry::UnregisterWebapps( |
| 788 base::Bind(&BrowsingDataRemover::OnClearedWebappData, | 791 base::Bind(&BrowsingDataRemover::OnClearedWebappData, |
| 789 base::Unretained(this))); | 792 base::Unretained(this))); |
| 790 } | 793 } |
| 794 |
| 795 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && |
| 796 offline_pages::IsOfflinePagesEnabled()) { |
| 797 waiting_for_clear_offline_page_data_ = true; |
| 798 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_)-> |
| 799 ClearAll(base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, |
| 800 base::Unretained(this))); |
| 801 } |
| 791 #endif | 802 #endif |
| 792 | 803 |
| 793 // Record the combined deletion of cookies and cache. | 804 // Record the combined deletion of cookies and cache. |
| 794 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; | 805 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; |
| 795 if (remove_mask & REMOVE_COOKIES && | 806 if (remove_mask & REMOVE_COOKIES && |
| 796 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 807 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 797 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE | 808 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE |
| 798 : ONLY_COOKIES; | 809 : ONLY_COOKIES; |
| 799 } else if (remove_mask & REMOVE_CACHE) { | 810 } else if (remove_mask & REMOVE_CACHE) { |
| 800 choice = ONLY_CACHE; | 811 choice = ONLY_CACHE; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 !waiting_for_clear_nacl_cache_ && | 875 !waiting_for_clear_nacl_cache_ && |
| 865 !waiting_for_clear_network_predictor_ && | 876 !waiting_for_clear_network_predictor_ && |
| 866 !waiting_for_clear_networking_history_ && | 877 !waiting_for_clear_networking_history_ && |
| 867 !waiting_for_clear_passwords_ && | 878 !waiting_for_clear_passwords_ && |
| 868 !waiting_for_clear_platform_keys_ && | 879 !waiting_for_clear_platform_keys_ && |
| 869 !waiting_for_clear_plugin_data_ && | 880 !waiting_for_clear_plugin_data_ && |
| 870 !waiting_for_clear_pnacl_cache_ && | 881 !waiting_for_clear_pnacl_cache_ && |
| 871 #if defined(OS_ANDROID) | 882 #if defined(OS_ANDROID) |
| 872 !waiting_for_clear_precache_history_ && | 883 !waiting_for_clear_precache_history_ && |
| 873 !waiting_for_clear_webapp_data_ && | 884 !waiting_for_clear_webapp_data_ && |
| 885 !waiting_for_clear_offline_page_data_ && |
| 874 #endif | 886 #endif |
| 875 #if defined(ENABLE_WEBRTC) | 887 #if defined(ENABLE_WEBRTC) |
| 876 !waiting_for_clear_webrtc_logs_ && | 888 !waiting_for_clear_webrtc_logs_ && |
| 877 #endif | 889 #endif |
| 878 !waiting_for_clear_storage_partition_data_; | 890 !waiting_for_clear_storage_partition_data_; |
| 879 } | 891 } |
| 880 | 892 |
| 881 void BrowsingDataRemover::OnKeywordsLoaded() { | 893 void BrowsingDataRemover::OnKeywordsLoaded() { |
| 882 // Deletes the entries from the model, and if we're not waiting on anything | 894 // Deletes the entries from the model, and if we're not waiting on anything |
| 883 // else notifies observers and deletes this BrowsingDataRemover. | 895 // else notifies observers and deletes this BrowsingDataRemover. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1174 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1163 waiting_for_clear_precache_history_ = false; | 1175 waiting_for_clear_precache_history_ = false; |
| 1164 NotifyAndDeleteIfDone(); | 1176 NotifyAndDeleteIfDone(); |
| 1165 } | 1177 } |
| 1166 | 1178 |
| 1167 void BrowsingDataRemover::OnClearedWebappData() { | 1179 void BrowsingDataRemover::OnClearedWebappData() { |
| 1168 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1180 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1169 waiting_for_clear_webapp_data_ = false; | 1181 waiting_for_clear_webapp_data_ = false; |
| 1170 NotifyAndDeleteIfDone(); | 1182 NotifyAndDeleteIfDone(); |
| 1171 } | 1183 } |
| 1184 |
| 1185 void BrowsingDataRemover::OnClearedOfflinePageData() { |
| 1186 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1187 waiting_for_clear_offline_page_data_ = false; |
| 1188 NotifyAndDeleteIfDone(); |
| 1189 } |
| 1172 #endif | 1190 #endif |
| 1173 | 1191 |
| 1174 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1192 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1175 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1193 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1176 waiting_for_clear_domain_reliability_monitor_ = false; | 1194 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1177 NotifyAndDeleteIfDone(); | 1195 NotifyAndDeleteIfDone(); |
| 1178 } | 1196 } |
| 1179 | 1197 |
| 1180 // static | 1198 // static |
| 1181 BrowsingDataRemover::CallbackSubscription | 1199 BrowsingDataRemover::CallbackSubscription |
| 1182 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1200 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 1183 const BrowsingDataRemover::Callback& callback) { | 1201 const BrowsingDataRemover::Callback& callback) { |
| 1184 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1202 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 1185 } | 1203 } |
| OLD | NEW |