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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/browser/sessions/session_service_factory.h" | 43 #include "chrome/browser/sessions/session_service_factory.h" |
44 #include "chrome/browser/sessions/tab_restore_service.h" | 44 #include "chrome/browser/sessions/tab_restore_service.h" |
45 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 45 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
46 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
47 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
48 #include "components/autofill/core/browser/personal_data_manager.h" | 48 #include "components/autofill/core/browser/personal_data_manager.h" |
49 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 49 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
50 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
51 #include "content/public/browser/dom_storage_context.h" | 51 #include "content/public/browser/dom_storage_context.h" |
52 #include "content/public/browser/download_manager.h" | 52 #include "content/public/browser/download_manager.h" |
| 53 #include "content/public/browser/local_storage_usage_info.h" |
53 #include "content/public/browser/notification_service.h" | 54 #include "content/public/browser/notification_service.h" |
54 #include "content/public/browser/plugin_data_remover.h" | 55 #include "content/public/browser/plugin_data_remover.h" |
| 56 #include "content/public/browser/session_storage_usage_info.h" |
55 #include "content/public/browser/storage_partition.h" | 57 #include "content/public/browser/storage_partition.h" |
56 #include "content/public/browser/user_metrics.h" | 58 #include "content/public/browser/user_metrics.h" |
57 #include "net/base/net_errors.h" | 59 #include "net/base/net_errors.h" |
58 #include "net/cookies/cookie_store.h" | 60 #include "net/cookies/cookie_store.h" |
59 #include "net/disk_cache/disk_cache.h" | 61 #include "net/disk_cache/disk_cache.h" |
60 #include "net/http/http_cache.h" | 62 #include "net/http/http_cache.h" |
61 #include "net/http/transport_security_state.h" | 63 #include "net/http/transport_security_state.h" |
62 #include "net/ssl/server_bound_cert_service.h" | 64 #include "net/ssl/server_bound_cert_service.h" |
63 #include "net/ssl/server_bound_cert_store.h" | 65 #include "net/ssl/server_bound_cert_store.h" |
64 #include "net/url_request/url_request_context.h" | 66 #include "net/url_request/url_request_context.h" |
65 #include "net/url_request/url_request_context_getter.h" | 67 #include "net/url_request/url_request_context_getter.h" |
66 #include "webkit/browser/quota/quota_manager.h" | 68 #include "webkit/browser/quota/quota_manager.h" |
67 #include "webkit/browser/quota/special_storage_policy.h" | 69 #include "webkit/browser/quota/special_storage_policy.h" |
68 #include "webkit/common/dom_storage/dom_storage_types.h" | |
69 #include "webkit/common/quota/quota_types.h" | 70 #include "webkit/common/quota/quota_types.h" |
70 | 71 |
71 using content::BrowserContext; | 72 using content::BrowserContext; |
72 using content::BrowserThread; | 73 using content::BrowserThread; |
73 using content::DOMStorageContext; | 74 using content::DOMStorageContext; |
74 using content::UserMetricsAction; | 75 using content::UserMetricsAction; |
75 | 76 |
76 bool BrowsingDataRemover::is_removing_ = false; | 77 bool BrowsingDataRemover::is_removing_ = false; |
77 | 78 |
78 BrowsingDataRemover::NotificationDetails::NotificationDetails() | 79 BrowsingDataRemover::NotificationDetails::NotificationDetails() |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 | 890 |
890 void BrowsingDataRemover::ClearLocalStorageOnUIThread() { | 891 void BrowsingDataRemover::ClearLocalStorageOnUIThread() { |
891 DCHECK(waiting_for_clear_local_storage_); | 892 DCHECK(waiting_for_clear_local_storage_); |
892 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 893 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
893 dom_storage_context_->GetLocalStorageUsage( | 894 dom_storage_context_->GetLocalStorageUsage( |
894 base::Bind(&BrowsingDataRemover::OnGotLocalStorageUsageInfo, | 895 base::Bind(&BrowsingDataRemover::OnGotLocalStorageUsageInfo, |
895 base::Unretained(this))); | 896 base::Unretained(this))); |
896 } | 897 } |
897 | 898 |
898 void BrowsingDataRemover::OnGotLocalStorageUsageInfo( | 899 void BrowsingDataRemover::OnGotLocalStorageUsageInfo( |
899 const std::vector<dom_storage::LocalStorageUsageInfo>& infos) { | 900 const std::vector<content::LocalStorageUsageInfo>& infos) { |
900 DCHECK(waiting_for_clear_local_storage_); | 901 DCHECK(waiting_for_clear_local_storage_); |
901 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 902 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
902 | 903 |
903 for (size_t i = 0; i < infos.size(); ++i) { | 904 for (size_t i = 0; i < infos.size(); ++i) { |
904 if (!BrowsingDataHelper::DoesOriginMatchMask( | 905 if (!BrowsingDataHelper::DoesOriginMatchMask( |
905 infos[i].origin, origin_set_mask_, special_storage_policy_.get())) | 906 infos[i].origin, origin_set_mask_, special_storage_policy_.get())) |
906 continue; | 907 continue; |
907 | 908 |
908 if (infos[i].last_modified >= delete_begin_ && | 909 if (infos[i].last_modified >= delete_begin_ && |
909 infos[i].last_modified <= delete_end_) { | 910 infos[i].last_modified <= delete_end_) { |
910 dom_storage_context_->DeleteLocalStorage(infos[i].origin); | 911 dom_storage_context_->DeleteLocalStorage(infos[i].origin); |
911 } | 912 } |
912 } | 913 } |
913 waiting_for_clear_local_storage_ = false; | 914 waiting_for_clear_local_storage_ = false; |
914 NotifyAndDeleteIfDone(); | 915 NotifyAndDeleteIfDone(); |
915 } | 916 } |
916 | 917 |
917 void BrowsingDataRemover::ClearSessionStorageOnUIThread() { | 918 void BrowsingDataRemover::ClearSessionStorageOnUIThread() { |
918 DCHECK(waiting_for_clear_session_storage_); | 919 DCHECK(waiting_for_clear_session_storage_); |
919 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
920 | 921 |
921 dom_storage_context_->GetSessionStorageUsage( | 922 dom_storage_context_->GetSessionStorageUsage( |
922 base::Bind(&BrowsingDataRemover::OnGotSessionStorageUsageInfo, | 923 base::Bind(&BrowsingDataRemover::OnGotSessionStorageUsageInfo, |
923 base::Unretained(this))); | 924 base::Unretained(this))); |
924 } | 925 } |
925 | 926 |
926 void BrowsingDataRemover::OnGotSessionStorageUsageInfo( | 927 void BrowsingDataRemover::OnGotSessionStorageUsageInfo( |
927 const std::vector<dom_storage::SessionStorageUsageInfo>& infos) { | 928 const std::vector<content::SessionStorageUsageInfo>& infos) { |
928 DCHECK(waiting_for_clear_session_storage_); | 929 DCHECK(waiting_for_clear_session_storage_); |
929 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 930 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
930 | 931 |
931 for (size_t i = 0; i < infos.size(); ++i) { | 932 for (size_t i = 0; i < infos.size(); ++i) { |
932 if (!BrowsingDataHelper::DoesOriginMatchMask( | 933 if (!BrowsingDataHelper::DoesOriginMatchMask( |
933 infos[i].origin, origin_set_mask_, special_storage_policy_.get())) | 934 infos[i].origin, origin_set_mask_, special_storage_policy_.get())) |
934 continue; | 935 continue; |
935 | 936 |
936 dom_storage_context_->DeleteSessionStorage(infos[i]); | 937 dom_storage_context_->DeleteSessionStorage(infos[i]); |
937 } | 938 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1116 waiting_for_clear_form_ = false; | 1117 waiting_for_clear_form_ = false; |
1117 NotifyAndDeleteIfDone(); | 1118 NotifyAndDeleteIfDone(); |
1118 } | 1119 } |
1119 | 1120 |
1120 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { | 1121 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { |
1121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1122 waiting_for_clear_autofill_origin_urls_ = false; | 1123 waiting_for_clear_autofill_origin_urls_ = false; |
1123 NotifyAndDeleteIfDone(); | 1124 NotifyAndDeleteIfDone(); |
1124 } | 1125 } |
OLD | NEW |