Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 72613006: Eliminate AutofillWebDataService::FromBrowserContext(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 #include "chrome/browser/prerender/prerender_manager_factory.h" 40 #include "chrome/browser/prerender/prerender_manager_factory.h"
41 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
42 #include "chrome/browser/renderer_host/web_cache_manager.h" 42 #include "chrome/browser/renderer_host/web_cache_manager.h"
43 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 43 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
44 #include "chrome/browser/search_engines/template_url_service.h" 44 #include "chrome/browser/search_engines/template_url_service.h"
45 #include "chrome/browser/search_engines/template_url_service_factory.h" 45 #include "chrome/browser/search_engines/template_url_service_factory.h"
46 #include "chrome/browser/sessions/session_service.h" 46 #include "chrome/browser/sessions/session_service.h"
47 #include "chrome/browser/sessions/session_service_factory.h" 47 #include "chrome/browser/sessions/session_service_factory.h"
48 #include "chrome/browser/sessions/tab_restore_service.h" 48 #include "chrome/browser/sessions/tab_restore_service.h"
49 #include "chrome/browser/sessions/tab_restore_service_factory.h" 49 #include "chrome/browser/sessions/tab_restore_service_factory.h"
50 #include "chrome/browser/webdata/web_data_service_factory.h"
50 #include "chrome/common/pref_names.h" 51 #include "chrome/common/pref_names.h"
51 #include "chrome/common/url_constants.h" 52 #include "chrome/common/url_constants.h"
52 #if defined(OS_CHROMEOS) 53 #if defined(OS_CHROMEOS)
53 #include "chromeos/attestation/attestation_constants.h" 54 #include "chromeos/attestation/attestation_constants.h"
54 #include "chromeos/dbus/cryptohome_client.h" 55 #include "chromeos/dbus/cryptohome_client.h"
55 #include "chromeos/dbus/dbus_thread_manager.h" 56 #include "chromeos/dbus/dbus_thread_manager.h"
56 #endif 57 #endif
57 #include "components/autofill/core/browser/personal_data_manager.h" 58 #include "components/autofill/core/browser/personal_data_manager.h"
58 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 59 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
59 #include "components/nacl/browser/nacl_browser.h" 60 #include "components/nacl/browser/nacl_browser.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
357 profile_, Profile::EXPLICIT_ACCESS);
356 if (web_data_service.get()) { 358 if (web_data_service.get()) {
357 waiting_for_clear_autofill_origin_urls_ = true; 359 waiting_for_clear_autofill_origin_urls_ = true;
358 web_data_service->RemoveOriginURLsModifiedBetween( 360 web_data_service->RemoveOriginURLsModifiedBetween(
359 delete_begin_, delete_end_); 361 delete_begin_, delete_end_);
360 // The above calls are done on the UI thread but do their work on the DB 362 // The above calls are done on the UI thread but do their work on the DB
361 // thread. So wait for it. 363 // thread. So wait for it.
362 BrowserThread::PostTaskAndReply( 364 BrowserThread::PostTaskAndReply(
363 BrowserThread::DB, FROM_HERE, 365 BrowserThread::DB, FROM_HERE,
364 base::Bind(&base::DoNothing), 366 base::Bind(&base::DoNothing),
365 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs, 367 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( 488 PasswordStore* password_store = PasswordStoreFactory::GetForProfile(
487 profile_, Profile::EXPLICIT_ACCESS).get(); 489 profile_, Profile::EXPLICIT_ACCESS).get();
488 490
489 if (password_store) 491 if (password_store)
490 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); 492 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_);
491 } 493 }
492 494
493 if (remove_mask & REMOVE_FORM_DATA) { 495 if (remove_mask & REMOVE_FORM_DATA) {
494 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); 496 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill"));
495 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 497 scoped_refptr<autofill::AutofillWebDataService> web_data_service =
496 autofill::AutofillWebDataService::FromBrowserContext(profile_); 498 WebDataServiceFactory::GetAutofillWebDataForProfile(
499 profile_, Profile::EXPLICIT_ACCESS);
497 500
498 if (web_data_service.get()) { 501 if (web_data_service.get()) {
499 waiting_for_clear_form_ = true; 502 waiting_for_clear_form_ = true;
500 web_data_service->RemoveFormElementsAddedBetween(delete_begin_, 503 web_data_service->RemoveFormElementsAddedBetween(delete_begin_,
501 delete_end_); 504 delete_end_);
502 web_data_service->RemoveAutofillDataModifiedBetween( 505 web_data_service->RemoveAutofillDataModifiedBetween(
503 delete_begin_, delete_end_); 506 delete_begin_, delete_end_);
504 // The above calls are done on the UI thread but do their work on the DB 507 // The above calls are done on the UI thread but do their work on the DB
505 // thread. So wait for it. 508 // thread. So wait for it.
506 BrowserThread::PostTaskAndReply( 509 BrowserThread::PostTaskAndReply(
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1060 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1058 waiting_for_clear_autofill_origin_urls_ = false; 1061 waiting_for_clear_autofill_origin_urls_ = false;
1059 NotifyAndDeleteIfDone(); 1062 NotifyAndDeleteIfDone();
1060 } 1063 }
1061 1064
1062 void BrowsingDataRemover::OnClearedStoragePartitionData() { 1065 void BrowsingDataRemover::OnClearedStoragePartitionData() {
1063 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1066 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1064 waiting_for_clear_storage_partition_data_ = false; 1067 waiting_for_clear_storage_partition_data_ = false;
1065 NotifyAndDeleteIfDone(); 1068 NotifyAndDeleteIfDone();
1066 } 1069 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/personal_data_manager_factory.cc ('k') | chrome/browser/sync/glue/autofill_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698