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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 waiting_for_clear_local_storage_(false), | 121 waiting_for_clear_local_storage_(false), |
122 waiting_for_clear_networking_history_(false), | 122 waiting_for_clear_networking_history_(false), |
123 waiting_for_clear_server_bound_certs_(false), | 123 waiting_for_clear_server_bound_certs_(false), |
124 waiting_for_clear_plugin_data_(false), | 124 waiting_for_clear_plugin_data_(false), |
125 waiting_for_clear_quota_managed_data_(false), | 125 waiting_for_clear_quota_managed_data_(false), |
126 waiting_for_clear_content_licenses_(false), | 126 waiting_for_clear_content_licenses_(false), |
127 remove_mask_(0), | 127 remove_mask_(0), |
128 remove_origin_(GURL()), | 128 remove_origin_(GURL()), |
129 origin_set_mask_(0) { | 129 origin_set_mask_(0) { |
130 DCHECK(profile); | 130 DCHECK(profile); |
| 131 // crbug.com/140910: Many places were calling this with base::Time() as |
| 132 // delete_end, even though they should've used base::Time::Now(). Work around |
| 133 // it here. New code should use base::Time::Now(). |
| 134 DCHECK(delete_end_ != base::Time()); |
| 135 if (delete_end_ == base::Time()) |
| 136 delete_end_ = base::Time::Now(); |
131 } | 137 } |
132 | 138 |
133 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, | 139 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, |
134 TimePeriod time_period, | 140 TimePeriod time_period, |
135 base::Time delete_end) | 141 base::Time delete_end) |
136 : profile_(profile), | 142 : profile_(profile), |
137 quota_manager_(NULL), | 143 quota_manager_(NULL), |
138 dom_storage_context_(NULL), | 144 dom_storage_context_(NULL), |
139 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), | 145 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), |
140 delete_begin_(CalculateBeginDeleteTime(time_period)), | 146 delete_begin_(CalculateBeginDeleteTime(time_period)), |
(...skipping 10 matching lines...) Expand all Loading... |
151 waiting_for_clear_local_storage_(false), | 157 waiting_for_clear_local_storage_(false), |
152 waiting_for_clear_networking_history_(false), | 158 waiting_for_clear_networking_history_(false), |
153 waiting_for_clear_server_bound_certs_(false), | 159 waiting_for_clear_server_bound_certs_(false), |
154 waiting_for_clear_plugin_data_(false), | 160 waiting_for_clear_plugin_data_(false), |
155 waiting_for_clear_quota_managed_data_(false), | 161 waiting_for_clear_quota_managed_data_(false), |
156 waiting_for_clear_content_licenses_(false), | 162 waiting_for_clear_content_licenses_(false), |
157 remove_mask_(0), | 163 remove_mask_(0), |
158 remove_origin_(GURL()), | 164 remove_origin_(GURL()), |
159 origin_set_mask_(0) { | 165 origin_set_mask_(0) { |
160 DCHECK(profile); | 166 DCHECK(profile); |
| 167 // crbug.com/140910: Many places were calling this with base::Time() as |
| 168 // delete_end, even though they should've used base::Time::Now(). Work around |
| 169 // it here. New code should use base::Time::Now(). |
| 170 DCHECK(delete_end_ != base::Time()); |
| 171 if (delete_end_ == base::Time()) |
| 172 delete_end_ = base::Time::Now(); |
161 } | 173 } |
162 | 174 |
163 BrowsingDataRemover::~BrowsingDataRemover() { | 175 BrowsingDataRemover::~BrowsingDataRemover() { |
164 DCHECK(AllDone()); | 176 DCHECK(AllDone()); |
165 } | 177 } |
166 | 178 |
167 // Static. | 179 // Static. |
168 void BrowsingDataRemover::set_removing(bool removing) { | 180 void BrowsingDataRemover::set_removing(bool removing) { |
169 DCHECK(removing_ != removing); | 181 DCHECK(removing_ != removing); |
170 removing_ = removing; | 182 removing_ = removing; |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 BrowserThread::UI, FROM_HERE, | 895 BrowserThread::UI, FROM_HERE, |
884 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, | 896 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, |
885 base::Unretained(this))); | 897 base::Unretained(this))); |
886 } | 898 } |
887 | 899 |
888 void BrowsingDataRemover::OnClearedServerBoundCerts() { | 900 void BrowsingDataRemover::OnClearedServerBoundCerts() { |
889 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 901 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
890 waiting_for_clear_server_bound_certs_ = false; | 902 waiting_for_clear_server_bound_certs_ = false; |
891 NotifyAndDeleteIfDone(); | 903 NotifyAndDeleteIfDone(); |
892 } | 904 } |
OLD | NEW |