| 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" |
| 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 "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.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/browsing_data_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 20 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 20 #include "chrome/browser/download/download_prefs.h" |
| 21 #include "chrome/browser/download/download_service.h" | |
| 22 #include "chrome/browser/download/download_service_factory.h" | 21 #include "chrome/browser/download/download_service_factory.h" |
| 23 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 24 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 25 #include "chrome/browser/history/history_service.h" | 24 #include "chrome/browser/history/history_service.h" |
| 26 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
| 27 #include "chrome/browser/io_thread.h" | 26 #include "chrome/browser/io_thread.h" |
| 28 #include "chrome/browser/nacl_host/nacl_browser.h" | 27 #include "chrome/browser/nacl_host/nacl_browser.h" |
| 29 #include "chrome/browser/net/chrome_url_request_context.h" | 28 #include "chrome/browser/net/chrome_url_request_context.h" |
| 30 #include "chrome/browser/net/predictor.h" | 29 #include "chrome/browser/net/predictor.h" |
| 31 #include "chrome/browser/password_manager/password_store.h" | 30 #include "chrome/browser/password_manager/password_store.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "net/url_request/url_request_context.h" | 65 #include "net/url_request/url_request_context.h" |
| 67 #include "net/url_request/url_request_context_getter.h" | 66 #include "net/url_request/url_request_context_getter.h" |
| 68 #include "webkit/dom_storage/dom_storage_types.h" | 67 #include "webkit/dom_storage/dom_storage_types.h" |
| 69 #include "webkit/quota/quota_manager.h" | 68 #include "webkit/quota/quota_manager.h" |
| 70 #include "webkit/quota/quota_types.h" | 69 #include "webkit/quota/quota_types.h" |
| 71 #include "webkit/quota/special_storage_policy.h" | 70 #include "webkit/quota/special_storage_policy.h" |
| 72 | 71 |
| 73 using content::BrowserContext; | 72 using content::BrowserContext; |
| 74 using content::BrowserThread; | 73 using content::BrowserThread; |
| 75 using content::DOMStorageContext; | 74 using content::DOMStorageContext; |
| 76 using content::DownloadManager; | |
| 77 using content::UserMetricsAction; | 75 using content::UserMetricsAction; |
| 78 | 76 |
| 79 bool BrowsingDataRemover::is_removing_ = false; | 77 bool BrowsingDataRemover::is_removing_ = false; |
| 80 | 78 |
| 81 BrowsingDataRemover::NotificationDetails::NotificationDetails() | 79 BrowsingDataRemover::NotificationDetails::NotificationDetails() |
| 82 : removal_begin(base::Time()), | 80 : removal_begin(base::Time()), |
| 83 removal_mask(-1), | 81 removal_mask(-1), |
| 84 origin_set_mask(-1) { | 82 origin_set_mask(-1) { |
| 85 } | 83 } |
| 86 | 84 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 SessionService* session_service = | 307 SessionService* session_service = |
| 310 SessionServiceFactory::GetForProfile(profile_); | 308 SessionServiceFactory::GetForProfile(profile_); |
| 311 if (session_service) | 309 if (session_service) |
| 312 session_service->DeleteLastSession(); | 310 session_service->DeleteLastSession(); |
| 313 #endif | 311 #endif |
| 314 } | 312 } |
| 315 } | 313 } |
| 316 | 314 |
| 317 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { | 315 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { |
| 318 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); | 316 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); |
| 319 DownloadManager* download_manager = | 317 content::DownloadManager* download_manager = |
| 320 BrowserContext::GetDownloadManager(profile_); | 318 BrowserContext::GetDownloadManager(profile_); |
| 321 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); | 319 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); |
| 322 DownloadService* download_service = | 320 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( |
| 323 DownloadServiceFactory::GetForProfile(profile_); | 321 download_manager); |
| 324 ChromeDownloadManagerDelegate* download_manager_delegate = | 322 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); |
| 325 download_service->GetDownloadManagerDelegate(); | |
| 326 download_manager_delegate->ClearLastDownloadPath(); | |
| 327 } | 323 } |
| 328 | 324 |
| 329 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, | 325 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, |
| 330 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB | 326 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB |
| 331 // don't accidentally remove the cookies that are associated with the | 327 // don't accidentally remove the cookies that are associated with the |
| 332 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | 328 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated |
| 333 // between UNPROTECTED_WEB and PROTECTED_WEB. | 329 // between UNPROTECTED_WEB and PROTECTED_WEB. |
| 334 if (remove_mask & REMOVE_COOKIES && | 330 if (remove_mask & REMOVE_COOKIES && |
| 335 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 331 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 336 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); | 332 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 BrowserThread::UI, FROM_HERE, | 1071 BrowserThread::UI, FROM_HERE, |
| 1076 base::Bind(&BrowsingDataRemover::OnClearedFormData, | 1072 base::Bind(&BrowsingDataRemover::OnClearedFormData, |
| 1077 base::Unretained(this))); | 1073 base::Unretained(this))); |
| 1078 } | 1074 } |
| 1079 | 1075 |
| 1080 void BrowsingDataRemover::OnClearedFormData() { | 1076 void BrowsingDataRemover::OnClearedFormData() { |
| 1081 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1077 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1082 waiting_for_clear_form_ = false; | 1078 waiting_for_clear_form_ = false; |
| 1083 NotifyAndDeleteIfDone(); | 1079 NotifyAndDeleteIfDone(); |
| 1084 } | 1080 } |
| OLD | NEW |