| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS); | 829 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS); |
| 830 } | 830 } |
| 831 | 831 |
| 832 // Tell the shader disk cache to clear. | 832 // Tell the shader disk cache to clear. |
| 833 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); | 833 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); |
| 834 storage_partition_remove_mask |= | 834 storage_partition_remove_mask |= |
| 835 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; | 835 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; |
| 836 | 836 |
| 837 storage_partition_remove_mask |= | 837 storage_partition_remove_mask |= |
| 838 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; | 838 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; |
| 839 |
| 840 // When clearing cache, wipe accumulated network related data |
| 841 // (TransportSecurityState and HttpServerPropertiesManager data). |
| 842 waiting_for_clear_networking_history_ = true; |
| 843 profile_->ClearNetworkingHistorySince( |
| 844 delete_begin_, |
| 845 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, |
| 846 weak_ptr_factory_.GetWeakPtr())); |
| 839 } | 847 } |
| 840 | 848 |
| 841 if (remove_mask & REMOVE_WEBRTC_IDENTITY) { | 849 if (remove_mask & REMOVE_WEBRTC_IDENTITY) { |
| 842 storage_partition_remove_mask |= | 850 storage_partition_remove_mask |= |
| 843 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; | 851 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; |
| 844 } | 852 } |
| 845 | 853 |
| 846 if (storage_partition_remove_mask) { | 854 if (storage_partition_remove_mask) { |
| 847 waiting_for_clear_storage_partition_data_ = true; | 855 waiting_for_clear_storage_partition_data_ = true; |
| 848 | 856 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 waiting_for_clear_platform_keys_ = true; | 910 waiting_for_clear_platform_keys_ = true; |
| 903 } | 911 } |
| 904 #endif | 912 #endif |
| 905 } | 913 } |
| 906 #endif | 914 #endif |
| 907 | 915 |
| 908 // Remove omnibox zero-suggest cache results. | 916 // Remove omnibox zero-suggest cache results. |
| 909 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES))) | 917 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES))) |
| 910 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); | 918 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); |
| 911 | 919 |
| 912 // Always wipe accumulated network related data (TransportSecurityState and | |
| 913 // HttpServerPropertiesManager data). | |
| 914 waiting_for_clear_networking_history_ = true; | |
| 915 profile_->ClearNetworkingHistorySince( | |
| 916 delete_begin_, | |
| 917 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, | |
| 918 weak_ptr_factory_.GetWeakPtr())); | |
| 919 | |
| 920 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { | 920 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { |
| 921 domain_reliability::DomainReliabilityService* service = | 921 domain_reliability::DomainReliabilityService* service = |
| 922 domain_reliability::DomainReliabilityServiceFactory:: | 922 domain_reliability::DomainReliabilityServiceFactory:: |
| 923 GetForBrowserContext(profile_); | 923 GetForBrowserContext(profile_); |
| 924 if (service) { | 924 if (service) { |
| 925 domain_reliability::DomainReliabilityClearMode mode; | 925 domain_reliability::DomainReliabilityClearMode mode; |
| 926 if (remove_mask & REMOVE_COOKIES) | 926 if (remove_mask & REMOVE_COOKIES) |
| 927 mode = domain_reliability::CLEAR_CONTEXTS; | 927 mode = domain_reliability::CLEAR_CONTEXTS; |
| 928 else | 928 else |
| 929 mode = domain_reliability::CLEAR_BEACONS; | 929 mode = domain_reliability::CLEAR_BEACONS; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 958 // Record the combined deletion of cookies and cache. | 958 // Record the combined deletion of cookies and cache. |
| 959 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; | 959 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; |
| 960 if (remove_mask & REMOVE_COOKIES && | 960 if (remove_mask & REMOVE_COOKIES && |
| 961 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 961 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 962 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE | 962 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE |
| 963 : ONLY_COOKIES; | 963 : ONLY_COOKIES; |
| 964 } else if (remove_mask & REMOVE_CACHE) { | 964 } else if (remove_mask & REMOVE_CACHE) { |
| 965 choice = ONLY_CACHE; | 965 choice = ONLY_CACHE; |
| 966 } | 966 } |
| 967 | 967 |
| 968 // Notify in case all actions taken were synchronous. |
| 969 NotifyIfDone(); |
| 970 |
| 968 UMA_HISTOGRAM_ENUMERATION( | 971 UMA_HISTOGRAM_ENUMERATION( |
| 969 "History.ClearBrowsingData.UserDeletedCookieOrCache", | 972 "History.ClearBrowsingData.UserDeletedCookieOrCache", |
| 970 choice, MAX_CHOICE_VALUE); | 973 choice, MAX_CHOICE_VALUE); |
| 971 } | 974 } |
| 972 | 975 |
| 973 void BrowsingDataRemover::AddObserver(Observer* observer) { | 976 void BrowsingDataRemover::AddObserver(Observer* observer) { |
| 974 observer_list_.AddObserver(observer); | 977 observer_list_.AddObserver(observer); |
| 975 } | 978 } |
| 976 | 979 |
| 977 void BrowsingDataRemover::RemoveObserver(Observer* observer) { | 980 void BrowsingDataRemover::RemoveObserver(Observer* observer) { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 waiting_for_clear_domain_reliability_monitor_ = false; | 1251 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1249 NotifyIfDone(); | 1252 NotifyIfDone(); |
| 1250 } | 1253 } |
| 1251 | 1254 |
| 1252 // static | 1255 // static |
| 1253 BrowsingDataRemover::CallbackSubscription | 1256 BrowsingDataRemover::CallbackSubscription |
| 1254 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1257 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 1255 const BrowsingDataRemover::Callback& callback) { | 1258 const BrowsingDataRemover::Callback& callback) { |
| 1256 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1259 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 1257 } | 1260 } |
| OLD | NEW |