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

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

Issue 1941073002: Clear network state only when REMOVE_CACHE is set, not unconditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: call GetRequestContext() on main thread Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS); 872 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS);
873 } 873 }
874 874
875 // Tell the shader disk cache to clear. 875 // Tell the shader disk cache to clear.
876 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); 876 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
877 storage_partition_remove_mask |= 877 storage_partition_remove_mask |=
878 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; 878 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE;
879 879
880 storage_partition_remove_mask |= 880 storage_partition_remove_mask |=
881 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; 881 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY;
882
883 // When clearing cache, wipe accumulated network related data
884 // (TransportSecurityState and HttpServerPropertiesManager data).
885 waiting_for_clear_networking_history_ = true;
886 profile_->ClearNetworkingHistorySince(
887 delete_begin_,
888 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
889 weak_ptr_factory_.GetWeakPtr()));
882 } 890 }
883 891
884 if (remove_mask & REMOVE_WEBRTC_IDENTITY) { 892 if (remove_mask & REMOVE_WEBRTC_IDENTITY) {
885 storage_partition_remove_mask |= 893 storage_partition_remove_mask |=
886 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; 894 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY;
887 } 895 }
888 896
889 if (storage_partition_remove_mask) { 897 if (storage_partition_remove_mask) {
890 waiting_for_clear_storage_partition_data_ = true; 898 waiting_for_clear_storage_partition_data_ = true;
891 899
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 waiting_for_clear_platform_keys_ = true; 957 waiting_for_clear_platform_keys_ = true;
950 } 958 }
951 #endif 959 #endif
952 } 960 }
953 #endif 961 #endif
954 962
955 // Remove omnibox zero-suggest cache results. 963 // Remove omnibox zero-suggest cache results.
956 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES))) 964 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES)))
957 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); 965 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string());
958 966
959 // Always wipe accumulated network related data (TransportSecurityState and
960 // HttpServerPropertiesManager data).
961 waiting_for_clear_networking_history_ = true;
962 profile_->ClearNetworkingHistorySince(
963 delete_begin_,
964 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
965 weak_ptr_factory_.GetWeakPtr()));
966
967 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { 967 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) {
968 domain_reliability::DomainReliabilityService* service = 968 domain_reliability::DomainReliabilityService* service =
969 domain_reliability::DomainReliabilityServiceFactory:: 969 domain_reliability::DomainReliabilityServiceFactory::
970 GetForBrowserContext(profile_); 970 GetForBrowserContext(profile_);
971 if (service) { 971 if (service) {
972 domain_reliability::DomainReliabilityClearMode mode; 972 domain_reliability::DomainReliabilityClearMode mode;
973 if (remove_mask & REMOVE_COOKIES) 973 if (remove_mask & REMOVE_COOKIES)
974 mode = domain_reliability::CLEAR_CONTEXTS; 974 mode = domain_reliability::CLEAR_CONTEXTS;
975 else 975 else
976 mode = domain_reliability::CLEAR_BEACONS; 976 mode = domain_reliability::CLEAR_BEACONS;
(...skipping 30 matching lines...) Expand all
1007 // Record the combined deletion of cookies and cache. 1007 // Record the combined deletion of cookies and cache.
1008 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; 1008 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE;
1009 if (remove_mask & REMOVE_COOKIES && 1009 if (remove_mask & REMOVE_COOKIES &&
1010 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { 1010 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) {
1011 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE 1011 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE
1012 : ONLY_COOKIES; 1012 : ONLY_COOKIES;
1013 } else if (remove_mask & REMOVE_CACHE) { 1013 } else if (remove_mask & REMOVE_CACHE) {
1014 choice = ONLY_CACHE; 1014 choice = ONLY_CACHE;
1015 } 1015 }
1016 1016
1017 // Notify in case all actions taken were synchronous.
1018 NotifyIfDone();
1019
1017 UMA_HISTOGRAM_ENUMERATION( 1020 UMA_HISTOGRAM_ENUMERATION(
1018 "History.ClearBrowsingData.UserDeletedCookieOrCache", 1021 "History.ClearBrowsingData.UserDeletedCookieOrCache",
1019 choice, MAX_CHOICE_VALUE); 1022 choice, MAX_CHOICE_VALUE);
1020 } 1023 }
1021 1024
1022 void BrowsingDataRemover::AddObserver(Observer* observer) { 1025 void BrowsingDataRemover::AddObserver(Observer* observer) {
1023 observer_list_.AddObserver(observer); 1026 observer_list_.AddObserver(observer);
1024 } 1027 }
1025 1028
1026 void BrowsingDataRemover::RemoveObserver(Observer* observer) { 1029 void BrowsingDataRemover::RemoveObserver(Observer* observer) {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 waiting_for_clear_domain_reliability_monitor_ = false; 1319 waiting_for_clear_domain_reliability_monitor_ = false;
1317 NotifyIfDone(); 1320 NotifyIfDone();
1318 } 1321 }
1319 1322
1320 // static 1323 // static
1321 BrowsingDataRemover::CallbackSubscription 1324 BrowsingDataRemover::CallbackSubscription
1322 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( 1325 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
1323 const BrowsingDataRemover::Callback& callback) { 1326 const BrowsingDataRemover::Callback& callback) {
1324 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); 1327 return GetOnBrowsingDataRemovedCallbacks()->Add(callback);
1325 } 1328 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698