| 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 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/browser/prerender/prerender_manager_factory.h" | 41 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 42 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
| 43 #include "chrome/browser/renderer_host/web_cache_manager.h" | 43 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 44 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 44 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 45 #include "chrome/browser/search_engines/template_url_service.h" | 45 #include "chrome/browser/search_engines/template_url_service.h" |
| 46 #include "chrome/browser/search_engines/template_url_service_factory.h" | 46 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 47 #include "chrome/browser/sessions/session_service.h" | 47 #include "chrome/browser/sessions/session_service.h" |
| 48 #include "chrome/browser/sessions/session_service_factory.h" | 48 #include "chrome/browser/sessions/session_service_factory.h" |
| 49 #include "chrome/browser/sessions/tab_restore_service.h" | 49 #include "chrome/browser/sessions/tab_restore_service.h" |
| 50 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 50 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 51 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 51 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
| 52 #include "chrome/common/url_constants.h" | 53 #include "chrome/common/url_constants.h" |
| 53 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
| 54 #include "chromeos/attestation/attestation_constants.h" | 55 #include "chromeos/attestation/attestation_constants.h" |
| 55 #include "chromeos/dbus/cryptohome_client.h" | 56 #include "chromeos/dbus/cryptohome_client.h" |
| 56 #include "chromeos/dbus/dbus_thread_manager.h" | 57 #include "chromeos/dbus/dbus_thread_manager.h" |
| 57 #endif | 58 #endif |
| 58 #include "components/autofill/core/browser/personal_data_manager.h" | 59 #include "components/autofill/core/browser/personal_data_manager.h" |
| 59 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 60 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 60 #include "components/nacl/browser/nacl_browser.h" | 61 #include "components/nacl/browser/nacl_browser.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 SessionServiceFactory::GetForProfile(profile_); | 346 SessionServiceFactory::GetForProfile(profile_); |
| 346 if (session_service) | 347 if (session_service) |
| 347 session_service->DeleteLastSession(); | 348 session_service->DeleteLastSession(); |
| 348 #endif | 349 #endif |
| 349 } | 350 } |
| 350 | 351 |
| 351 // The saved Autofill profiles and credit cards can include the origin from | 352 // The saved Autofill profiles and credit cards can include the origin from |
| 352 // which these profiles and credit cards were learned. These are a form of | 353 // which these profiles and credit cards were learned. These are a form of |
| 353 // history, so clear them as well. | 354 // history, so clear them as well. |
| 354 scoped_refptr<autofill::AutofillWebDataService> web_data_service = | 355 scoped_refptr<autofill::AutofillWebDataService> web_data_service = |
| 355 autofill::AutofillWebDataService::FromBrowserContext(profile_); | 356 WebDataServiceFactory::GetAutofillWebDataForProfile(profile_); |
| 356 if (web_data_service.get()) { | 357 if (web_data_service.get()) { |
| 357 waiting_for_clear_autofill_origin_urls_ = true; | 358 waiting_for_clear_autofill_origin_urls_ = true; |
| 358 web_data_service->RemoveOriginURLsModifiedBetween( | 359 web_data_service->RemoveOriginURLsModifiedBetween( |
| 359 delete_begin_, delete_end_); | 360 delete_begin_, delete_end_); |
| 360 // The above calls are done on the UI thread but do their work on the DB | 361 // The above calls are done on the UI thread but do their work on the DB |
| 361 // thread. So wait for it. | 362 // thread. So wait for it. |
| 362 BrowserThread::PostTaskAndReply( | 363 BrowserThread::PostTaskAndReply( |
| 363 BrowserThread::DB, FROM_HERE, | 364 BrowserThread::DB, FROM_HERE, |
| 364 base::Bind(&base::DoNothing), | 365 base::Bind(&base::DoNothing), |
| 365 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs, | 366 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( | 487 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( |
| 487 profile_, Profile::EXPLICIT_ACCESS).get(); | 488 profile_, Profile::EXPLICIT_ACCESS).get(); |
| 488 | 489 |
| 489 if (password_store) | 490 if (password_store) |
| 490 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); | 491 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); |
| 491 } | 492 } |
| 492 | 493 |
| 493 if (remove_mask & REMOVE_FORM_DATA) { | 494 if (remove_mask & REMOVE_FORM_DATA) { |
| 494 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); | 495 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); |
| 495 scoped_refptr<autofill::AutofillWebDataService> web_data_service = | 496 scoped_refptr<autofill::AutofillWebDataService> web_data_service = |
| 496 autofill::AutofillWebDataService::FromBrowserContext(profile_); | 497 WebDataServiceFactory::GetAutofillWebDataForProfile(profile_); |
| 497 | 498 |
| 498 if (web_data_service.get()) { | 499 if (web_data_service.get()) { |
| 499 waiting_for_clear_form_ = true; | 500 waiting_for_clear_form_ = true; |
| 500 web_data_service->RemoveFormElementsAddedBetween(delete_begin_, | 501 web_data_service->RemoveFormElementsAddedBetween(delete_begin_, |
| 501 delete_end_); | 502 delete_end_); |
| 502 web_data_service->RemoveAutofillDataModifiedBetween( | 503 web_data_service->RemoveAutofillDataModifiedBetween( |
| 503 delete_begin_, delete_end_); | 504 delete_begin_, delete_end_); |
| 504 // The above calls are done on the UI thread but do their work on the DB | 505 // The above calls are done on the UI thread but do their work on the DB |
| 505 // thread. So wait for it. | 506 // thread. So wait for it. |
| 506 BrowserThread::PostTaskAndReply( | 507 BrowserThread::PostTaskAndReply( |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1058 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1058 waiting_for_clear_autofill_origin_urls_ = false; | 1059 waiting_for_clear_autofill_origin_urls_ = false; |
| 1059 NotifyAndDeleteIfDone(); | 1060 NotifyAndDeleteIfDone(); |
| 1060 } | 1061 } |
| 1061 | 1062 |
| 1062 void BrowsingDataRemover::OnClearedStoragePartitionData() { | 1063 void BrowsingDataRemover::OnClearedStoragePartitionData() { |
| 1063 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1064 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1064 waiting_for_clear_storage_partition_data_ = false; | 1065 waiting_for_clear_storage_partition_data_ = false; |
| 1065 NotifyAndDeleteIfDone(); | 1066 NotifyAndDeleteIfDone(); |
| 1066 } | 1067 } |
| OLD | NEW |