| 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_impl.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" | 18 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "components/browsing_data/content/storage_partition_http_cache_data_rem
over.h" | 21 #include "components/browsing_data/content/storage_partition_http_cache_data_rem
over.h" |
| 22 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
| 23 #include "components/web_cache/browser/web_cache_manager.h" | |
| 24 #include "content/public/browser/browser_context.h" | 23 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/browsing_data_filter_builder.h" | 25 #include "content/public/browser/browsing_data_filter_builder.h" |
| 27 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
| 28 #include "content/public/browser/download_manager.h" | 27 #include "content/public/browser/download_manager.h" |
| 29 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/browser/storage_partition.h" | 29 #include "content/public/browser/storage_partition.h" |
| 31 #include "content/public/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
| 32 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
| 33 #include "net/cookies/cookie_store.h" | 32 #include "net/cookies/cookie_store.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 storage_partition_remove_mask, quota_storage_remove_mask, | 507 storage_partition_remove_mask, quota_storage_remove_mask, |
| 509 base::Bind(&DoesOriginMatchMaskAndUrls, weak_ptr_factory_.GetWeakPtr(), | 508 base::Bind(&DoesOriginMatchMaskAndUrls, weak_ptr_factory_.GetWeakPtr(), |
| 510 origin_type_mask_, filter), | 509 origin_type_mask_, filter), |
| 511 cookie_matcher, delete_begin_, delete_end_, | 510 cookie_matcher, delete_begin_, delete_end_, |
| 512 clear_storage_partition_data_.GetCompletionCallback()); | 511 clear_storage_partition_data_.GetCompletionCallback()); |
| 513 } | 512 } |
| 514 | 513 |
| 515 ////////////////////////////////////////////////////////////////////////////// | 514 ////////////////////////////////////////////////////////////////////////////// |
| 516 // CACHE | 515 // CACHE |
| 517 if (remove_mask & DATA_TYPE_CACHE) { | 516 if (remove_mask & DATA_TYPE_CACHE) { |
| 518 // Tell the renderers to clear their cache. | 517 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); |
| 519 web_cache::WebCacheManager::GetInstance()->ClearCache(); | |
| 520 | 518 |
| 521 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); | 519 // TODO(msramek): Clear the cache of all renderers. |
| 522 | 520 |
| 523 clear_cache_.Start(); | 521 clear_cache_.Start(); |
| 524 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. | 522 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. |
| 525 if (filter_builder.IsEmptyBlacklist()) { | 523 if (filter_builder.IsEmptyBlacklist()) { |
| 526 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( | 524 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( |
| 527 BrowserContext::GetDefaultStoragePartition(browser_context_), | 525 BrowserContext::GetDefaultStoragePartition(browser_context_), |
| 528 delete_begin_, delete_end_) | 526 delete_begin_, delete_end_) |
| 529 ->Remove(clear_cache_.GetCompletionCallback()); | 527 ->Remove(clear_cache_.GetCompletionCallback()); |
| 530 } else { | 528 } else { |
| 531 browsing_data::StoragePartitionHttpCacheDataRemover:: | 529 browsing_data::StoragePartitionHttpCacheDataRemover:: |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 671 |
| 674 if (completion_inhibitor_) { | 672 if (completion_inhibitor_) { |
| 675 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( | 673 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( |
| 676 this, base::Bind(&BrowsingDataRemoverImpl::Notify, | 674 this, base::Bind(&BrowsingDataRemoverImpl::Notify, |
| 677 weak_ptr_factory_.GetWeakPtr())); | 675 weak_ptr_factory_.GetWeakPtr())); |
| 678 return; | 676 return; |
| 679 } | 677 } |
| 680 | 678 |
| 681 Notify(); | 679 Notify(); |
| 682 } | 680 } |
| OLD | NEW |