| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 48 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 49 #include "chrome/browser/search_engines/template_url_service.h" | 49 #include "chrome/browser/search_engines/template_url_service.h" |
| 50 #include "chrome/browser/search_engines/template_url_service_factory.h" | 50 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 51 #include "chrome/browser/sessions/session_service.h" | 51 #include "chrome/browser/sessions/session_service.h" |
| 52 #include "chrome/browser/sessions/session_service_factory.h" | 52 #include "chrome/browser/sessions/session_service_factory.h" |
| 53 #include "chrome/browser/sessions/tab_restore_service.h" | 53 #include "chrome/browser/sessions/tab_restore_service.h" |
| 54 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 54 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 55 #include "chrome/browser/webdata/web_data_service_factory.h" | 55 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 56 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
| 57 #include "chrome/common/url_constants.h" | 57 #include "chrome/common/url_constants.h" |
| 58 #include "components/domain_reliability/monitor.h" |
| 58 #include "components/password_manager/core/browser/password_store.h" | 59 #include "components/password_manager/core/browser/password_store.h" |
| 59 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 60 #include "chromeos/attestation/attestation_constants.h" | 61 #include "chromeos/attestation/attestation_constants.h" |
| 61 #include "chromeos/dbus/cryptohome_client.h" | 62 #include "chromeos/dbus/cryptohome_client.h" |
| 62 #include "chromeos/dbus/dbus_thread_manager.h" | 63 #include "chromeos/dbus/dbus_thread_manager.h" |
| 63 #endif | 64 #endif |
| 64 #include "components/autofill/core/browser/personal_data_manager.h" | 65 #include "components/autofill/core/browser/personal_data_manager.h" |
| 65 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 66 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 66 #include "components/nacl/browser/nacl_browser.h" | 67 #include "components/nacl/browser/nacl_browser.h" |
| 67 #include "components/nacl/browser/pnacl_host.h" | 68 #include "components/nacl/browser/pnacl_host.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 delete_end_(delete_end), | 183 delete_end_(delete_end), |
| 183 next_cache_state_(STATE_NONE), | 184 next_cache_state_(STATE_NONE), |
| 184 cache_(NULL), | 185 cache_(NULL), |
| 185 main_context_getter_(profile->GetRequestContext()), | 186 main_context_getter_(profile->GetRequestContext()), |
| 186 media_context_getter_(profile->GetMediaRequestContext()), | 187 media_context_getter_(profile->GetMediaRequestContext()), |
| 187 deauthorize_content_licenses_request_id_(0), | 188 deauthorize_content_licenses_request_id_(0), |
| 188 waiting_for_clear_autofill_origin_urls_(false), | 189 waiting_for_clear_autofill_origin_urls_(false), |
| 189 waiting_for_clear_cache_(false), | 190 waiting_for_clear_cache_(false), |
| 190 waiting_for_clear_content_licenses_(false), | 191 waiting_for_clear_content_licenses_(false), |
| 191 waiting_for_clear_cookies_count_(0), | 192 waiting_for_clear_cookies_count_(0), |
| 193 waiting_for_clear_domain_reliability_monitor_(false), |
| 192 waiting_for_clear_form_(false), | 194 waiting_for_clear_form_(false), |
| 193 waiting_for_clear_history_(false), | 195 waiting_for_clear_history_(false), |
| 194 waiting_for_clear_hostname_resolution_cache_(false), | 196 waiting_for_clear_hostname_resolution_cache_(false), |
| 195 waiting_for_clear_keyword_data_(false), | 197 waiting_for_clear_keyword_data_(false), |
| 196 waiting_for_clear_logged_in_predictor_(false), | 198 waiting_for_clear_logged_in_predictor_(false), |
| 197 waiting_for_clear_nacl_cache_(false), | 199 waiting_for_clear_nacl_cache_(false), |
| 198 waiting_for_clear_network_predictor_(false), | 200 waiting_for_clear_network_predictor_(false), |
| 199 waiting_for_clear_networking_history_(false), | 201 waiting_for_clear_networking_history_(false), |
| 200 waiting_for_clear_platform_keys_(false), | 202 waiting_for_clear_platform_keys_(false), |
| 201 waiting_for_clear_plugin_data_(false), | 203 waiting_for_clear_plugin_data_(false), |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 664 } |
| 663 #endif | 665 #endif |
| 664 | 666 |
| 665 // Always wipe accumulated network related data (TransportSecurityState and | 667 // Always wipe accumulated network related data (TransportSecurityState and |
| 666 // HttpServerPropertiesManager data). | 668 // HttpServerPropertiesManager data). |
| 667 waiting_for_clear_networking_history_ = true; | 669 waiting_for_clear_networking_history_ = true; |
| 668 profile_->ClearNetworkingHistorySince( | 670 profile_->ClearNetworkingHistorySince( |
| 669 delete_begin_, | 671 delete_begin_, |
| 670 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, | 672 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, |
| 671 base::Unretained(this))); | 673 base::Unretained(this))); |
| 674 |
| 675 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { |
| 676 domain_reliability::DomainReliabilityClearMode mode; |
| 677 if (remove_mask & REMOVE_COOKIES) |
| 678 mode = domain_reliability::CLEAR_CONTEXTS; |
| 679 else |
| 680 mode = domain_reliability::CLEAR_BEACONS; |
| 681 |
| 682 waiting_for_clear_domain_reliability_monitor_ = true; |
| 683 profile_->ClearDomainReliabilityMonitor( |
| 684 mode, |
| 685 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
| 686 base::Unretained(this))); |
| 687 } |
| 672 } | 688 } |
| 673 | 689 |
| 674 void BrowsingDataRemover::AddObserver(Observer* observer) { | 690 void BrowsingDataRemover::AddObserver(Observer* observer) { |
| 675 observer_list_.AddObserver(observer); | 691 observer_list_.AddObserver(observer); |
| 676 } | 692 } |
| 677 | 693 |
| 678 void BrowsingDataRemover::RemoveObserver(Observer* observer) { | 694 void BrowsingDataRemover::RemoveObserver(Observer* observer) { |
| 679 observer_list_.RemoveObserver(observer); | 695 observer_list_.RemoveObserver(observer); |
| 680 } | 696 } |
| 681 | 697 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 break; | 730 break; |
| 715 } | 731 } |
| 716 return delete_begin_time - diff; | 732 return delete_begin_time - diff; |
| 717 } | 733 } |
| 718 | 734 |
| 719 bool BrowsingDataRemover::AllDone() { | 735 bool BrowsingDataRemover::AllDone() { |
| 720 return !waiting_for_clear_keyword_data_ && | 736 return !waiting_for_clear_keyword_data_ && |
| 721 !waiting_for_clear_autofill_origin_urls_ && | 737 !waiting_for_clear_autofill_origin_urls_ && |
| 722 !waiting_for_clear_cache_ && !waiting_for_clear_nacl_cache_ && | 738 !waiting_for_clear_cache_ && !waiting_for_clear_nacl_cache_ && |
| 723 !waiting_for_clear_cookies_count_ && !waiting_for_clear_history_ && | 739 !waiting_for_clear_cookies_count_ && !waiting_for_clear_history_ && |
| 740 !waiting_for_clear_domain_reliability_monitor_ && |
| 724 !waiting_for_clear_logged_in_predictor_ && | 741 !waiting_for_clear_logged_in_predictor_ && |
| 725 !waiting_for_clear_networking_history_ && | 742 !waiting_for_clear_networking_history_ && |
| 726 !waiting_for_clear_server_bound_certs_ && | 743 !waiting_for_clear_server_bound_certs_ && |
| 727 !waiting_for_clear_plugin_data_ && | 744 !waiting_for_clear_plugin_data_ && |
| 728 !waiting_for_clear_pnacl_cache_ && | 745 !waiting_for_clear_pnacl_cache_ && |
| 729 !waiting_for_clear_content_licenses_ && !waiting_for_clear_form_ && | 746 !waiting_for_clear_content_licenses_ && !waiting_for_clear_form_ && |
| 730 !waiting_for_clear_hostname_resolution_cache_ && | 747 !waiting_for_clear_hostname_resolution_cache_ && |
| 731 !waiting_for_clear_network_predictor_ && | 748 !waiting_for_clear_network_predictor_ && |
| 732 !waiting_for_clear_platform_keys_ && | 749 !waiting_for_clear_platform_keys_ && |
| 733 #if defined(ENABLE_WEBRTC) | 750 #if defined(ENABLE_WEBRTC) |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 NotifyAndDeleteIfDone(); | 1137 NotifyAndDeleteIfDone(); |
| 1121 } | 1138 } |
| 1122 | 1139 |
| 1123 #if defined(ENABLE_WEBRTC) | 1140 #if defined(ENABLE_WEBRTC) |
| 1124 void BrowsingDataRemover::OnClearedWebRtcLogs() { | 1141 void BrowsingDataRemover::OnClearedWebRtcLogs() { |
| 1125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1126 waiting_for_clear_webrtc_logs_ = false; | 1143 waiting_for_clear_webrtc_logs_ = false; |
| 1127 NotifyAndDeleteIfDone(); | 1144 NotifyAndDeleteIfDone(); |
| 1128 } | 1145 } |
| 1129 #endif | 1146 #endif |
| 1147 |
| 1148 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1150 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1151 NotifyAndDeleteIfDone(); |
| 1152 } |
| OLD | NEW |