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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 waiting_for_clear_history_(false), | 141 waiting_for_clear_history_(false), |
142 waiting_for_clear_hostname_resolution_cache_(false), | 142 waiting_for_clear_hostname_resolution_cache_(false), |
143 waiting_for_clear_local_storage_(false), | 143 waiting_for_clear_local_storage_(false), |
144 waiting_for_clear_nacl_cache_(false), | 144 waiting_for_clear_nacl_cache_(false), |
145 waiting_for_clear_network_predictor_(false), | 145 waiting_for_clear_network_predictor_(false), |
146 waiting_for_clear_networking_history_(false), | 146 waiting_for_clear_networking_history_(false), |
147 waiting_for_clear_plugin_data_(false), | 147 waiting_for_clear_plugin_data_(false), |
148 waiting_for_clear_quota_managed_data_(false), | 148 waiting_for_clear_quota_managed_data_(false), |
149 waiting_for_clear_server_bound_certs_(false), | 149 waiting_for_clear_server_bound_certs_(false), |
150 waiting_for_clear_session_storage_(false), | 150 waiting_for_clear_session_storage_(false), |
151 waiting_for_clear_shader_cache_(false), | |
151 remove_mask_(0), | 152 remove_mask_(0), |
152 remove_origin_(GURL()), | 153 remove_origin_(GURL()), |
153 origin_set_mask_(0) { | 154 origin_set_mask_(0) { |
154 DCHECK(profile); | 155 DCHECK(profile); |
155 // crbug.com/140910: Many places were calling this with base::Time() as | 156 // crbug.com/140910: Many places were calling this with base::Time() as |
156 // delete_end, even though they should've used base::Time::Max(). Work around | 157 // delete_end, even though they should've used base::Time::Max(). Work around |
157 // it here. New code should use base::Time::Max(). | 158 // it here. New code should use base::Time::Max(). |
158 DCHECK(delete_end_ != base::Time()); | 159 DCHECK(delete_end_ != base::Time()); |
159 if (delete_end_ == base::Time()) | 160 if (delete_end_ == base::Time()) |
160 delete_end_ = base::Time::Max(); | 161 delete_end_ = base::Time::Max(); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 waiting_for_clear_content_licenses_ = true; | 500 waiting_for_clear_content_licenses_ = true; |
500 if (!pepper_flash_settings_manager_.get()) { | 501 if (!pepper_flash_settings_manager_.get()) { |
501 pepper_flash_settings_manager_.reset( | 502 pepper_flash_settings_manager_.reset( |
502 new PepperFlashSettingsManager(this, profile_)); | 503 new PepperFlashSettingsManager(this, profile_)); |
503 } | 504 } |
504 deauthorize_content_licenses_request_id_ = | 505 deauthorize_content_licenses_request_id_ = |
505 pepper_flash_settings_manager_->DeauthorizeContentLicenses(); | 506 pepper_flash_settings_manager_->DeauthorizeContentLicenses(); |
506 } | 507 } |
507 #endif | 508 #endif |
508 | 509 |
510 if (remove_mask & REMOVE_SHADER_CACHE) { | |
511 waiting_for_clear_shader_cache_ = true; | |
512 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); | |
513 | |
514 ClearShaderCacheOnUIThread(); | |
515 } | |
516 | |
509 // Always wipe accumulated network related data (TransportSecurityState and | 517 // Always wipe accumulated network related data (TransportSecurityState and |
510 // HttpServerPropertiesManager data). | 518 // HttpServerPropertiesManager data). |
511 waiting_for_clear_networking_history_ = true; | 519 waiting_for_clear_networking_history_ = true; |
512 profile_->ClearNetworkingHistorySince( | 520 profile_->ClearNetworkingHistorySince( |
513 delete_begin_, | 521 delete_begin_, |
514 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, | 522 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, |
515 base::Unretained(this))); | 523 base::Unretained(this))); |
516 } | 524 } |
517 | 525 |
518 void BrowsingDataRemover::AddObserver(Observer* observer) { | 526 void BrowsingDataRemover::AddObserver(Observer* observer) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 !waiting_for_clear_history_ && | 576 !waiting_for_clear_history_ && |
569 !waiting_for_clear_local_storage_ && | 577 !waiting_for_clear_local_storage_ && |
570 !waiting_for_clear_session_storage_ && | 578 !waiting_for_clear_session_storage_ && |
571 !waiting_for_clear_networking_history_ && | 579 !waiting_for_clear_networking_history_ && |
572 !waiting_for_clear_server_bound_certs_ && | 580 !waiting_for_clear_server_bound_certs_ && |
573 !waiting_for_clear_plugin_data_ && | 581 !waiting_for_clear_plugin_data_ && |
574 !waiting_for_clear_quota_managed_data_ && | 582 !waiting_for_clear_quota_managed_data_ && |
575 !waiting_for_clear_content_licenses_ && | 583 !waiting_for_clear_content_licenses_ && |
576 !waiting_for_clear_form_ && | 584 !waiting_for_clear_form_ && |
577 !waiting_for_clear_hostname_resolution_cache_ && | 585 !waiting_for_clear_hostname_resolution_cache_ && |
578 !waiting_for_clear_network_predictor_; | 586 !waiting_for_clear_network_predictor_ && |
587 !waiting_for_clear_shader_cache_; | |
579 } | 588 } |
580 | 589 |
581 void BrowsingDataRemover::Observe(int type, | 590 void BrowsingDataRemover::Observe(int type, |
582 const content::NotificationSource& source, | 591 const content::NotificationSource& source, |
583 const content::NotificationDetails& details) { | 592 const content::NotificationDetails& details) { |
584 // TODO(brettw) bug 1139736: This should also observe session | 593 // TODO(brettw) bug 1139736: This should also observe session |
585 // clearing (what about other things such as passwords, etc.?) and wait for | 594 // clearing (what about other things such as passwords, etc.?) and wait for |
586 // them to complete before continuing. | 595 // them to complete before continuing. |
587 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); | 596 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); |
588 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr(); | 597 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr(); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 } | 771 } |
763 default: { | 772 default: { |
764 NOTREACHED() << "bad state"; | 773 NOTREACHED() << "bad state"; |
765 next_cache_state_ = STATE_NONE; // Stop looping. | 774 next_cache_state_ = STATE_NONE; // Stop looping. |
766 return; | 775 return; |
767 } | 776 } |
768 } | 777 } |
769 } | 778 } |
770 } | 779 } |
771 | 780 |
781 void BrowsingDataRemover::ClearedShaderCache() { | |
782 // This function should be called on the UI thread. | |
jam
2013/04/02 17:34:50
nit: redundant comment, remove per style guide
dsinclair
2013/04/03 18:59:23
Done.
| |
783 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
784 | |
785 waiting_for_clear_shader_cache_ = false; | |
786 NotifyAndDeleteIfDone(); | |
787 } | |
788 | |
789 void BrowsingDataRemover::ClearShaderCacheOnUIThread() { | |
790 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
791 | |
792 BrowserContext::GetDefaultStoragePartition(profile_)->AsyncClearDataBetween( | |
793 content::StoragePartition::kShaderStorage, delete_begin_, delete_end_, | |
794 base::Bind(&BrowsingDataRemover::ClearedShaderCache, | |
795 base::Unretained(this))); | |
796 } | |
797 | |
772 #if !defined(DISABLE_NACL) | 798 #if !defined(DISABLE_NACL) |
773 void BrowsingDataRemover::ClearedNaClCache() { | 799 void BrowsingDataRemover::ClearedNaClCache() { |
774 // This function should be called on the UI thread. | 800 // This function should be called on the UI thread. |
775 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 801 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
776 | 802 |
777 waiting_for_clear_nacl_cache_ = false; | 803 waiting_for_clear_nacl_cache_ = false; |
778 | 804 |
779 NotifyAndDeleteIfDone(); | 805 NotifyAndDeleteIfDone(); |
780 } | 806 } |
781 | 807 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 BrowserThread::UI, FROM_HERE, | 1050 BrowserThread::UI, FROM_HERE, |
1025 base::Bind(&BrowsingDataRemover::OnClearedFormData, | 1051 base::Bind(&BrowsingDataRemover::OnClearedFormData, |
1026 base::Unretained(this))); | 1052 base::Unretained(this))); |
1027 } | 1053 } |
1028 | 1054 |
1029 void BrowsingDataRemover::OnClearedFormData() { | 1055 void BrowsingDataRemover::OnClearedFormData() { |
1030 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1056 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1031 waiting_for_clear_form_ = false; | 1057 waiting_for_clear_form_ = false; |
1032 NotifyAndDeleteIfDone(); | 1058 NotifyAndDeleteIfDone(); |
1033 } | 1059 } |
OLD | NEW |