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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 months 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
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 #include <string> 9 #include <string>
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // If this fires, we added a new BrowsingDataHelper::OriginSetMask without 274 // If this fires, we added a new BrowsingDataHelper::OriginSetMask without
275 // updating the user metrics above. 275 // updating the user metrics above.
276 static_assert( 276 static_assert(
277 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | 277 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB |
278 BrowsingDataHelper::PROTECTED_WEB | 278 BrowsingDataHelper::PROTECTED_WEB |
279 BrowsingDataHelper::EXTENSION), 279 BrowsingDataHelper::EXTENSION),
280 "OriginSetMask has been updated without updating user metrics"); 280 "OriginSetMask has been updated without updating user metrics");
281 281
282 if ((remove_mask & REMOVE_HISTORY) && may_delete_history) { 282 if ((remove_mask & REMOVE_HISTORY) && may_delete_history) {
283 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 283 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
284 profile_, Profile::EXPLICIT_ACCESS); 284 profile_, ServiceAccessType::EXPLICIT_ACCESS);
285 if (history_service) { 285 if (history_service) {
286 std::set<GURL> restrict_urls; 286 std::set<GURL> restrict_urls;
287 if (!remove_origin_.is_empty()) 287 if (!remove_origin_.is_empty())
288 restrict_urls.insert(remove_origin_); 288 restrict_urls.insert(remove_origin_);
289 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); 289 content::RecordAction(UserMetricsAction("ClearBrowsingData_History"));
290 waiting_for_clear_history_ = true; 290 waiting_for_clear_history_ = true;
291 291
292 history_service->ExpireLocalAndRemoteHistoryBetween( 292 history_service->ExpireLocalAndRemoteHistoryBetween(
293 restrict_urls, delete_begin_, delete_end_, 293 restrict_urls, delete_begin_, delete_end_,
294 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, 294 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (session_service) 376 if (session_service)
377 session_service->DeleteLastSession(); 377 session_service->DeleteLastSession();
378 #endif 378 #endif
379 } 379 }
380 380
381 // The saved Autofill profiles and credit cards can include the origin from 381 // The saved Autofill profiles and credit cards can include the origin from
382 // which these profiles and credit cards were learned. These are a form of 382 // which these profiles and credit cards were learned. These are a form of
383 // history, so clear them as well. 383 // history, so clear them as well.
384 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 384 scoped_refptr<autofill::AutofillWebDataService> web_data_service =
385 WebDataServiceFactory::GetAutofillWebDataForProfile( 385 WebDataServiceFactory::GetAutofillWebDataForProfile(
386 profile_, Profile::EXPLICIT_ACCESS); 386 profile_, ServiceAccessType::EXPLICIT_ACCESS);
387 if (web_data_service.get()) { 387 if (web_data_service.get()) {
388 waiting_for_clear_autofill_origin_urls_ = true; 388 waiting_for_clear_autofill_origin_urls_ = true;
389 web_data_service->RemoveOriginURLsModifiedBetween( 389 web_data_service->RemoveOriginURLsModifiedBetween(
390 delete_begin_, delete_end_); 390 delete_begin_, delete_end_);
391 // The above calls are done on the UI thread but do their work on the DB 391 // The above calls are done on the UI thread but do their work on the DB
392 // thread. So wait for it. 392 // thread. So wait for it.
393 BrowserThread::PostTaskAndReply( 393 BrowserThread::PostTaskAndReply(
394 BrowserThread::DB, FROM_HERE, 394 BrowserThread::DB, FROM_HERE,
395 base::Bind(&base::DoNothing), 395 base::Bind(&base::DoNothing),
396 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs, 396 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 #if defined(OS_ANDROID) 537 #if defined(OS_ANDROID)
538 if (remove_mask & REMOVE_APP_BANNER_DATA) { 538 if (remove_mask & REMOVE_APP_BANNER_DATA) {
539 profile_->GetHostContentSettingsMap()->ClearSettingsForOneType( 539 profile_->GetHostContentSettingsMap()->ClearSettingsForOneType(
540 CONTENT_SETTINGS_TYPE_APP_BANNER); 540 CONTENT_SETTINGS_TYPE_APP_BANNER);
541 } 541 }
542 #endif 542 #endif
543 543
544 if (remove_mask & REMOVE_PASSWORDS) { 544 if (remove_mask & REMOVE_PASSWORDS) {
545 content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); 545 content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords"));
546 password_manager::PasswordStore* password_store = 546 password_manager::PasswordStore* password_store =
547 PasswordStoreFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) 547 PasswordStoreFactory::GetForProfile(
548 .get(); 548 profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
549 549
550 if (password_store) 550 if (password_store)
551 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); 551 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_);
552 } 552 }
553 553
554 if (remove_mask & REMOVE_FORM_DATA) { 554 if (remove_mask & REMOVE_FORM_DATA) {
555 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); 555 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill"));
556 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 556 scoped_refptr<autofill::AutofillWebDataService> web_data_service =
557 WebDataServiceFactory::GetAutofillWebDataForProfile( 557 WebDataServiceFactory::GetAutofillWebDataForProfile(
558 profile_, Profile::EXPLICIT_ACCESS); 558 profile_, ServiceAccessType::EXPLICIT_ACCESS);
559 559
560 if (web_data_service.get()) { 560 if (web_data_service.get()) {
561 waiting_for_clear_form_ = true; 561 waiting_for_clear_form_ = true;
562 web_data_service->RemoveFormElementsAddedBetween(delete_begin_, 562 web_data_service->RemoveFormElementsAddedBetween(delete_begin_,
563 delete_end_); 563 delete_end_);
564 web_data_service->RemoveAutofillDataModifiedBetween( 564 web_data_service->RemoveAutofillDataModifiedBetween(
565 delete_begin_, delete_end_); 565 delete_begin_, delete_end_);
566 // The above calls are done on the UI thread but do their work on the DB 566 // The above calls are done on the UI thread but do their work on the DB
567 // thread. So wait for it. 567 // thread. So wait for it.
568 BrowserThread::PostTaskAndReply( 568 BrowserThread::PostTaskAndReply(
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 waiting_for_clear_webrtc_logs_ = false; 1192 waiting_for_clear_webrtc_logs_ = false;
1193 NotifyAndDeleteIfDone(); 1193 NotifyAndDeleteIfDone();
1194 } 1194 }
1195 #endif 1195 #endif
1196 1196
1197 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1197 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1198 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1198 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1199 waiting_for_clear_domain_reliability_monitor_ = false; 1199 waiting_for_clear_domain_reliability_monitor_ = false;
1200 NotifyAndDeleteIfDone(); 1200 NotifyAndDeleteIfDone();
1201 } 1201 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/chrome_bookmark_client.cc ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698