| 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_remover.h" | 5 #include "chrome/browser/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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 void BrowsingDataRemover::RemoveImpl(int remove_mask, | 183 void BrowsingDataRemover::RemoveImpl(int remove_mask, |
| 184 const GURL& origin, | 184 const GURL& origin, |
| 185 int origin_set_mask) { | 185 int origin_set_mask) { |
| 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 187 set_removing(true); | 187 set_removing(true); |
| 188 remove_mask_ = remove_mask; | 188 remove_mask_ = remove_mask; |
| 189 remove_origin_ = origin; | 189 remove_origin_ = origin; |
| 190 origin_set_mask_ = origin_set_mask; | 190 origin_set_mask_ = origin_set_mask; |
| 191 | 191 |
| 192 if (origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 193 content::RecordAction( |
| 194 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); |
| 195 } |
| 196 if (origin_set_mask_ & BrowsingDataHelper::PROTECTED_WEB) { |
| 197 content::RecordAction( |
| 198 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); |
| 199 } |
| 200 if (origin_set_mask_ & BrowsingDataHelper::EXTENSION) { |
| 201 content::RecordAction( |
| 202 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); |
| 203 } |
| 204 // If this fires, we added a new BrowsingDataHelper::OriginSetMask without |
| 205 // updating the user metrics above. |
| 206 COMPILE_ASSERT( |
| 207 BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB | |
| 208 BrowsingDataHelper::PROTECTED_WEB | |
| 209 BrowsingDataHelper::EXTENSION), |
| 210 forgotten_to_add_origin_mask_type); |
| 211 |
| 192 if (remove_mask & REMOVE_HISTORY) { | 212 if (remove_mask & REMOVE_HISTORY) { |
| 193 HistoryService* history_service = | 213 HistoryService* history_service = |
| 194 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 214 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 195 if (history_service) { | 215 if (history_service) { |
| 196 std::set<GURL> restrict_urls; | 216 std::set<GURL> restrict_urls; |
| 197 if (!remove_origin_.is_empty()) | 217 if (!remove_origin_.is_empty()) |
| 198 restrict_urls.insert(remove_origin_); | 218 restrict_urls.insert(remove_origin_); |
| 199 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | 219 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); |
| 200 waiting_for_clear_history_ = true; | 220 waiting_for_clear_history_ = true; |
| 201 history_service->ExpireHistoryBetween(restrict_urls, | 221 history_service->ExpireHistoryBetween(restrict_urls, |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 BrowserThread::UI, FROM_HERE, | 802 BrowserThread::UI, FROM_HERE, |
| 783 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, | 803 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, |
| 784 base::Unretained(this))); | 804 base::Unretained(this))); |
| 785 } | 805 } |
| 786 | 806 |
| 787 void BrowsingDataRemover::OnClearedServerBoundCerts() { | 807 void BrowsingDataRemover::OnClearedServerBoundCerts() { |
| 788 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 808 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 789 waiting_for_clear_server_bound_certs_ = false; | 809 waiting_for_clear_server_bound_certs_ = false; |
| 790 NotifyAndDeleteIfDone(); | 810 NotifyAndDeleteIfDone(); |
| 791 } | 811 } |
| OLD | NEW |