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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 delete_begin_, | 898 delete_begin_, |
899 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, | 899 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, |
900 weak_ptr_factory_.GetWeakPtr())); | 900 weak_ptr_factory_.GetWeakPtr())); |
901 } | 901 } |
902 | 902 |
903 if (remove_mask & REMOVE_WEBRTC_IDENTITY) { | 903 if (remove_mask & REMOVE_WEBRTC_IDENTITY) { |
904 storage_partition_remove_mask |= | 904 storage_partition_remove_mask |= |
905 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; | 905 content::StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; |
906 } | 906 } |
907 | 907 |
| 908 // Content Decryption Modules used by Encrypted Media store licenses in a |
| 909 // private filesystem. These are different than content licenses used by |
| 910 // Flash (which are deleted father down in this method). |
| 911 if (remove_mask & REMOVE_MEDIA_LICENSES) { |
| 912 storage_partition_remove_mask |= |
| 913 content::StoragePartition::REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA; |
| 914 } |
| 915 |
908 if (storage_partition_remove_mask) { | 916 if (storage_partition_remove_mask) { |
909 waiting_for_clear_storage_partition_data_ = true; | 917 waiting_for_clear_storage_partition_data_ = true; |
910 | 918 |
911 content::StoragePartition* storage_partition; | 919 content::StoragePartition* storage_partition; |
912 if (storage_partition_for_testing_) | 920 if (storage_partition_for_testing_) |
913 storage_partition = storage_partition_for_testing_; | 921 storage_partition = storage_partition_for_testing_; |
914 else | 922 else |
915 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); | 923 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); |
916 | 924 |
917 uint32_t quota_storage_remove_mask = | 925 uint32_t quota_storage_remove_mask = |
(...skipping 18 matching lines...) Expand all Loading... |
936 } | 944 } |
937 | 945 |
938 storage_partition->ClearData( | 946 storage_partition->ClearData( |
939 storage_partition_remove_mask, quota_storage_remove_mask, | 947 storage_partition_remove_mask, quota_storage_remove_mask, |
940 base::Bind(&DoesOriginMatchMaskAndUrls, origin_type_mask_, filter), | 948 base::Bind(&DoesOriginMatchMaskAndUrls, origin_type_mask_, filter), |
941 cookie_matcher, delete_begin_, delete_end_, | 949 cookie_matcher, delete_begin_, delete_end_, |
942 base::Bind(&BrowsingDataRemover::OnClearedStoragePartitionData, | 950 base::Bind(&BrowsingDataRemover::OnClearedStoragePartitionData, |
943 weak_ptr_factory_.GetWeakPtr())); | 951 weak_ptr_factory_.GetWeakPtr())); |
944 } | 952 } |
945 | 953 |
946 #if defined(ENABLE_PLUGINS) | 954 if (remove_mask & REMOVE_MEDIA_LICENSES) { |
947 if (remove_mask & REMOVE_CONTENT_LICENSES) { | 955 // TODO(jrummell): This UMA should be renamed to indicate it is for Media |
| 956 // Licenses. |
948 content::RecordAction( | 957 content::RecordAction( |
949 UserMetricsAction("ClearBrowsingData_ContentLicenses")); | 958 UserMetricsAction("ClearBrowsingData_ContentLicenses")); |
950 | 959 |
951 waiting_for_clear_content_licenses_ = true; | 960 #if defined(ENABLE_PLUGINS) |
| 961 waiting_for_clear_flash_content_licenses_ = true; |
952 if (!pepper_flash_settings_manager_.get()) { | 962 if (!pepper_flash_settings_manager_.get()) { |
953 pepper_flash_settings_manager_.reset( | 963 pepper_flash_settings_manager_.reset( |
954 new PepperFlashSettingsManager(this, profile_)); | 964 new PepperFlashSettingsManager(this, profile_)); |
955 } | 965 } |
956 deauthorize_content_licenses_request_id_ = | 966 deauthorize_flash_content_licenses_request_id_ = |
957 pepper_flash_settings_manager_->DeauthorizeContentLicenses(prefs); | 967 pepper_flash_settings_manager_->DeauthorizeContentLicenses(prefs); |
958 #if defined(OS_CHROMEOS) | 968 #if defined(OS_CHROMEOS) |
959 // On Chrome OS, also delete any content protection platform keys. | 969 // On Chrome OS, also delete any content protection platform keys. |
960 const user_manager::User* user = | 970 const user_manager::User* user = |
961 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | 971 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); |
962 if (!user) { | 972 if (!user) { |
963 LOG(WARNING) << "Failed to find user for current profile."; | 973 LOG(WARNING) << "Failed to find user for current profile."; |
964 } else { | 974 } else { |
965 chromeos::DBusThreadManager::Get() | 975 chromeos::DBusThreadManager::Get() |
966 ->GetCryptohomeClient() | 976 ->GetCryptohomeClient() |
967 ->TpmAttestationDeleteKeys( | 977 ->TpmAttestationDeleteKeys( |
968 chromeos::attestation::KEY_USER, | 978 chromeos::attestation::KEY_USER, |
969 cryptohome::Identification(user->GetAccountId()), | 979 cryptohome::Identification(user->GetAccountId()), |
970 chromeos::attestation::kContentProtectionKeyPrefix, | 980 chromeos::attestation::kContentProtectionKeyPrefix, |
971 base::Bind(&BrowsingDataRemover::OnClearPlatformKeys, | 981 base::Bind(&BrowsingDataRemover::OnClearPlatformKeys, |
972 weak_ptr_factory_.GetWeakPtr())); | 982 weak_ptr_factory_.GetWeakPtr())); |
973 waiting_for_clear_platform_keys_ = true; | 983 waiting_for_clear_platform_keys_ = true; |
974 } | 984 } |
975 #endif | 985 #endif // defined(OS_CHROMEOS) |
| 986 #endif // defined(ENABLE_PLUGINS) |
976 } | 987 } |
977 #endif | |
978 | 988 |
979 // Remove omnibox zero-suggest cache results. | 989 // Remove omnibox zero-suggest cache results. |
980 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES))) | 990 if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES))) |
981 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); | 991 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); |
982 | 992 |
983 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { | 993 if (remove_mask & (REMOVE_COOKIES | REMOVE_HISTORY)) { |
984 domain_reliability::DomainReliabilityService* service = | 994 domain_reliability::DomainReliabilityService* service = |
985 domain_reliability::DomainReliabilityServiceFactory:: | 995 domain_reliability::DomainReliabilityServiceFactory:: |
986 GetForBrowserContext(profile_); | 996 GetForBrowserContext(profile_); |
987 if (service) { | 997 if (service) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 break; | 1106 break; |
1097 case EVERYTHING: | 1107 case EVERYTHING: |
1098 delete_begin_time = base::Time(); | 1108 delete_begin_time = base::Time(); |
1099 break; | 1109 break; |
1100 } | 1110 } |
1101 return delete_begin_time - diff; | 1111 return delete_begin_time - diff; |
1102 } | 1112 } |
1103 | 1113 |
1104 bool BrowsingDataRemover::AllDone() { | 1114 bool BrowsingDataRemover::AllDone() { |
1105 return !waiting_for_clear_autofill_origin_urls_ && | 1115 return !waiting_for_clear_autofill_origin_urls_ && |
1106 !waiting_for_clear_cache_ && !waiting_for_clear_content_licenses_ && | 1116 !waiting_for_clear_cache_ && |
| 1117 !waiting_for_clear_flash_content_licenses_ && |
1107 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && | 1118 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && |
1108 !waiting_for_clear_domain_reliability_monitor_ && | 1119 !waiting_for_clear_domain_reliability_monitor_ && |
1109 !waiting_for_clear_form_ && !waiting_for_clear_history_ && | 1120 !waiting_for_clear_form_ && !waiting_for_clear_history_ && |
1110 !waiting_for_clear_hostname_resolution_cache_ && | 1121 !waiting_for_clear_hostname_resolution_cache_ && |
1111 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && | 1122 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && |
1112 !waiting_for_clear_network_predictor_ && | 1123 !waiting_for_clear_network_predictor_ && |
1113 !waiting_for_clear_networking_history_ && | 1124 !waiting_for_clear_networking_history_ && |
1114 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && | 1125 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && |
1115 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && | 1126 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && |
1116 !waiting_for_clear_pnacl_cache_ && | 1127 !waiting_for_clear_pnacl_cache_ && |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 #if defined(ENABLE_PLUGINS) | 1226 #if defined(ENABLE_PLUGINS) |
1216 void BrowsingDataRemover::OnWaitableEventSignaled( | 1227 void BrowsingDataRemover::OnWaitableEventSignaled( |
1217 base::WaitableEvent* waitable_event) { | 1228 base::WaitableEvent* waitable_event) { |
1218 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1229 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1219 waiting_for_clear_plugin_data_ = false; | 1230 waiting_for_clear_plugin_data_ = false; |
1220 plugin_data_remover_.reset(); | 1231 plugin_data_remover_.reset(); |
1221 watcher_.StopWatching(); | 1232 watcher_.StopWatching(); |
1222 NotifyIfDone(); | 1233 NotifyIfDone(); |
1223 } | 1234 } |
1224 | 1235 |
1225 void BrowsingDataRemover::OnDeauthorizeContentLicensesCompleted( | 1236 void BrowsingDataRemover::OnDeauthorizeFlashContentLicensesCompleted( |
1226 uint32_t request_id, | 1237 uint32_t request_id, |
1227 bool /* success */) { | 1238 bool /* success */) { |
1228 DCHECK(waiting_for_clear_content_licenses_); | 1239 DCHECK(waiting_for_clear_flash_content_licenses_); |
1229 DCHECK_EQ(request_id, deauthorize_content_licenses_request_id_); | 1240 DCHECK_EQ(request_id, deauthorize_flash_content_licenses_request_id_); |
1230 | 1241 |
1231 waiting_for_clear_content_licenses_ = false; | 1242 waiting_for_clear_flash_content_licenses_ = false; |
1232 NotifyIfDone(); | 1243 NotifyIfDone(); |
1233 } | 1244 } |
1234 #endif | 1245 #endif |
1235 | 1246 |
1236 #if defined(OS_CHROMEOS) | 1247 #if defined(OS_CHROMEOS) |
1237 void BrowsingDataRemover::OnClearPlatformKeys( | 1248 void BrowsingDataRemover::OnClearPlatformKeys( |
1238 chromeos::DBusMethodCallStatus call_status, | 1249 chromeos::DBusMethodCallStatus call_status, |
1239 bool result) { | 1250 bool result) { |
1240 DCHECK(waiting_for_clear_platform_keys_); | 1251 DCHECK(waiting_for_clear_platform_keys_); |
1241 LOG_IF(ERROR, call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || !result) | 1252 LOG_IF(ERROR, call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || !result) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 waiting_for_clear_domain_reliability_monitor_ = false; | 1347 waiting_for_clear_domain_reliability_monitor_ = false; |
1337 NotifyIfDone(); | 1348 NotifyIfDone(); |
1338 } | 1349 } |
1339 | 1350 |
1340 // static | 1351 // static |
1341 BrowsingDataRemover::CallbackSubscription | 1352 BrowsingDataRemover::CallbackSubscription |
1342 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1353 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
1343 const BrowsingDataRemover::Callback& callback) { | 1354 const BrowsingDataRemover::Callback& callback) { |
1344 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1355 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
1345 } | 1356 } |
OLD | NEW |