Chromium Code Reviews| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 #include "net/base/server_bound_cert_service.h" | 54 #include "net/base/server_bound_cert_service.h" |
| 55 #include "net/base/server_bound_cert_store.h" | 55 #include "net/base/server_bound_cert_store.h" |
| 56 #include "net/base/transport_security_state.h" | 56 #include "net/base/transport_security_state.h" |
| 57 #include "net/cookies/cookie_store.h" | 57 #include "net/cookies/cookie_store.h" |
| 58 #include "net/disk_cache/disk_cache.h" | 58 #include "net/disk_cache/disk_cache.h" |
| 59 #include "net/http/http_cache.h" | 59 #include "net/http/http_cache.h" |
| 60 #include "net/url_request/url_request_context.h" | 60 #include "net/url_request/url_request_context.h" |
| 61 #include "net/url_request/url_request_context_getter.h" | 61 #include "net/url_request/url_request_context_getter.h" |
| 62 #include "webkit/quota/quota_manager.h" | 62 #include "webkit/quota/quota_manager.h" |
| 63 #include "webkit/quota/quota_types.h" | 63 #include "webkit/quota/quota_types.h" |
| 64 #include "webkit/quota/special_storage_policy.h" | |
| 65 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " | |
|
Bernhard Bauer
2012/05/31 15:57:31
Nit: Alphabetize
Mike West
2012/06/01 13:35:17
Done.
| |
| 66 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
| 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | |
| 68 #include "webkit/glue/webkit_glue.h" | |
| 64 | 69 |
| 65 using content::BrowserContext; | 70 using content::BrowserContext; |
| 66 using content::BrowserThread; | 71 using content::BrowserThread; |
| 67 using content::DOMStorageContext; | 72 using content::DOMStorageContext; |
| 68 using content::DownloadManager; | 73 using content::DownloadManager; |
| 69 using content::UserMetricsAction; | 74 using content::UserMetricsAction; |
| 70 | 75 |
| 71 bool BrowsingDataRemover::removing_ = false; | 76 bool BrowsingDataRemover::removing_ = false; |
| 72 | 77 |
| 73 BrowsingDataRemover::NotificationDetails::NotificationDetails() | 78 BrowsingDataRemover::NotificationDetails::NotificationDetails() |
| 74 : removal_begin(base::Time()), | 79 : removal_begin(base::Time()), |
| 75 removal_mask(-1) { | 80 removal_mask(-1) { |
| 76 } | 81 } |
| 77 | 82 |
| 78 BrowsingDataRemover::NotificationDetails::NotificationDetails( | 83 BrowsingDataRemover::NotificationDetails::NotificationDetails( |
| 79 const BrowsingDataRemover::NotificationDetails& details) | 84 const BrowsingDataRemover::NotificationDetails& details) |
| 80 : removal_begin(details.removal_begin), | 85 : removal_begin(details.removal_begin), |
| 81 removal_mask(details.removal_mask) { | 86 removal_mask(details.removal_mask) { |
| 82 } | 87 } |
| 83 | 88 |
| 84 BrowsingDataRemover::NotificationDetails::NotificationDetails( | 89 BrowsingDataRemover::NotificationDetails::NotificationDetails( |
| 85 base::Time removal_begin, | 90 base::Time removal_begin, |
| 86 int removal_mask) | 91 int removal_mask) |
| 87 : removal_begin(removal_begin), | 92 : removal_begin(removal_begin), |
| 88 removal_mask(removal_mask) { | 93 removal_mask(removal_mask) { |
| 89 } | 94 } |
| 90 | 95 |
| 91 BrowsingDataRemover::NotificationDetails::~NotificationDetails() {} | 96 BrowsingDataRemover::NotificationDetails::~NotificationDetails() {} |
| 92 | 97 |
| 93 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, | 98 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, |
|
Bernhard Bauer
2012/05/31 15:57:31
If you feel like some yak-shaving (and you do have
Mike West
2012/06/01 13:35:17
http://crbug.com/130732
| |
| 94 base::Time delete_begin, | 99 base::Time delete_begin, |
| 95 base::Time delete_end) | 100 base::Time delete_end) |
| 96 : profile_(profile), | 101 : profile_(profile), |
| 97 quota_manager_(NULL), | 102 quota_manager_(NULL), |
| 103 dom_storage_context_(NULL), | |
| 98 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), | 104 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), |
| 99 delete_begin_(delete_begin), | 105 delete_begin_(delete_begin), |
| 100 delete_end_(delete_end), | 106 delete_end_(delete_end), |
| 101 next_cache_state_(STATE_NONE), | 107 next_cache_state_(STATE_NONE), |
| 102 cache_(NULL), | 108 cache_(NULL), |
| 103 main_context_getter_(profile->GetRequestContext()), | 109 main_context_getter_(profile->GetRequestContext()), |
| 104 media_context_getter_(profile->GetRequestContextForMedia()), | 110 media_context_getter_(profile->GetRequestContextForMedia()), |
| 105 deauthorize_content_licenses_request_id_(0), | 111 deauthorize_content_licenses_request_id_(0), |
| 106 waiting_for_clear_cache_(false), | 112 waiting_for_clear_cache_(false), |
| 107 waiting_for_clear_cookies_count_(0), | 113 waiting_for_clear_cookies_count_(0), |
| 108 waiting_for_clear_history_(false), | 114 waiting_for_clear_history_(false), |
| 115 waiting_for_clear_local_storage_(false), | |
| 109 waiting_for_clear_networking_history_(false), | 116 waiting_for_clear_networking_history_(false), |
| 110 waiting_for_clear_server_bound_certs_(false), | 117 waiting_for_clear_server_bound_certs_(false), |
| 111 waiting_for_clear_plugin_data_(false), | 118 waiting_for_clear_plugin_data_(false), |
| 112 waiting_for_clear_quota_managed_data_(false), | 119 waiting_for_clear_quota_managed_data_(false), |
| 113 waiting_for_clear_content_licenses_(false), | 120 waiting_for_clear_content_licenses_(false), |
| 114 remove_mask_(0), | 121 remove_mask_(0), |
| 115 remove_origin_(GURL()), | 122 remove_origin_(GURL()), |
| 116 remove_protected_(false) { | 123 origin_set_mask_(0) { |
| 117 DCHECK(profile); | 124 DCHECK(profile); |
| 118 } | 125 } |
| 119 | 126 |
| 120 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, | 127 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, |
| 121 TimePeriod time_period, | 128 TimePeriod time_period, |
| 122 base::Time delete_end) | 129 base::Time delete_end) |
| 123 : profile_(profile), | 130 : profile_(profile), |
| 124 quota_manager_(NULL), | 131 quota_manager_(NULL), |
| 132 dom_storage_context_(NULL), | |
| 125 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), | 133 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), |
| 126 delete_begin_(CalculateBeginDeleteTime(time_period)), | 134 delete_begin_(CalculateBeginDeleteTime(time_period)), |
| 127 delete_end_(delete_end), | 135 delete_end_(delete_end), |
| 128 next_cache_state_(STATE_NONE), | 136 next_cache_state_(STATE_NONE), |
| 129 cache_(NULL), | 137 cache_(NULL), |
| 130 main_context_getter_(profile->GetRequestContext()), | 138 main_context_getter_(profile->GetRequestContext()), |
| 131 media_context_getter_(profile->GetRequestContextForMedia()), | 139 media_context_getter_(profile->GetRequestContextForMedia()), |
| 132 deauthorize_content_licenses_request_id_(0), | 140 deauthorize_content_licenses_request_id_(0), |
| 133 waiting_for_clear_cache_(false), | 141 waiting_for_clear_cache_(false), |
| 134 waiting_for_clear_cookies_count_(0), | 142 waiting_for_clear_cookies_count_(0), |
| 135 waiting_for_clear_history_(false), | 143 waiting_for_clear_history_(false), |
| 144 waiting_for_clear_local_storage_(false), | |
| 136 waiting_for_clear_networking_history_(false), | 145 waiting_for_clear_networking_history_(false), |
| 137 waiting_for_clear_server_bound_certs_(false), | 146 waiting_for_clear_server_bound_certs_(false), |
| 138 waiting_for_clear_plugin_data_(false), | 147 waiting_for_clear_plugin_data_(false), |
| 139 waiting_for_clear_quota_managed_data_(false), | 148 waiting_for_clear_quota_managed_data_(false), |
| 140 waiting_for_clear_content_licenses_(false), | 149 waiting_for_clear_content_licenses_(false), |
| 141 remove_mask_(0), | 150 remove_mask_(0), |
| 142 remove_origin_(GURL()), | 151 remove_origin_(GURL()), |
| 143 remove_protected_(false) { | 152 origin_set_mask_(0) { |
| 144 DCHECK(profile); | 153 DCHECK(profile); |
| 145 } | 154 } |
| 146 | 155 |
| 147 BrowsingDataRemover::~BrowsingDataRemover() { | 156 BrowsingDataRemover::~BrowsingDataRemover() { |
| 148 DCHECK(all_done()); | 157 DCHECK(all_done()); |
| 149 } | 158 } |
| 150 | 159 |
| 151 // Static. | 160 // Static. |
| 152 void BrowsingDataRemover::set_removing(bool removing) { | 161 void BrowsingDataRemover::set_removing(bool removing) { |
| 153 DCHECK(removing_ != removing); | 162 DCHECK(removing_ != removing); |
| 154 removing_ = removing; | 163 removing_ = removing; |
| 155 } | 164 } |
| 156 | 165 |
| 157 // Static. | 166 // Static. |
| 158 int BrowsingDataRemover::GenerateQuotaClientMask(int remove_mask) { | 167 int BrowsingDataRemover::GenerateQuotaClientMask(int remove_mask) { |
| 159 int quota_client_mask = 0; | 168 int quota_client_mask = 0; |
| 160 if (remove_mask & BrowsingDataRemover::REMOVE_FILE_SYSTEMS) | 169 if (remove_mask & BrowsingDataRemover::REMOVE_FILE_SYSTEMS) |
| 161 quota_client_mask |= quota::QuotaClient::kFileSystem; | 170 quota_client_mask |= quota::QuotaClient::kFileSystem; |
| 162 if (remove_mask & BrowsingDataRemover::REMOVE_WEBSQL) | 171 if (remove_mask & BrowsingDataRemover::REMOVE_WEBSQL) |
| 163 quota_client_mask |= quota::QuotaClient::kDatabase; | 172 quota_client_mask |= quota::QuotaClient::kDatabase; |
| 164 if (remove_mask & BrowsingDataRemover::REMOVE_APPCACHE) | 173 if (remove_mask & BrowsingDataRemover::REMOVE_APPCACHE) |
| 165 quota_client_mask |= quota::QuotaClient::kAppcache; | 174 quota_client_mask |= quota::QuotaClient::kAppcache; |
| 166 if (remove_mask & BrowsingDataRemover::REMOVE_INDEXEDDB) | 175 if (remove_mask & BrowsingDataRemover::REMOVE_INDEXEDDB) |
| 167 quota_client_mask |= quota::QuotaClient::kIndexedDatabase; | 176 quota_client_mask |= quota::QuotaClient::kIndexedDatabase; |
| 168 | 177 |
| 169 return quota_client_mask; | 178 return quota_client_mask; |
| 170 } | 179 } |
| 171 | 180 |
| 172 void BrowsingDataRemover::Remove(int remove_mask) { | 181 void BrowsingDataRemover::Remove(int remove_mask, int origin_set_mask) { |
| 173 RemoveImpl(remove_mask, GURL(), false); | 182 RemoveImpl(remove_mask, GURL(), origin_set_mask); |
| 174 } | 183 } |
| 175 | 184 |
| 176 void BrowsingDataRemover::RemoveImpl(int remove_mask, | 185 void BrowsingDataRemover::RemoveImpl(int remove_mask, |
| 177 const GURL& origin, | 186 const GURL& origin, |
| 178 bool remove_protected_origins) { | 187 int origin_set_mask) { |
| 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 180 set_removing(true); | 189 set_removing(true); |
| 181 remove_mask_ = remove_mask; | 190 remove_mask_ = remove_mask; |
| 182 remove_origin_ = origin; | 191 remove_origin_ = origin; |
| 183 remove_protected_ = remove_protected_origins; | 192 origin_set_mask_ = origin_set_mask; |
| 184 | 193 |
| 185 if (remove_mask & REMOVE_HISTORY) { | 194 if (remove_mask & REMOVE_HISTORY) { |
| 186 HistoryService* history_service = | 195 HistoryService* history_service = |
| 187 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 196 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 188 if (history_service) { | 197 if (history_service) { |
| 189 std::set<GURL> restrict_urls; | 198 std::set<GURL> restrict_urls; |
| 190 if (!remove_origin_.is_empty()) | 199 if (!remove_origin_.is_empty()) |
| 191 restrict_urls.insert(remove_origin_); | 200 restrict_urls.insert(remove_origin_); |
| 192 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | 201 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); |
| 193 waiting_for_clear_history_ = true; | 202 waiting_for_clear_history_ = true; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 if (rq_context) { | 313 if (rq_context) { |
| 305 waiting_for_clear_server_bound_certs_ = true; | 314 waiting_for_clear_server_bound_certs_ = true; |
| 306 BrowserThread::PostTask( | 315 BrowserThread::PostTask( |
| 307 BrowserThread::IO, FROM_HERE, | 316 BrowserThread::IO, FROM_HERE, |
| 308 base::Bind(&BrowsingDataRemover::ClearServerBoundCertsOnIOThread, | 317 base::Bind(&BrowsingDataRemover::ClearServerBoundCertsOnIOThread, |
| 309 base::Unretained(this), base::Unretained(rq_context))); | 318 base::Unretained(this), base::Unretained(rq_context))); |
| 310 } | 319 } |
| 311 } | 320 } |
| 312 | 321 |
| 313 if (remove_mask & REMOVE_LOCAL_STORAGE) { | 322 if (remove_mask & REMOVE_LOCAL_STORAGE) { |
| 314 BrowserContext::GetDOMStorageContext(profile_)->DeleteDataModifiedSince( | 323 waiting_for_clear_local_storage_ = true; |
| 315 delete_begin_); | 324 if (!dom_storage_context_) |
| 325 dom_storage_context_ = BrowserContext::GetDOMStorageContext(profile_); | |
| 326 BrowserThread::PostTask( | |
| 327 BrowserThread::IO, FROM_HERE, | |
| 328 base::Bind(&BrowsingDataRemover::ClearLocalStorageOnIOThread, | |
|
michaeln
2012/06/01 03:13:40
Also, its fine to call the DSC methods on the UI t
| |
| 329 base::Unretained(this))); | |
| 316 } | 330 } |
| 317 | 331 |
| 318 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || | 332 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || |
| 319 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { | 333 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { |
| 320 if (!quota_manager_) | 334 if (!quota_manager_) |
| 321 quota_manager_ = content::BrowserContext::GetQuotaManager(profile_); | 335 quota_manager_ = content::BrowserContext::GetQuotaManager(profile_); |
| 322 waiting_for_clear_quota_managed_data_ = true; | 336 waiting_for_clear_quota_managed_data_ = true; |
| 323 BrowserThread::PostTask( | 337 BrowserThread::PostTask( |
| 324 BrowserThread::IO, FROM_HERE, | 338 BrowserThread::IO, FROM_HERE, |
| 325 base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread, | 339 base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 } | 603 } |
| 590 default: { | 604 default: { |
| 591 NOTREACHED() << "bad state"; | 605 NOTREACHED() << "bad state"; |
| 592 next_cache_state_ = STATE_NONE; // Stop looping. | 606 next_cache_state_ = STATE_NONE; // Stop looping. |
| 593 break; | 607 break; |
| 594 } | 608 } |
| 595 } | 609 } |
| 596 } | 610 } |
| 597 } | 611 } |
| 598 | 612 |
| 613 void BrowsingDataRemover::ClearLocalStorageOnIOThread() { | |
| 614 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 615 DCHECK(waiting_for_clear_local_storage_); | |
| 616 | |
| 617 dom_storage_context_->GetAllStorageFiles( | |
|
michaeln
2012/05/31 22:49:07
The return type for this method pains me... a list
| |
| 618 base::Bind(&BrowsingDataRemover::OnGotLocalStorageFiles, | |
| 619 base::Unretained(this))); | |
| 620 } | |
| 621 | |
| 622 void BrowsingDataRemover::OnGotLocalStorageFiles( | |
| 623 const std::vector<FilePath>& files) { | |
| 624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 625 DCHECK(waiting_for_clear_local_storage_); | |
| 626 | |
| 627 for (size_t i = 0; i < files.size(); ++i) { | |
| 628 FilePath file_path = files[i]; | |
| 629 GURL origin(WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( | |
| 630 webkit_glue::FilePathToWebString(file_path.BaseName())).toString()); | |
| 631 if (!BrowsingDataHelper::DoesOriginMatchMask(origin, origin_set_mask_, | |
| 632 special_storage_policy_)) | |
| 633 continue; | |
| 634 | |
| 635 base::PlatformFileInfo file_info; | |
| 636 file_util::GetFileInfo(file_path, &file_info); | |
|
Bernhard Bauer
2012/05/31 15:57:31
Wait, are you doing file access on the IO thread?
Mike West
2012/06/01 13:35:17
No! Well, not now anyway.
| |
| 637 | |
| 638 if (file_info.last_modified >= delete_begin_ && | |
| 639 file_info.last_modified <= delete_end_) | |
| 640 dom_storage_context_->DeleteLocalStorageFile(file_path); | |
| 641 } | |
| 642 BrowserThread::PostTask( | |
| 643 BrowserThread::UI, FROM_HERE, | |
| 644 base::Bind(&BrowsingDataRemover::OnLocalStorageCleared, | |
| 645 base::Unretained(this))); | |
| 646 } | |
| 647 | |
| 648 void BrowsingDataRemover::OnLocalStorageCleared() { | |
| 649 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 650 DCHECK(waiting_for_clear_local_storage_); | |
| 651 waiting_for_clear_local_storage_ = false; | |
| 652 NotifyAndDeleteIfDone(); | |
| 653 } | |
| 654 | |
| 599 void BrowsingDataRemover::ClearQuotaManagedDataOnIOThread() { | 655 void BrowsingDataRemover::ClearQuotaManagedDataOnIOThread() { |
| 600 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 656 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 601 | 657 |
| 602 // Ask the QuotaManager for all origins with temporary quota modified within | 658 // Ask the QuotaManager for all origins with temporary quota modified within |
| 603 // the user-specified timeframe, and deal with the resulting set in | 659 // the user-specified timeframe, and deal with the resulting set in |
| 604 // OnGotQuotaManagedOrigins(). | 660 // OnGotQuotaManagedOrigins(). |
| 605 quota_managed_origins_to_delete_count_ = 0; | 661 quota_managed_origins_to_delete_count_ = 0; |
| 606 quota_managed_storage_types_to_delete_count_ = 2; | 662 quota_managed_storage_types_to_delete_count_ = 2; |
| 607 | 663 |
| 608 if (delete_begin_ == base::Time()) { | 664 if (delete_begin_ == base::Time() || |
| 609 // If we're deleting since the beginning of time, ask the QuotaManager for | 665 origin_set_mask_ & |
| 610 // all origins with persistent quota modified within the user-specified | 666 (BrowsingDataHelper::PROTECTED_WEB | BrowsingDataHelper::EXTENSION)) { |
| 611 // timeframe, and deal with the resulting set in | 667 // If we're deleting since the beginning of time, or we're removing |
| 612 // OnGotPersistentQuotaManagedOrigins. | 668 // protected origins, then ask the QuotaManager for all origins with |
| 669 // persistent quota modified within the user-specified timeframe, and deal | |
| 670 // with the resulting set in OnGotPersistentQuotaManagedOrigins. | |
| 613 quota_manager_->GetOriginsModifiedSince( | 671 quota_manager_->GetOriginsModifiedSince( |
| 614 quota::kStorageTypePersistent, delete_begin_, | 672 quota::kStorageTypePersistent, delete_begin_, |
| 615 base::Bind(&BrowsingDataRemover::OnGotQuotaManagedOrigins, | 673 base::Bind(&BrowsingDataRemover::OnGotQuotaManagedOrigins, |
| 616 base::Unretained(this))); | 674 base::Unretained(this))); |
| 617 } else { | 675 } else { |
| 618 // Otherwise, we don't need to deal with persistent storage. | 676 // Otherwise, we don't need to deal with persistent storage. |
| 619 --quota_managed_storage_types_to_delete_count_; | 677 --quota_managed_storage_types_to_delete_count_; |
| 620 } | 678 } |
| 621 | 679 |
| 622 // Do the same for temporary quota, regardless, passing the resulting set into | 680 if (origin_set_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
| 623 // OnGotTemporaryQuotaManagedOrigins. | 681 // Do the same for temporary quota, if we're removing unprotected origins, |
| 624 quota_manager_->GetOriginsModifiedSince( | 682 // by passing the resulting set into OnGotTemporaryQuotaManagedOrigins. |
| 625 quota::kStorageTypeTemporary, delete_begin_, | 683 quota_manager_->GetOriginsModifiedSince( |
| 626 base::Bind(&BrowsingDataRemover::OnGotQuotaManagedOrigins, | 684 quota::kStorageTypeTemporary, delete_begin_, |
| 627 base::Unretained(this))); | 685 base::Bind(&BrowsingDataRemover::OnGotQuotaManagedOrigins, |
| 686 base::Unretained(this))); | |
| 687 } | |
|
Bernhard Bauer
2012/05/31 15:57:31
Do you need to decrement the count in the other ca
Mike West
2012/06/01 13:35:17
Makes sense. Done.
| |
| 628 } | 688 } |
| 629 | 689 |
| 630 void BrowsingDataRemover::OnGotQuotaManagedOrigins( | 690 void BrowsingDataRemover::OnGotQuotaManagedOrigins( |
| 631 const std::set<GURL>& origins, quota::StorageType type) { | 691 const std::set<GURL>& origins, quota::StorageType type) { |
| 632 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); | 692 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); |
| 633 // Walk through the origins passed in, delete quota of |type| from each that | 693 // Walk through the origins passed in, delete quota of |type| from each that |
| 634 // isn't protected. | 694 // matches the |origin_set_mask_|. |
| 635 std::set<GURL>::const_iterator origin; | 695 std::set<GURL>::const_iterator origin; |
| 636 for (origin = origins.begin(); origin != origins.end(); ++origin) { | 696 for (origin = origins.begin(); origin != origins.end(); ++origin) { |
| 637 if (!BrowsingDataHelper::IsValidScheme(origin->scheme())) | |
| 638 continue; | |
| 639 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) | |
| 640 continue; | |
| 641 if (!remove_origin_.is_empty() && remove_origin_ != origin->GetOrigin()) | 697 if (!remove_origin_.is_empty() && remove_origin_ != origin->GetOrigin()) |
|
Bernhard Bauer
2012/05/31 15:57:31
This whole thing looks weird. If |remote_origin_|
Mike West
2012/06/01 13:35:17
You're entirely correct, and it's certainly someth
| |
| 642 continue; | 698 continue; |
| 699 | |
| 700 if (!BrowsingDataHelper::DoesOriginMatchMask(origin->GetOrigin(), | |
| 701 origin_set_mask_, | |
| 702 special_storage_policy_)) | |
| 703 continue; | |
| 704 | |
| 643 ++quota_managed_origins_to_delete_count_; | 705 ++quota_managed_origins_to_delete_count_; |
| 644 quota_manager_->DeleteOriginData( | 706 quota_manager_->DeleteOriginData( |
| 645 origin->GetOrigin(), type, | 707 origin->GetOrigin(), type, |
| 646 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_), | 708 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_), |
| 647 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, | 709 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, |
| 648 base::Unretained(this))); | 710 base::Unretained(this))); |
| 649 } | 711 } |
| 650 | 712 |
| 651 --quota_managed_storage_types_to_delete_count_; | 713 --quota_managed_storage_types_to_delete_count_; |
| 652 CheckQuotaManagedDataDeletionStatus(); | 714 CheckQuotaManagedDataDeletionStatus(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 BrowserThread::UI, FROM_HERE, | 797 BrowserThread::UI, FROM_HERE, |
| 736 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, | 798 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, |
| 737 base::Unretained(this))); | 799 base::Unretained(this))); |
| 738 } | 800 } |
| 739 | 801 |
| 740 void BrowsingDataRemover::OnClearedServerBoundCerts() { | 802 void BrowsingDataRemover::OnClearedServerBoundCerts() { |
| 741 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 803 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 742 waiting_for_clear_server_bound_certs_ = false; | 804 waiting_for_clear_server_bound_certs_ = false; |
| 743 NotifyAndDeleteIfDone(); | 805 NotifyAndDeleteIfDone(); |
| 744 } | 806 } |
| OLD | NEW |