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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "build/build_config.h" |
17 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 22 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
22 #include "chrome/browser/domain_reliability/service_factory.h" | 23 #include "chrome/browser/domain_reliability/service_factory.h" |
23 #include "chrome/browser/download/download_prefs.h" | 24 #include "chrome/browser/download/download_prefs.h" |
24 #include "chrome/browser/download/download_service_factory.h" | 25 #include "chrome/browser/download/download_service_factory.h" |
25 #include "chrome/browser/history/history_service_factory.h" | 26 #include "chrome/browser/history/history_service_factory.h" |
26 #include "chrome/browser/history/web_history_service_factory.h" | 27 #include "chrome/browser/history/web_history_service_factory.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 if (remove_origin.unique()) | 470 if (remove_origin.unique()) |
470 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); | 471 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); |
471 else | 472 else |
472 download_manager->RemoveDownloadsByOriginAndTime( | 473 download_manager->RemoveDownloadsByOriginAndTime( |
473 remove_origin, delete_begin_, delete_end_); | 474 remove_origin, delete_begin_, delete_end_); |
474 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( | 475 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( |
475 download_manager); | 476 download_manager); |
476 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); | 477 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); |
477 } | 478 } |
478 | 479 |
479 uint32 storage_partition_remove_mask = 0; | 480 uint32_t storage_partition_remove_mask = 0; |
480 | 481 |
481 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, | 482 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, |
482 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB | 483 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB |
483 // don't accidentally remove the cookies that are associated with the | 484 // don't accidentally remove the cookies that are associated with the |
484 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | 485 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated |
485 // between UNPROTECTED_WEB and PROTECTED_WEB. | 486 // between UNPROTECTED_WEB and PROTECTED_WEB. |
486 if (remove_mask & REMOVE_COOKIES && | 487 if (remove_mask & REMOVE_COOKIES && |
487 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 488 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
488 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); | 489 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); |
489 | 490 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 702 |
702 if (storage_partition_remove_mask) { | 703 if (storage_partition_remove_mask) { |
703 waiting_for_clear_storage_partition_data_ = true; | 704 waiting_for_clear_storage_partition_data_ = true; |
704 | 705 |
705 content::StoragePartition* storage_partition; | 706 content::StoragePartition* storage_partition; |
706 if (storage_partition_for_testing_) | 707 if (storage_partition_for_testing_) |
707 storage_partition = storage_partition_for_testing_; | 708 storage_partition = storage_partition_for_testing_; |
708 else | 709 else |
709 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); | 710 storage_partition = BrowserContext::GetDefaultStoragePartition(profile_); |
710 | 711 |
711 uint32 quota_storage_remove_mask = | 712 uint32_t quota_storage_remove_mask = |
712 ~content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | 713 ~content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
713 | 714 |
714 if (delete_begin_ == base::Time() || | 715 if (delete_begin_ == base::Time() || |
715 origin_type_mask_ & | 716 origin_type_mask_ & |
716 (BrowsingDataHelper::PROTECTED_WEB | BrowsingDataHelper::EXTENSION)) { | 717 (BrowsingDataHelper::PROTECTED_WEB | BrowsingDataHelper::EXTENSION)) { |
717 // If we're deleting since the beginning of time, or we're removing | 718 // If we're deleting since the beginning of time, or we're removing |
718 // protected origins, then remove persistent quota data. | 719 // protected origins, then remove persistent quota data. |
719 quota_storage_remove_mask |= | 720 quota_storage_remove_mask |= |
720 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | 721 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
721 } | 722 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 #endif | 1059 #endif |
1059 | 1060 |
1060 void BrowsingDataRemover::OnWaitableEventSignaled( | 1061 void BrowsingDataRemover::OnWaitableEventSignaled( |
1061 base::WaitableEvent* waitable_event) { | 1062 base::WaitableEvent* waitable_event) { |
1062 waiting_for_clear_plugin_data_ = false; | 1063 waiting_for_clear_plugin_data_ = false; |
1063 NotifyAndDeleteIfDone(); | 1064 NotifyAndDeleteIfDone(); |
1064 } | 1065 } |
1065 | 1066 |
1066 #if defined(ENABLE_PLUGINS) | 1067 #if defined(ENABLE_PLUGINS) |
1067 void BrowsingDataRemover::OnDeauthorizeContentLicensesCompleted( | 1068 void BrowsingDataRemover::OnDeauthorizeContentLicensesCompleted( |
1068 uint32 request_id, | 1069 uint32_t request_id, |
1069 bool /* success */) { | 1070 bool /* success */) { |
1070 DCHECK(waiting_for_clear_content_licenses_); | 1071 DCHECK(waiting_for_clear_content_licenses_); |
1071 DCHECK_EQ(request_id, deauthorize_content_licenses_request_id_); | 1072 DCHECK_EQ(request_id, deauthorize_content_licenses_request_id_); |
1072 | 1073 |
1073 waiting_for_clear_content_licenses_ = false; | 1074 waiting_for_clear_content_licenses_ = false; |
1074 NotifyAndDeleteIfDone(); | 1075 NotifyAndDeleteIfDone(); |
1075 } | 1076 } |
1076 #endif | 1077 #endif |
1077 | 1078 |
1078 #if defined(OS_CHROMEOS) | 1079 #if defined(OS_CHROMEOS) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 waiting_for_clear_domain_reliability_monitor_ = false; | 1209 waiting_for_clear_domain_reliability_monitor_ = false; |
1209 NotifyAndDeleteIfDone(); | 1210 NotifyAndDeleteIfDone(); |
1210 } | 1211 } |
1211 | 1212 |
1212 // static | 1213 // static |
1213 BrowsingDataRemover::CallbackSubscription | 1214 BrowsingDataRemover::CallbackSubscription |
1214 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1215 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
1215 const BrowsingDataRemover::Callback& callback) { | 1216 const BrowsingDataRemover::Callback& callback) { |
1216 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1217 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
1217 } | 1218 } |
OLD | NEW |