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

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

Issue 13995007: Revert 194484 "Add the LoggedIn Predictor, to detect which websi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 | 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 12 matching lines...) Expand all
23 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/extensions/extension_special_storage_policy.h" 24 #include "chrome/browser/extensions/extension_special_storage_policy.h"
25 #include "chrome/browser/history/history_service.h" 25 #include "chrome/browser/history/history_service.h"
26 #include "chrome/browser/history/history_service_factory.h" 26 #include "chrome/browser/history/history_service_factory.h"
27 #include "chrome/browser/io_thread.h" 27 #include "chrome/browser/io_thread.h"
28 #include "chrome/browser/nacl_host/nacl_browser.h" 28 #include "chrome/browser/nacl_host/nacl_browser.h"
29 #include "chrome/browser/net/chrome_url_request_context.h" 29 #include "chrome/browser/net/chrome_url_request_context.h"
30 #include "chrome/browser/net/predictor.h" 30 #include "chrome/browser/net/predictor.h"
31 #include "chrome/browser/password_manager/password_store.h" 31 #include "chrome/browser/password_manager/password_store.h"
32 #include "chrome/browser/password_manager/password_store_factory.h" 32 #include "chrome/browser/password_manager/password_store_factory.h"
33 #include "chrome/browser/predictors/logged_in_predictor_table.h"
34 #include "chrome/browser/predictors/predictor_database.h"
35 #include "chrome/browser/predictors/predictor_database_factory.h"
36 #include "chrome/browser/prerender/prerender_manager.h" 33 #include "chrome/browser/prerender/prerender_manager.h"
37 #include "chrome/browser/prerender/prerender_manager_factory.h" 34 #include "chrome/browser/prerender/prerender_manager_factory.h"
38 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/renderer_host/web_cache_manager.h" 36 #include "chrome/browser/renderer_host/web_cache_manager.h"
40 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 37 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
41 #include "chrome/browser/search_engines/template_url_service.h" 38 #include "chrome/browser/search_engines/template_url_service.h"
42 #include "chrome/browser/search_engines/template_url_service_factory.h" 39 #include "chrome/browser/search_engines/template_url_service_factory.h"
43 #include "chrome/browser/sessions/session_service.h" 40 #include "chrome/browser/sessions/session_service.h"
44 #include "chrome/browser/sessions/session_service_factory.h" 41 #include "chrome/browser/sessions/session_service_factory.h"
45 #include "chrome/browser/sessions/tab_restore_service.h" 42 #include "chrome/browser/sessions/tab_restore_service.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 main_context_getter_(profile->GetRequestContext()), 133 main_context_getter_(profile->GetRequestContext()),
137 media_context_getter_(profile->GetMediaRequestContext()), 134 media_context_getter_(profile->GetMediaRequestContext()),
138 deauthorize_content_licenses_request_id_(0), 135 deauthorize_content_licenses_request_id_(0),
139 waiting_for_clear_cache_(false), 136 waiting_for_clear_cache_(false),
140 waiting_for_clear_content_licenses_(false), 137 waiting_for_clear_content_licenses_(false),
141 waiting_for_clear_cookies_count_(0), 138 waiting_for_clear_cookies_count_(0),
142 waiting_for_clear_form_(false), 139 waiting_for_clear_form_(false),
143 waiting_for_clear_history_(false), 140 waiting_for_clear_history_(false),
144 waiting_for_clear_hostname_resolution_cache_(false), 141 waiting_for_clear_hostname_resolution_cache_(false),
145 waiting_for_clear_local_storage_(false), 142 waiting_for_clear_local_storage_(false),
146 waiting_for_clear_logged_in_predictor_(false),
147 waiting_for_clear_nacl_cache_(false), 143 waiting_for_clear_nacl_cache_(false),
148 waiting_for_clear_network_predictor_(false), 144 waiting_for_clear_network_predictor_(false),
149 waiting_for_clear_networking_history_(false), 145 waiting_for_clear_networking_history_(false),
150 waiting_for_clear_plugin_data_(false), 146 waiting_for_clear_plugin_data_(false),
151 waiting_for_clear_quota_managed_data_(false), 147 waiting_for_clear_quota_managed_data_(false),
152 waiting_for_clear_server_bound_certs_(false), 148 waiting_for_clear_server_bound_certs_(false),
153 waiting_for_clear_session_storage_(false), 149 waiting_for_clear_session_storage_(false),
154 waiting_for_clear_shader_cache_(false), 150 waiting_for_clear_shader_cache_(false),
155 remove_mask_(0), 151 remove_mask_(0),
156 remove_origin_(GURL()), 152 remove_origin_(GURL()),
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); 332 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies"));
337 // Since we are running on the UI thread don't call GetURLRequestContext(). 333 // Since we are running on the UI thread don't call GetURLRequestContext().
338 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); 334 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext();
339 if (rq_context) { 335 if (rq_context) {
340 ++waiting_for_clear_cookies_count_; 336 ++waiting_for_clear_cookies_count_;
341 BrowserThread::PostTask( 337 BrowserThread::PostTask(
342 BrowserThread::IO, FROM_HERE, 338 BrowserThread::IO, FROM_HERE,
343 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread, 339 base::Bind(&BrowsingDataRemover::ClearCookiesOnIOThread,
344 base::Unretained(this), base::Unretained(rq_context))); 340 base::Unretained(this), base::Unretained(rq_context)));
345 } 341 }
346 // Also delete the LoggedIn Predictor, which tries to keep track of which
347 // sites a user is logged into.
348 ClearLoggedInPredictor();
349 342
350 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) 343 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
351 // Clear the safebrowsing cookies only if time period is for "all time". It 344 // Clear the safebrowsing cookies only if time period is for "all time". It
352 // doesn't make sense to apply the time period of deleting in the last X 345 // doesn't make sense to apply the time period of deleting in the last X
353 // hours/days to the safebrowsing cookies since they aren't the result of 346 // hours/days to the safebrowsing cookies since they aren't the result of
354 // any user action. 347 // any user action.
355 if (delete_begin_ == base::Time()) { 348 if (delete_begin_ == base::Time()) {
356 SafeBrowsingService* sb_service = 349 SafeBrowsingService* sb_service =
357 g_browser_process->safe_browsing_service(); 350 g_browser_process->safe_browsing_service();
358 if (sb_service) { 351 if (sb_service) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 return delete_begin_time - diff; 567 return delete_begin_time - diff;
575 } 568 }
576 569
577 bool BrowsingDataRemover::AllDone() { 570 bool BrowsingDataRemover::AllDone() {
578 return registrar_.IsEmpty() && 571 return registrar_.IsEmpty() &&
579 !waiting_for_clear_cache_ && 572 !waiting_for_clear_cache_ &&
580 !waiting_for_clear_nacl_cache_ && 573 !waiting_for_clear_nacl_cache_ &&
581 !waiting_for_clear_cookies_count_&& 574 !waiting_for_clear_cookies_count_&&
582 !waiting_for_clear_history_ && 575 !waiting_for_clear_history_ &&
583 !waiting_for_clear_local_storage_ && 576 !waiting_for_clear_local_storage_ &&
584 !waiting_for_clear_logged_in_predictor_ &&
585 !waiting_for_clear_session_storage_ && 577 !waiting_for_clear_session_storage_ &&
586 !waiting_for_clear_networking_history_ && 578 !waiting_for_clear_networking_history_ &&
587 !waiting_for_clear_server_bound_certs_ && 579 !waiting_for_clear_server_bound_certs_ &&
588 !waiting_for_clear_plugin_data_ && 580 !waiting_for_clear_plugin_data_ &&
589 !waiting_for_clear_quota_managed_data_ && 581 !waiting_for_clear_quota_managed_data_ &&
590 !waiting_for_clear_content_licenses_ && 582 !waiting_for_clear_content_licenses_ &&
591 !waiting_for_clear_form_ && 583 !waiting_for_clear_form_ &&
592 !waiting_for_clear_hostname_resolution_cache_ && 584 !waiting_for_clear_hostname_resolution_cache_ &&
593 !waiting_for_clear_network_predictor_ && 585 !waiting_for_clear_network_predictor_ &&
594 !waiting_for_clear_shader_cache_; 586 !waiting_for_clear_shader_cache_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 io_thread->ClearHostCache(); 636 io_thread->ClearHostCache();
645 637
646 // Notify the UI thread that we are done. 638 // Notify the UI thread that we are done.
647 BrowserThread::PostTask( 639 BrowserThread::PostTask(
648 BrowserThread::UI, 640 BrowserThread::UI,
649 FROM_HERE, 641 FROM_HERE,
650 base::Bind(&BrowsingDataRemover::OnClearedHostnameResolutionCache, 642 base::Bind(&BrowsingDataRemover::OnClearedHostnameResolutionCache,
651 base::Unretained(this))); 643 base::Unretained(this)));
652 } 644 }
653 645
654 void BrowsingDataRemover::OnClearedLoggedInPredictor() {
655 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
656 DCHECK(waiting_for_clear_logged_in_predictor_);
657 waiting_for_clear_logged_in_predictor_ = false;
658 NotifyAndDeleteIfDone();
659 }
660
661 void BrowsingDataRemover::ClearLoggedInPredictor() {
662 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
663 DCHECK(!waiting_for_clear_logged_in_predictor_);
664
665 predictors::PredictorDatabase* predictor_db =
666 predictors::PredictorDatabaseFactory::GetForProfile(profile_);
667 if (!predictor_db)
668 return;
669
670 predictors::LoggedInPredictorTable* logged_in_table =
671 predictor_db->logged_in_table();
672 if (!logged_in_table)
673 return;
674
675 waiting_for_clear_logged_in_predictor_ = true;
676
677 BrowserThread::PostTaskAndReply(
678 BrowserThread::DB,
679 FROM_HERE,
680 base::Bind(&predictors::LoggedInPredictorTable::DeleteAllCreatedBetween,
681 logged_in_table,
682 delete_begin_,
683 delete_end_),
684 base::Bind(&BrowsingDataRemover::OnClearedLoggedInPredictor,
685 base::Unretained(this)));
686 }
687
688 void BrowsingDataRemover::OnClearedNetworkPredictor() { 646 void BrowsingDataRemover::OnClearedNetworkPredictor() {
689 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 647 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
690 waiting_for_clear_network_predictor_ = false; 648 waiting_for_clear_network_predictor_ = false;
691 NotifyAndDeleteIfDone(); 649 NotifyAndDeleteIfDone();
692 } 650 }
693 651
694 void BrowsingDataRemover::ClearNetworkPredictorOnIOThread() { 652 void BrowsingDataRemover::ClearNetworkPredictorOnIOThread() {
695 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 653 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
696 654
697 chrome_browser_net::Predictor* predictor = profile_->GetNetworkPredictor(); 655 chrome_browser_net::Predictor* predictor = profile_->GetNetworkPredictor();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 BrowserThread::UI, FROM_HERE, 1033 BrowserThread::UI, FROM_HERE,
1076 base::Bind(&BrowsingDataRemover::OnClearedFormData, 1034 base::Bind(&BrowsingDataRemover::OnClearedFormData,
1077 base::Unretained(this))); 1035 base::Unretained(this)));
1078 } 1036 }
1079 1037
1080 void BrowsingDataRemover::OnClearedFormData() { 1038 void BrowsingDataRemover::OnClearedFormData() {
1081 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1039 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1082 waiting_for_clear_form_ = false; 1040 waiting_for_clear_form_ = false;
1083 NotifyAndDeleteIfDone(); 1041 NotifyAndDeleteIfDone();
1084 } 1042 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698