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/logging.h" | 13 #include "base/logging.h" |
14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 16 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
19 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 19 #include "chrome/browser/download/download_prefs.h" |
20 #include "chrome/browser/download/download_service.h" | |
21 #include "chrome/browser/download/download_service_factory.h" | 20 #include "chrome/browser/download/download_service_factory.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 22 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
24 #include "chrome/browser/history/history_service.h" | 23 #include "chrome/browser/history/history_service.h" |
25 #include "chrome/browser/history/history_service_factory.h" | 24 #include "chrome/browser/history/history_service_factory.h" |
26 #include "chrome/browser/io_thread.h" | 25 #include "chrome/browser/io_thread.h" |
27 #include "chrome/browser/nacl_host/nacl_browser.h" | 26 #include "chrome/browser/nacl_host/nacl_browser.h" |
28 #include "chrome/browser/net/chrome_url_request_context.h" | 27 #include "chrome/browser/net/chrome_url_request_context.h" |
29 #include "chrome/browser/net/predictor.h" | 28 #include "chrome/browser/net/predictor.h" |
30 #include "chrome/browser/password_manager/password_store.h" | 29 #include "chrome/browser/password_manager/password_store.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "net/url_request/url_request_context.h" | 64 #include "net/url_request/url_request_context.h" |
66 #include "net/url_request/url_request_context_getter.h" | 65 #include "net/url_request/url_request_context_getter.h" |
67 #include "webkit/dom_storage/dom_storage_types.h" | 66 #include "webkit/dom_storage/dom_storage_types.h" |
68 #include "webkit/quota/quota_manager.h" | 67 #include "webkit/quota/quota_manager.h" |
69 #include "webkit/quota/quota_types.h" | 68 #include "webkit/quota/quota_types.h" |
70 #include "webkit/quota/special_storage_policy.h" | 69 #include "webkit/quota/special_storage_policy.h" |
71 | 70 |
72 using content::BrowserContext; | 71 using content::BrowserContext; |
73 using content::BrowserThread; | 72 using content::BrowserThread; |
74 using content::DOMStorageContext; | 73 using content::DOMStorageContext; |
75 using content::DownloadManager; | |
76 using content::UserMetricsAction; | 74 using content::UserMetricsAction; |
77 | 75 |
78 bool BrowsingDataRemover::is_removing_ = false; | 76 bool BrowsingDataRemover::is_removing_ = false; |
79 | 77 |
80 BrowsingDataRemover::NotificationDetails::NotificationDetails() | 78 BrowsingDataRemover::NotificationDetails::NotificationDetails() |
81 : removal_begin(base::Time()), | 79 : removal_begin(base::Time()), |
82 removal_mask(-1), | 80 removal_mask(-1), |
83 origin_set_mask(-1) { | 81 origin_set_mask(-1) { |
84 } | 82 } |
85 | 83 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 autofill::PersonalDataManager* data_manager = | 331 autofill::PersonalDataManager* data_manager = |
334 autofill::PersonalDataManagerFactory::GetForProfile(profile_); | 332 autofill::PersonalDataManagerFactory::GetForProfile(profile_); |
335 if (data_manager) | 333 if (data_manager) |
336 data_manager->Refresh(); | 334 data_manager->Refresh(); |
337 } | 335 } |
338 | 336 |
339 } | 337 } |
340 | 338 |
341 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { | 339 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { |
342 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); | 340 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); |
343 DownloadManager* download_manager = | 341 content::DownloadManager* download_manager = |
344 BrowserContext::GetDownloadManager(profile_); | 342 BrowserContext::GetDownloadManager(profile_); |
345 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); | 343 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); |
346 DownloadService* download_service = | 344 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( |
347 DownloadServiceFactory::GetForProfile(profile_); | 345 download_manager); |
348 ChromeDownloadManagerDelegate* download_manager_delegate = | 346 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); |
349 download_service->GetDownloadManagerDelegate(); | |
350 download_manager_delegate->ClearLastDownloadPath(); | |
351 } | 347 } |
352 | 348 |
353 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, | 349 // We ignore the REMOVE_COOKIES request if UNPROTECTED_WEB is not set, |
354 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB | 350 // so that callers who request REMOVE_SITE_DATA with PROTECTED_WEB |
355 // don't accidentally remove the cookies that are associated with the | 351 // don't accidentally remove the cookies that are associated with the |
356 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | 352 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated |
357 // between UNPROTECTED_WEB and PROTECTED_WEB. | 353 // between UNPROTECTED_WEB and PROTECTED_WEB. |
358 if (remove_mask & REMOVE_COOKIES && | 354 if (remove_mask & REMOVE_COOKIES && |
359 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 355 origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
360 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); | 356 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1093 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1098 waiting_for_clear_form_ = false; | 1094 waiting_for_clear_form_ = false; |
1099 NotifyAndDeleteIfDone(); | 1095 NotifyAndDeleteIfDone(); |
1100 } | 1096 } |
1101 | 1097 |
1102 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { | 1098 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { |
1103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1099 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1104 waiting_for_clear_autofill_origin_urls_ = false; | 1100 waiting_for_clear_autofill_origin_urls_ = false; |
1105 NotifyAndDeleteIfDone(); | 1101 NotifyAndDeleteIfDone(); |
1106 } | 1102 } |
OLD | NEW |