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" | |
22 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
23 #include "components/web_cache/browser/web_cache_manager.h" | 22 #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" |
| 30 #include "content/public/browser/storage_partition_http_cache_data_remover.h" |
31 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
32 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
33 #include "net/cookies/cookie_store.h" | 33 #include "net/cookies/cookie_store.h" |
34 #include "net/http/http_network_session.h" | 34 #include "net/http/http_network_session.h" |
35 #include "net/http/http_transaction_factory.h" | 35 #include "net/http/http_transaction_factory.h" |
36 #include "net/http/transport_security_state.h" | 36 #include "net/http/transport_security_state.h" |
37 #include "net/ssl/channel_id_service.h" | 37 #include "net/ssl/channel_id_service.h" |
38 #include "net/ssl/channel_id_store.h" | 38 #include "net/ssl/channel_id_store.h" |
39 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
40 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // CACHE | 516 // CACHE |
517 if (remove_mask & DATA_TYPE_CACHE) { | 517 if (remove_mask & DATA_TYPE_CACHE) { |
518 // Tell the renderers to clear their cache. | 518 // Tell the renderers to clear their cache. |
519 web_cache::WebCacheManager::GetInstance()->ClearCache(); | 519 web_cache::WebCacheManager::GetInstance()->ClearCache(); |
520 | 520 |
521 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); | 521 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); |
522 | 522 |
523 clear_cache_.Start(); | 523 clear_cache_.Start(); |
524 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. | 524 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. |
525 if (filter_builder.IsEmptyBlacklist()) { | 525 if (filter_builder.IsEmptyBlacklist()) { |
526 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( | 526 content::StoragePartitionHttpCacheDataRemover::CreateForRange( |
527 BrowserContext::GetDefaultStoragePartition(browser_context_), | 527 BrowserContext::GetDefaultStoragePartition(browser_context_), |
528 delete_begin_, delete_end_) | 528 delete_begin_, delete_end_) |
529 ->Remove(clear_cache_.GetCompletionCallback()); | 529 ->Remove(clear_cache_.GetCompletionCallback()); |
530 } else { | 530 } else { |
531 browsing_data::StoragePartitionHttpCacheDataRemover:: | 531 content::StoragePartitionHttpCacheDataRemover::CreateForURLsAndRange( |
532 CreateForURLsAndRange( | 532 BrowserContext::GetDefaultStoragePartition(browser_context_), filter, |
533 BrowserContext::GetDefaultStoragePartition(browser_context_), | 533 delete_begin_, delete_end_) |
534 filter, delete_begin_, delete_end_) | 534 ->Remove(clear_cache_.GetCompletionCallback()); |
535 ->Remove(clear_cache_.GetCompletionCallback()); | |
536 } | 535 } |
537 | 536 |
538 // Tell the shader disk cache to clear. | 537 // Tell the shader disk cache to clear. |
539 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); | 538 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); |
540 storage_partition_remove_mask |= | 539 storage_partition_remove_mask |= |
541 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; | 540 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; |
542 } | 541 } |
543 | 542 |
544 ////////////////////////////////////////////////////////////////////////////// | 543 ////////////////////////////////////////////////////////////////////////////// |
545 // Auth cache. | 544 // Auth cache. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 672 |
674 if (completion_inhibitor_) { | 673 if (completion_inhibitor_) { |
675 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( | 674 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( |
676 this, base::Bind(&BrowsingDataRemoverImpl::Notify, | 675 this, base::Bind(&BrowsingDataRemoverImpl::Notify, |
677 weak_ptr_factory_.GetWeakPtr())); | 676 weak_ptr_factory_.GetWeakPtr())); |
678 return; | 677 return; |
679 } | 678 } |
680 | 679 |
681 Notify(); | 680 Notify(); |
682 } | 681 } |
OLD | NEW |