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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 waiting_for_clear_cookies_count_(0), | 140 waiting_for_clear_cookies_count_(0), |
141 waiting_for_clear_history_(false), | 141 waiting_for_clear_history_(false), |
142 waiting_for_clear_local_storage_(false), | 142 waiting_for_clear_local_storage_(false), |
143 waiting_for_clear_session_storage_(false), | 143 waiting_for_clear_session_storage_(false), |
144 waiting_for_clear_networking_history_(false), | 144 waiting_for_clear_networking_history_(false), |
145 waiting_for_clear_server_bound_certs_(false), | 145 waiting_for_clear_server_bound_certs_(false), |
146 waiting_for_clear_plugin_data_(false), | 146 waiting_for_clear_plugin_data_(false), |
147 waiting_for_clear_quota_managed_data_(false), | 147 waiting_for_clear_quota_managed_data_(false), |
148 waiting_for_clear_content_licenses_(false), | 148 waiting_for_clear_content_licenses_(false), |
149 waiting_for_clear_form_(false), | 149 waiting_for_clear_form_(false), |
150 waiting_for_clear_profile_io_data_(false), | |
150 remove_mask_(0), | 151 remove_mask_(0), |
151 remove_origin_(GURL()), | 152 remove_origin_(GURL()), |
152 origin_set_mask_(0) { | 153 origin_set_mask_(0) { |
153 DCHECK(profile); | 154 DCHECK(profile); |
154 // crbug.com/140910: Many places were calling this with base::Time() as | 155 // crbug.com/140910: Many places were calling this with base::Time() as |
155 // delete_end, even though they should've used base::Time::Max(). Work around | 156 // delete_end, even though they should've used base::Time::Max(). Work around |
156 // it here. New code should use base::Time::Max(). | 157 // it here. New code should use base::Time::Max(). |
157 DCHECK(delete_end_ != base::Time()); | 158 DCHECK(delete_end_ != base::Time()); |
158 if (delete_end_ == base::Time()) | 159 if (delete_end_ == base::Time()) |
159 delete_end_ = base::Time::Max(); | 160 delete_end_ = base::Time::Max(); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
485 if (!pepper_flash_settings_manager_.get()) { | 486 if (!pepper_flash_settings_manager_.get()) { |
486 pepper_flash_settings_manager_.reset( | 487 pepper_flash_settings_manager_.reset( |
487 new PepperFlashSettingsManager(this, profile_)); | 488 new PepperFlashSettingsManager(this, profile_)); |
488 } | 489 } |
489 deauthorize_content_licenses_request_id_ = | 490 deauthorize_content_licenses_request_id_ = |
490 pepper_flash_settings_manager_->DeauthorizeContentLicenses(); | 491 pepper_flash_settings_manager_->DeauthorizeContentLicenses(); |
491 } | 492 } |
492 | 493 |
493 // Also delete cached network related data (like TransportSecurityState, | 494 // Also delete cached network related data (like TransportSecurityState, |
494 // HttpServerProperties data). | 495 // HttpServerProperties data). |
495 profile_->ClearNetworkingHistorySince(delete_begin_); | 496 waiting_for_clear_profile_io_data_ = true; |
496 | 497 profile_->ClearNetworkingHistorySince( |
497 NotifyAndDeleteIfDone(); | 498 delete_begin_, |
499 base::Bind(&BrowsingDataRemover::ClearedProfileIOData, | |
500 base::Unretained(this))); | |
mmenke
2012/10/25 16:01:15
This strikes me as very regression-prone. Since O
engedy
2012/10/25 19:41:31
Done.
| |
498 } | 501 } |
499 | 502 |
500 void BrowsingDataRemover::AddObserver(Observer* observer) { | 503 void BrowsingDataRemover::AddObserver(Observer* observer) { |
501 observer_list_.AddObserver(observer); | 504 observer_list_.AddObserver(observer); |
502 } | 505 } |
503 | 506 |
504 void BrowsingDataRemover::RemoveObserver(Observer* observer) { | 507 void BrowsingDataRemover::RemoveObserver(Observer* observer) { |
505 observer_list_.RemoveObserver(observer); | 508 observer_list_.RemoveObserver(observer); |
506 } | 509 } |
507 | 510 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 !waiting_for_clear_nacl_cache_ && | 551 !waiting_for_clear_nacl_cache_ && |
549 !waiting_for_clear_cookies_count_&& | 552 !waiting_for_clear_cookies_count_&& |
550 !waiting_for_clear_history_ && | 553 !waiting_for_clear_history_ && |
551 !waiting_for_clear_local_storage_ && | 554 !waiting_for_clear_local_storage_ && |
552 !waiting_for_clear_session_storage_ && | 555 !waiting_for_clear_session_storage_ && |
553 !waiting_for_clear_networking_history_ && | 556 !waiting_for_clear_networking_history_ && |
554 !waiting_for_clear_server_bound_certs_ && | 557 !waiting_for_clear_server_bound_certs_ && |
555 !waiting_for_clear_plugin_data_ && | 558 !waiting_for_clear_plugin_data_ && |
556 !waiting_for_clear_quota_managed_data_ && | 559 !waiting_for_clear_quota_managed_data_ && |
557 !waiting_for_clear_content_licenses_ && | 560 !waiting_for_clear_content_licenses_ && |
558 !waiting_for_clear_form_; | 561 !waiting_for_clear_form_ && |
562 !waiting_for_clear_profile_io_data_; | |
559 } | 563 } |
560 | 564 |
561 void BrowsingDataRemover::Observe(int type, | 565 void BrowsingDataRemover::Observe(int type, |
562 const content::NotificationSource& source, | 566 const content::NotificationSource& source, |
563 const content::NotificationDetails& details) { | 567 const content::NotificationDetails& details) { |
564 // TODO(brettw) bug 1139736: This should also observe session | 568 // TODO(brettw) bug 1139736: This should also observe session |
565 // clearing (what about other things such as passwords, etc.?) and wait for | 569 // clearing (what about other things such as passwords, etc.?) and wait for |
566 // them to complete before continuing. | 570 // them to complete before continuing. |
567 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); | 571 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); |
568 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr(); | 572 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr(); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
967 BrowserThread::UI, FROM_HERE, | 971 BrowserThread::UI, FROM_HERE, |
968 base::Bind(&BrowsingDataRemover::OnClearedFormData, | 972 base::Bind(&BrowsingDataRemover::OnClearedFormData, |
969 base::Unretained(this))); | 973 base::Unretained(this))); |
970 } | 974 } |
971 | 975 |
972 void BrowsingDataRemover::OnClearedFormData() { | 976 void BrowsingDataRemover::OnClearedFormData() { |
973 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 977 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
974 waiting_for_clear_form_ = false; | 978 waiting_for_clear_form_ = false; |
975 NotifyAndDeleteIfDone(); | 979 NotifyAndDeleteIfDone(); |
976 } | 980 } |
981 | |
982 void BrowsingDataRemover::ClearedProfileIOData() { | |
983 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
984 waiting_for_clear_profile_io_data_ = false; | |
985 NotifyAndDeleteIfDone(); | |
986 } | |
987 | |
OLD | NEW |