| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "net/cookies/cookie_store.h" | 64 #include "net/cookies/cookie_store.h" |
| 65 #include "net/http/transport_security_state.h" | 65 #include "net/http/transport_security_state.h" |
| 66 #include "net/ssl/channel_id_service.h" | 66 #include "net/ssl/channel_id_service.h" |
| 67 #include "net/ssl/channel_id_store.h" | 67 #include "net/ssl/channel_id_store.h" |
| 68 #include "net/url_request/url_request_context.h" | 68 #include "net/url_request/url_request_context.h" |
| 69 #include "net/url_request/url_request_context_getter.h" | 69 #include "net/url_request/url_request_context_getter.h" |
| 70 #include "storage/browser/quota/special_storage_policy.h" | 70 #include "storage/browser/quota/special_storage_policy.h" |
| 71 #include "url/origin.h" | 71 #include "url/origin.h" |
| 72 | 72 |
| 73 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
| 74 #include "chrome/browser/android/webapps/webapp_registry.h" |
| 74 #include "chrome/browser/precache/precache_manager_factory.h" | 75 #include "chrome/browser/precache/precache_manager_factory.h" |
| 75 #include "components/precache/content/precache_manager.h" | 76 #include "components/precache/content/precache_manager.h" |
| 76 #endif | 77 #endif |
| 77 | 78 |
| 78 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
| 79 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 80 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 80 #include "chromeos/attestation/attestation_constants.h" | 81 #include "chromeos/attestation/attestation_constants.h" |
| 81 #include "chromeos/dbus/cryptohome_client.h" | 82 #include "chromeos/dbus/cryptohome_client.h" |
| 82 #include "chromeos/dbus/dbus_thread_manager.h" | 83 #include "chromeos/dbus/dbus_thread_manager.h" |
| 83 #include "components/user_manager/user.h" | 84 #include "components/user_manager/user.h" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 mode = domain_reliability::CLEAR_BEACONS; | 754 mode = domain_reliability::CLEAR_BEACONS; |
| 754 | 755 |
| 755 waiting_for_clear_domain_reliability_monitor_ = true; | 756 waiting_for_clear_domain_reliability_monitor_ = true; |
| 756 service->ClearBrowsingData( | 757 service->ClearBrowsingData( |
| 757 mode, | 758 mode, |
| 758 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | 759 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
| 759 base::Unretained(this))); | 760 base::Unretained(this))); |
| 760 } | 761 } |
| 761 } | 762 } |
| 762 | 763 |
| 764 #if defined(OS_ANDROID) |
| 765 if (remove_mask & REMOVE_WEBAPP_DATA) { |
| 766 waiting_for_clear_webapp_data_ = true; |
| 767 WebappRegistry::UnregisterWebapps( |
| 768 base::Bind(&BrowsingDataRemover::OnClearedWebappData, |
| 769 base::Unretained(this))); |
| 770 } |
| 771 #endif |
| 772 |
| 763 // Record the combined deletion of cookies and cache. | 773 // Record the combined deletion of cookies and cache. |
| 764 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; | 774 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; |
| 765 if (remove_mask & REMOVE_COOKIES && | 775 if (remove_mask & REMOVE_COOKIES && |
| 766 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 776 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 767 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE | 777 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE |
| 768 : ONLY_COOKIES; | 778 : ONLY_COOKIES; |
| 769 } else if (remove_mask & REMOVE_CACHE) { | 779 } else if (remove_mask & REMOVE_CACHE) { |
| 770 choice = ONLY_CACHE; | 780 choice = ONLY_CACHE; |
| 771 } | 781 } |
| 772 | 782 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 !waiting_for_clear_keyword_data_ && | 843 !waiting_for_clear_keyword_data_ && |
| 834 !waiting_for_clear_nacl_cache_ && | 844 !waiting_for_clear_nacl_cache_ && |
| 835 !waiting_for_clear_network_predictor_ && | 845 !waiting_for_clear_network_predictor_ && |
| 836 !waiting_for_clear_networking_history_ && | 846 !waiting_for_clear_networking_history_ && |
| 837 !waiting_for_clear_passwords_ && | 847 !waiting_for_clear_passwords_ && |
| 838 !waiting_for_clear_platform_keys_ && | 848 !waiting_for_clear_platform_keys_ && |
| 839 !waiting_for_clear_plugin_data_ && | 849 !waiting_for_clear_plugin_data_ && |
| 840 !waiting_for_clear_pnacl_cache_ && | 850 !waiting_for_clear_pnacl_cache_ && |
| 841 #if defined(OS_ANDROID) | 851 #if defined(OS_ANDROID) |
| 842 !waiting_for_clear_precache_history_ && | 852 !waiting_for_clear_precache_history_ && |
| 853 !waiting_for_clear_webapp_data_ && |
| 843 #endif | 854 #endif |
| 844 #if defined(ENABLE_WEBRTC) | 855 #if defined(ENABLE_WEBRTC) |
| 845 !waiting_for_clear_webrtc_logs_ && | 856 !waiting_for_clear_webrtc_logs_ && |
| 846 #endif | 857 #endif |
| 847 !waiting_for_clear_storage_partition_data_; | 858 !waiting_for_clear_storage_partition_data_; |
| 848 } | 859 } |
| 849 | 860 |
| 850 void BrowsingDataRemover::OnKeywordsLoaded() { | 861 void BrowsingDataRemover::OnKeywordsLoaded() { |
| 851 // Deletes the entries from the model, and if we're not waiting on anything | 862 // Deletes the entries from the model, and if we're not waiting on anything |
| 852 // else notifies observers and deletes this BrowsingDataRemover. | 863 // else notifies observers and deletes this BrowsingDataRemover. |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 NotifyAndDeleteIfDone(); | 1136 NotifyAndDeleteIfDone(); |
| 1126 } | 1137 } |
| 1127 #endif | 1138 #endif |
| 1128 | 1139 |
| 1129 #if defined(OS_ANDROID) | 1140 #if defined(OS_ANDROID) |
| 1130 void BrowsingDataRemover::OnClearedPrecacheHistory() { | 1141 void BrowsingDataRemover::OnClearedPrecacheHistory() { |
| 1131 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1142 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1132 waiting_for_clear_precache_history_ = false; | 1143 waiting_for_clear_precache_history_ = false; |
| 1133 NotifyAndDeleteIfDone(); | 1144 NotifyAndDeleteIfDone(); |
| 1134 } | 1145 } |
| 1146 |
| 1147 void BrowsingDataRemover::OnClearedWebappData() { |
| 1148 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1149 waiting_for_clear_webapp_data_ = false; |
| 1150 NotifyAndDeleteIfDone(); |
| 1151 } |
| 1135 #endif | 1152 #endif |
| 1136 | 1153 |
| 1137 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1154 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1138 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1155 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1139 waiting_for_clear_domain_reliability_monitor_ = false; | 1156 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1140 NotifyAndDeleteIfDone(); | 1157 NotifyAndDeleteIfDone(); |
| 1141 } | 1158 } |
| 1142 | 1159 |
| 1143 // static | 1160 // static |
| 1144 BrowsingDataRemover::CallbackSubscription | 1161 BrowsingDataRemover::CallbackSubscription |
| 1145 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1162 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 1146 const BrowsingDataRemover::Callback& callback) { | 1163 const BrowsingDataRemover::Callback& callback) { |
| 1147 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1164 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 1148 } | 1165 } |
| OLD | NEW |