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