| 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_remover.h" | 5 #include "chrome/browser/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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 16 #include "chrome/browser/autofill/personal_data_manager.h" | 16 #include "chrome/browser/autofill/personal_data_manager.h" |
| 17 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 17 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browsing_data_helper.h" | 19 #include "chrome/browser/browsing_data_helper.h" |
| 20 #include "chrome/browser/download/download_service.h" | 20 #include "chrome/browser/download/download_service.h" |
| 21 #include "chrome/browser/download/download_service_factory.h" | 21 #include "chrome/browser/download/download_service_factory.h" |
| 22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 24 #include "chrome/browser/history/history.h" | 24 #include "chrome/browser/history/history.h" |
| 25 #include "chrome/browser/history/history_service_factory.h" |
| 25 #include "chrome/browser/io_thread.h" | 26 #include "chrome/browser/io_thread.h" |
| 26 #include "chrome/browser/nacl_host/nacl_browser.h" | 27 #include "chrome/browser/nacl_host/nacl_browser.h" |
| 27 #include "chrome/browser/net/chrome_url_request_context.h" | 28 #include "chrome/browser/net/chrome_url_request_context.h" |
| 28 #include "chrome/browser/net/predictor.h" | 29 #include "chrome/browser/net/predictor.h" |
| 29 #include "chrome/browser/password_manager/password_store.h" | 30 #include "chrome/browser/password_manager/password_store.h" |
| 30 #include "chrome/browser/password_manager/password_store_factory.h" | 31 #include "chrome/browser/password_manager/password_store_factory.h" |
| 31 #include "chrome/browser/prefs/pref_member.h" | 32 #include "chrome/browser/prefs/pref_member.h" |
| 32 #include "chrome/browser/prerender/prerender_manager.h" | 33 #include "chrome/browser/prerender/prerender_manager.h" |
| 33 #include "chrome/browser/prerender/prerender_manager_factory.h" | 34 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 211 } |
| 211 // If this fires, we added a new BrowsingDataHelper::OriginSetMask without | 212 // If this fires, we added a new BrowsingDataHelper::OriginSetMask without |
| 212 // updating the user metrics above. | 213 // updating the user metrics above. |
| 213 COMPILE_ASSERT( | 214 COMPILE_ASSERT( |
| 214 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | | 215 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | |
| 215 BrowsingDataHelper::PROTECTED_WEB | | 216 BrowsingDataHelper::PROTECTED_WEB | |
| 216 BrowsingDataHelper::EXTENSION), | 217 BrowsingDataHelper::EXTENSION), |
| 217 forgotten_to_add_origin_mask_type); | 218 forgotten_to_add_origin_mask_type); |
| 218 | 219 |
| 219 if (remove_mask & REMOVE_HISTORY) { | 220 if (remove_mask & REMOVE_HISTORY) { |
| 220 HistoryService* history_service = | 221 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
| 221 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 222 profile_, Profile::EXPLICIT_ACCESS); |
| 222 if (history_service) { | 223 if (history_service) { |
| 223 std::set<GURL> restrict_urls; | 224 std::set<GURL> restrict_urls; |
| 224 if (!remove_origin_.is_empty()) | 225 if (!remove_origin_.is_empty()) |
| 225 restrict_urls.insert(remove_origin_); | 226 restrict_urls.insert(remove_origin_); |
| 226 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | 227 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); |
| 227 waiting_for_clear_history_ = true; | 228 waiting_for_clear_history_ = true; |
| 228 history_service->ExpireHistoryBetween(restrict_urls, | 229 history_service->ExpireHistoryBetween(restrict_urls, |
| 229 delete_begin_, delete_end_, | 230 delete_begin_, delete_end_, |
| 230 &request_consumer_, | 231 &request_consumer_, |
| 231 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, | 232 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 BrowserThread::UI, FROM_HERE, | 878 BrowserThread::UI, FROM_HERE, |
| 878 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, | 879 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, |
| 879 base::Unretained(this))); | 880 base::Unretained(this))); |
| 880 } | 881 } |
| 881 | 882 |
| 882 void BrowsingDataRemover::OnClearedServerBoundCerts() { | 883 void BrowsingDataRemover::OnClearedServerBoundCerts() { |
| 883 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 884 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 884 waiting_for_clear_server_bound_certs_ = false; | 885 waiting_for_clear_server_bound_certs_ = false; |
| 885 NotifyAndDeleteIfDone(); | 886 NotifyAndDeleteIfDone(); |
| 886 } | 887 } |
| OLD | NEW |