Chromium Code Reviews| 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_CONTENT_LICENSES) { | |
|
xhwang
2016/06/17 06:24:29
Should this be renamed to REMOVE_MEDIA_LICENSES? (
jrummell
2016/06/21 00:13:43
Done.
| |
| 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 21 matching lines...) Expand all Loading... | |
| 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 defined(ENABLE_PLUGINS) |
| 947 if (remove_mask & REMOVE_CONTENT_LICENSES) { | 955 if (remove_mask & REMOVE_CONTENT_LICENSES) { |
| 948 content::RecordAction( | 956 content::RecordAction( |
| 949 UserMetricsAction("ClearBrowsingData_ContentLicenses")); | 957 UserMetricsAction("ClearBrowsingData_ContentLicenses")); |
|
xhwang
2016/06/17 06:24:29
This should probably be renamed as well. Can you a
jrummell
2016/06/21 00:13:43
Done.
| |
| 950 | 958 |
| 951 waiting_for_clear_content_licenses_ = true; | 959 waiting_for_clear_flash_content_licenses_ = true; |
| 952 if (!pepper_flash_settings_manager_.get()) { | 960 if (!pepper_flash_settings_manager_.get()) { |
| 953 pepper_flash_settings_manager_.reset( | 961 pepper_flash_settings_manager_.reset( |
| 954 new PepperFlashSettingsManager(this, profile_)); | 962 new PepperFlashSettingsManager(this, profile_)); |
| 955 } | 963 } |
| 956 deauthorize_content_licenses_request_id_ = | 964 deauthorize_content_licenses_request_id_ = |
|
xhwang
2016/06/17 06:24:29
deauthorize_flash_content_licenses_request_id_
jrummell
2016/06/21 00:13:44
Done.
| |
| 957 pepper_flash_settings_manager_->DeauthorizeContentLicenses(prefs); | 965 pepper_flash_settings_manager_->DeauthorizeContentLicenses(prefs); |
| 958 #if defined(OS_CHROMEOS) | 966 #if defined(OS_CHROMEOS) |
| 959 // On Chrome OS, also delete any content protection platform keys. | 967 // On Chrome OS, also delete any content protection platform keys. |
| 960 const user_manager::User* user = | 968 const user_manager::User* user = |
| 961 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | 969 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); |
| 962 if (!user) { | 970 if (!user) { |
| 963 LOG(WARNING) << "Failed to find user for current profile."; | 971 LOG(WARNING) << "Failed to find user for current profile."; |
| 964 } else { | 972 } else { |
| 965 chromeos::DBusThreadManager::Get() | 973 chromeos::DBusThreadManager::Get() |
| 966 ->GetCryptohomeClient() | 974 ->GetCryptohomeClient() |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1096 break; | 1104 break; |
| 1097 case EVERYTHING: | 1105 case EVERYTHING: |
| 1098 delete_begin_time = base::Time(); | 1106 delete_begin_time = base::Time(); |
| 1099 break; | 1107 break; |
| 1100 } | 1108 } |
| 1101 return delete_begin_time - diff; | 1109 return delete_begin_time - diff; |
| 1102 } | 1110 } |
| 1103 | 1111 |
| 1104 bool BrowsingDataRemover::AllDone() { | 1112 bool BrowsingDataRemover::AllDone() { |
| 1105 return !waiting_for_clear_autofill_origin_urls_ && | 1113 return !waiting_for_clear_autofill_origin_urls_ && |
| 1106 !waiting_for_clear_cache_ && !waiting_for_clear_content_licenses_ && | 1114 !waiting_for_clear_cache_ && |
| 1115 !waiting_for_clear_flash_content_licenses_ && | |
| 1107 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && | 1116 !waiting_for_clear_channel_ids_ && !waiting_for_clear_cookies_count_ && |
| 1108 !waiting_for_clear_domain_reliability_monitor_ && | 1117 !waiting_for_clear_domain_reliability_monitor_ && |
| 1109 !waiting_for_clear_form_ && !waiting_for_clear_history_ && | 1118 !waiting_for_clear_form_ && !waiting_for_clear_history_ && |
| 1110 !waiting_for_clear_hostname_resolution_cache_ && | 1119 !waiting_for_clear_hostname_resolution_cache_ && |
| 1111 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && | 1120 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && |
| 1112 !waiting_for_clear_network_predictor_ && | 1121 !waiting_for_clear_network_predictor_ && |
| 1113 !waiting_for_clear_networking_history_ && | 1122 !waiting_for_clear_networking_history_ && |
| 1114 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && | 1123 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && |
| 1115 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && | 1124 !waiting_for_clear_platform_keys_ && !waiting_for_clear_plugin_data_ && |
| 1116 !waiting_for_clear_pnacl_cache_ && | 1125 !waiting_for_clear_pnacl_cache_ && |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1215 #if defined(ENABLE_PLUGINS) | 1224 #if defined(ENABLE_PLUGINS) |
| 1216 void BrowsingDataRemover::OnWaitableEventSignaled( | 1225 void BrowsingDataRemover::OnWaitableEventSignaled( |
| 1217 base::WaitableEvent* waitable_event) { | 1226 base::WaitableEvent* waitable_event) { |
| 1218 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1227 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1219 waiting_for_clear_plugin_data_ = false; | 1228 waiting_for_clear_plugin_data_ = false; |
| 1220 plugin_data_remover_.reset(); | 1229 plugin_data_remover_.reset(); |
| 1221 watcher_.StopWatching(); | 1230 watcher_.StopWatching(); |
| 1222 NotifyIfDone(); | 1231 NotifyIfDone(); |
| 1223 } | 1232 } |
| 1224 | 1233 |
| 1225 void BrowsingDataRemover::OnDeauthorizeContentLicensesCompleted( | 1234 void BrowsingDataRemover::OnDeauthorizeContentLicensesCompleted( |
|
xhwang
2016/06/17 06:24:29
OnDeauthorizeFlashContentLicensesCompleted
jrummell
2016/06/21 00:13:43
Done.
| |
| 1226 uint32_t request_id, | 1235 uint32_t request_id, |
| 1227 bool /* success */) { | 1236 bool /* success */) { |
| 1228 DCHECK(waiting_for_clear_content_licenses_); | 1237 DCHECK(waiting_for_clear_flash_content_licenses_); |
| 1229 DCHECK_EQ(request_id, deauthorize_content_licenses_request_id_); | 1238 DCHECK_EQ(request_id, deauthorize_content_licenses_request_id_); |
| 1230 | 1239 |
| 1231 waiting_for_clear_content_licenses_ = false; | 1240 waiting_for_clear_flash_content_licenses_ = false; |
| 1232 NotifyIfDone(); | 1241 NotifyIfDone(); |
| 1233 } | 1242 } |
| 1234 #endif | 1243 #endif |
| 1235 | 1244 |
| 1236 #if defined(OS_CHROMEOS) | 1245 #if defined(OS_CHROMEOS) |
| 1237 void BrowsingDataRemover::OnClearPlatformKeys( | 1246 void BrowsingDataRemover::OnClearPlatformKeys( |
| 1238 chromeos::DBusMethodCallStatus call_status, | 1247 chromeos::DBusMethodCallStatus call_status, |
| 1239 bool result) { | 1248 bool result) { |
| 1240 DCHECK(waiting_for_clear_platform_keys_); | 1249 DCHECK(waiting_for_clear_platform_keys_); |
| 1241 LOG_IF(ERROR, call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || !result) | 1250 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; | 1345 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1337 NotifyIfDone(); | 1346 NotifyIfDone(); |
| 1338 } | 1347 } |
| 1339 | 1348 |
| 1340 // static | 1349 // static |
| 1341 BrowsingDataRemover::CallbackSubscription | 1350 BrowsingDataRemover::CallbackSubscription |
| 1342 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1351 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 1343 const BrowsingDataRemover::Callback& callback) { | 1352 const BrowsingDataRemover::Callback& callback) { |
| 1344 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1353 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 1345 } | 1354 } |
| OLD | NEW |