| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 special_storage_policy); | 161 special_storage_policy); |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool ForwardPrimaryPatternCallback( | 164 bool ForwardPrimaryPatternCallback( |
| 165 const base::Callback<bool(const ContentSettingsPattern&)> predicate, | 165 const base::Callback<bool(const ContentSettingsPattern&)> predicate, |
| 166 const ContentSettingsPattern& primary_pattern, | 166 const ContentSettingsPattern& primary_pattern, |
| 167 const ContentSettingsPattern& secondary_pattern) { | 167 const ContentSettingsPattern& secondary_pattern) { |
| 168 return predicate.Run(primary_pattern); | 168 return predicate.Run(primary_pattern); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ClearHostnameResolutionCacheOnIOThread(IOThread* io_thread) { | 171 void ClearHostnameResolutionCacheOnIOThread( |
| 172 IOThread* io_thread, |
| 173 base::Callback<bool(const std::string&)> host_filter) { |
| 172 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 174 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 173 | 175 |
| 174 io_thread->ClearHostCache(); | 176 io_thread->ClearHostCache(host_filter); |
| 175 } | 177 } |
| 176 | 178 |
| 177 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { | 179 void ClearNetworkPredictorOnIOThread(chrome_browser_net::Predictor* predictor) { |
| 178 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 180 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 179 DCHECK(predictor); | 181 DCHECK(predictor); |
| 180 | 182 |
| 181 predictor->DiscardInitialNavigationHistory(); | 183 predictor->DiscardInitialNavigationHistory(); |
| 182 predictor->DiscardAllResults(); | 184 predictor->DiscardAllResults(); |
| 183 } | 185 } |
| 184 | 186 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 516 |
| 515 // The power consumption history by origin contains details of websites | 517 // The power consumption history by origin contains details of websites |
| 516 // that were visited. | 518 // that were visited. |
| 517 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | 519 // TODO(dmurph): Support all backends with filter (crbug.com/113621). |
| 518 power::OriginPowerMap* origin_power_map = | 520 power::OriginPowerMap* origin_power_map = |
| 519 power::OriginPowerMapFactory::GetForBrowserContext(profile_); | 521 power::OriginPowerMapFactory::GetForBrowserContext(profile_); |
| 520 if (origin_power_map) | 522 if (origin_power_map) |
| 521 origin_power_map->ClearOriginMap(); | 523 origin_power_map->ClearOriginMap(); |
| 522 | 524 |
| 523 // Need to clear the host cache and accumulated speculative data, as it also | 525 // Need to clear the host cache and accumulated speculative data, as it also |
| 524 // reveals some history: we have no mechanism to track when these items were | 526 // reveals some history. We have no mechanism to track when these items were |
| 525 // created, so we'll clear them all. Better safe than sorry. | 527 // created, so we'll not honor the time range. |
| 528 // TODO(msramek): We can use the plugin filter here because plugins, same |
| 529 // as the hostname resolution cache, key their entries by hostname. Rename |
| 530 // BuildPluginFilter() to something more general to reflect this use. |
| 526 if (g_browser_process->io_thread()) { | 531 if (g_browser_process->io_thread()) { |
| 527 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | |
| 528 waiting_for_clear_hostname_resolution_cache_ = true; | 532 waiting_for_clear_hostname_resolution_cache_ = true; |
| 529 BrowserThread::PostTaskAndReply( | 533 BrowserThread::PostTaskAndReply( |
| 530 BrowserThread::IO, FROM_HERE, | 534 BrowserThread::IO, FROM_HERE, |
| 531 base::Bind(&ClearHostnameResolutionCacheOnIOThread, | 535 base::Bind(&ClearHostnameResolutionCacheOnIOThread, |
| 532 g_browser_process->io_thread()), | 536 g_browser_process->io_thread(), |
| 537 filter_builder.BuildPluginFilter()), |
| 533 base::Bind(&BrowsingDataRemover::OnClearedHostnameResolutionCache, | 538 base::Bind(&BrowsingDataRemover::OnClearedHostnameResolutionCache, |
| 534 weak_ptr_factory_.GetWeakPtr())); | 539 weak_ptr_factory_.GetWeakPtr())); |
| 535 } | 540 } |
| 536 if (profile_->GetNetworkPredictor()) { | 541 if (profile_->GetNetworkPredictor()) { |
| 537 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | 542 // TODO(dmurph): Support all backends with filter (crbug.com/113621). |
| 538 waiting_for_clear_network_predictor_ = true; | 543 waiting_for_clear_network_predictor_ = true; |
| 539 BrowserThread::PostTaskAndReply( | 544 BrowserThread::PostTaskAndReply( |
| 540 BrowserThread::IO, FROM_HERE, | 545 BrowserThread::IO, FROM_HERE, |
| 541 base::Bind(&ClearNetworkPredictorOnIOThread, | 546 base::Bind(&ClearNetworkPredictorOnIOThread, |
| 542 profile_->GetNetworkPredictor()), | 547 profile_->GetNetworkPredictor()), |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 waiting_for_clear_offline_page_data_ = false; | 1486 waiting_for_clear_offline_page_data_ = false; |
| 1482 NotifyIfDone(); | 1487 NotifyIfDone(); |
| 1483 } | 1488 } |
| 1484 #endif | 1489 #endif |
| 1485 | 1490 |
| 1486 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1491 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1487 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1492 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1488 waiting_for_clear_domain_reliability_monitor_ = false; | 1493 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1489 NotifyIfDone(); | 1494 NotifyIfDone(); |
| 1490 } | 1495 } |
| OLD | NEW |