OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | |
11 | |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/file_util.h" | 13 #include "base/file_util.h" |
12 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
13 #include "chrome/browser/autofill/personal_data_manager.h" | 15 #include "chrome/browser/autofill/personal_data_manager.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/download/download_manager.h" | 17 #include "chrome/browser/download/download_manager.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 19 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
18 #include "chrome/browser/history/history.h" | 20 #include "chrome/browser/history/history.h" |
19 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
39 #include "content/common/notification_source.h" | 41 #include "content/common/notification_source.h" |
40 #include "net/base/cookie_monster.h" | 42 #include "net/base/cookie_monster.h" |
41 #include "net/base/net_errors.h" | 43 #include "net/base/net_errors.h" |
42 #include "net/base/transport_security_state.h" | 44 #include "net/base/transport_security_state.h" |
43 #include "net/disk_cache/disk_cache.h" | 45 #include "net/disk_cache/disk_cache.h" |
44 #include "net/http/http_cache.h" | 46 #include "net/http/http_cache.h" |
45 #include "net/url_request/url_request_context.h" | 47 #include "net/url_request/url_request_context.h" |
46 #include "net/url_request/url_request_context_getter.h" | 48 #include "net/url_request/url_request_context_getter.h" |
47 #include "webkit/database/database_tracker.h" | 49 #include "webkit/database/database_tracker.h" |
48 #include "webkit/database/database_util.h" | 50 #include "webkit/database/database_util.h" |
49 #include "webkit/fileapi/file_system_context.h" | 51 #include "webkit/quota/quota_types.h" |
50 #include "webkit/fileapi/file_system_operation_context.h" | 52 #include "webkit/quota/quota_manager.h" |
51 #include "webkit/fileapi/sandbox_mount_point_provider.h" | |
52 | 53 |
53 // Done so that we can use PostTask on BrowsingDataRemovers and not have | 54 // Done so that we can use PostTask on BrowsingDataRemovers and not have |
54 // BrowsingDataRemover implement RefCounted. | 55 // BrowsingDataRemover implement RefCounted. |
55 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowsingDataRemover); | 56 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowsingDataRemover); |
56 | 57 |
57 bool BrowsingDataRemover::removing_ = false; | 58 bool BrowsingDataRemover::removing_ = false; |
58 | 59 |
59 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, | 60 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, |
60 base::Time delete_begin, | 61 base::Time delete_begin, |
61 base::Time delete_end) | 62 base::Time delete_end) |
62 : profile_(profile), | 63 : profile_(profile), |
64 quota_manager_(NULL), | |
63 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), | 65 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), |
64 delete_begin_(delete_begin), | 66 delete_begin_(delete_begin), |
65 delete_end_(delete_end), | 67 delete_end_(delete_end), |
66 ALLOW_THIS_IN_INITIALIZER_LIST(database_cleared_callback_( | 68 ALLOW_THIS_IN_INITIALIZER_LIST(database_cleared_callback_( |
67 this, &BrowsingDataRemover::OnClearedDatabases)), | 69 this, &BrowsingDataRemover::OnClearedDatabases)), |
68 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( | 70 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( |
69 this, &BrowsingDataRemover::DoClearCache)), | 71 this, &BrowsingDataRemover::DoClearCache)), |
70 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_got_info_callback_( | |
71 this, &BrowsingDataRemover::OnGotAppCacheInfo)), | |
72 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_deleted_callback_( | |
73 this, &BrowsingDataRemover::OnAppCacheDeleted)), | |
74 appcaches_to_be_deleted_count_(0), | |
75 next_cache_state_(STATE_NONE), | 72 next_cache_state_(STATE_NONE), |
76 cache_(NULL), | 73 cache_(NULL), |
77 main_context_getter_(profile->GetRequestContext()), | 74 main_context_getter_(profile->GetRequestContext()), |
78 media_context_getter_(profile->GetRequestContextForMedia()), | 75 media_context_getter_(profile->GetRequestContextForMedia()), |
79 waiting_for_clear_databases_(false), | 76 waiting_for_clear_databases_(false), |
80 waiting_for_clear_history_(false), | 77 waiting_for_clear_history_(false), |
78 waiting_for_clear_temporary_quota_managed_data_(false), | |
79 waiting_for_clear_persistent_quota_managed_data_(false), | |
81 waiting_for_clear_networking_history_(false), | 80 waiting_for_clear_networking_history_(false), |
82 waiting_for_clear_cache_(false), | 81 waiting_for_clear_cache_(false), |
83 waiting_for_clear_appcache_(false), | |
84 waiting_for_clear_gears_data_(false), | 82 waiting_for_clear_gears_data_(false), |
85 waiting_for_clear_file_systems_(false) { | 83 temporary_quota_origins_to_delete_count_(0) { |
86 DCHECK(profile); | 84 DCHECK(profile); |
87 } | 85 } |
88 | 86 |
89 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, | 87 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, |
90 TimePeriod time_period, | 88 TimePeriod time_period, |
91 base::Time delete_end) | 89 base::Time delete_end) |
92 : profile_(profile), | 90 : profile_(profile), |
91 quota_manager_(NULL), | |
93 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), | 92 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), |
94 delete_begin_(CalculateBeginDeleteTime(time_period)), | 93 delete_begin_(CalculateBeginDeleteTime(time_period)), |
95 delete_end_(delete_end), | 94 delete_end_(delete_end), |
96 ALLOW_THIS_IN_INITIALIZER_LIST(database_cleared_callback_( | 95 ALLOW_THIS_IN_INITIALIZER_LIST(database_cleared_callback_( |
97 this, &BrowsingDataRemover::OnClearedDatabases)), | 96 this, &BrowsingDataRemover::OnClearedDatabases)), |
98 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( | 97 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( |
99 this, &BrowsingDataRemover::DoClearCache)), | 98 this, &BrowsingDataRemover::DoClearCache)), |
100 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_got_info_callback_( | |
101 this, &BrowsingDataRemover::OnGotAppCacheInfo)), | |
102 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_deleted_callback_( | |
103 this, &BrowsingDataRemover::OnAppCacheDeleted)), | |
104 appcaches_to_be_deleted_count_(0), | |
105 next_cache_state_(STATE_NONE), | 99 next_cache_state_(STATE_NONE), |
106 cache_(NULL), | 100 cache_(NULL), |
107 main_context_getter_(profile->GetRequestContext()), | 101 main_context_getter_(profile->GetRequestContext()), |
108 media_context_getter_(profile->GetRequestContextForMedia()), | 102 media_context_getter_(profile->GetRequestContextForMedia()), |
109 waiting_for_clear_databases_(false), | 103 waiting_for_clear_databases_(false), |
110 waiting_for_clear_history_(false), | 104 waiting_for_clear_history_(false), |
105 waiting_for_clear_temporary_quota_managed_data_(false), | |
106 waiting_for_clear_persistent_quota_managed_data_(false), | |
111 waiting_for_clear_networking_history_(false), | 107 waiting_for_clear_networking_history_(false), |
112 waiting_for_clear_cache_(false), | 108 waiting_for_clear_cache_(false), |
113 waiting_for_clear_appcache_(false), | |
114 waiting_for_clear_lso_data_(false), | |
115 waiting_for_clear_gears_data_(false), | 109 waiting_for_clear_gears_data_(false), |
116 waiting_for_clear_file_systems_(false) { | 110 temporary_quota_origins_to_delete_count_(0) { |
117 DCHECK(profile); | 111 DCHECK(profile); |
118 } | 112 } |
119 | 113 |
120 BrowsingDataRemover::~BrowsingDataRemover() { | 114 BrowsingDataRemover::~BrowsingDataRemover() { |
121 DCHECK(all_done()); | 115 DCHECK(all_done()); |
122 } | 116 } |
123 | 117 |
124 void BrowsingDataRemover::Remove(int remove_mask) { | 118 void BrowsingDataRemover::Remove(int remove_mask) { |
125 DCHECK(!removing_); | 119 DCHECK(!removing_); |
126 removing_ = true; | 120 removing_ = true; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 GetCookieMonster(); | 199 GetCookieMonster(); |
206 } | 200 } |
207 if (cookie_monster) | 201 if (cookie_monster) |
208 cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true); | 202 cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true); |
209 | 203 |
210 // REMOVE_COOKIES is actually "cookies and other site data" so we make sure | 204 // REMOVE_COOKIES is actually "cookies and other site data" so we make sure |
211 // to remove other data such local databases, STS state, etc. These only can | 205 // to remove other data such local databases, STS state, etc. These only can |
212 // be removed if a WEBKIT thread exists, so check that first: | 206 // be removed if a WEBKIT thread exists, so check that first: |
213 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT)) { | 207 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT)) { |
214 // We assume the end time is now. | 208 // We assume the end time is now. |
215 profile_->GetWebKitContext()->DeleteDataModifiedSince(delete_begin_); | 209 profile_->GetWebKitContext()->DeleteDataModifiedSince(delete_begin_); |
michaeln
2011/07/26 22:40:19
Unfortunately, removal of "WebDOMLocalStorage" is
| |
216 } | 210 } |
217 | 211 |
212 // We'll start by using the quota system to clear out AppCaches, WebSQL DBs, | |
213 // and File Systems. | |
214 quota_manager_ = profile_->GetQuotaManager(); | |
215 if (quota_manager_) { | |
216 waiting_for_clear_temporary_quota_managed_data_ = true; | |
217 waiting_for_clear_persistent_quota_managed_data_ = true; | |
218 BrowserThread::PostTask( | |
219 BrowserThread::IO, FROM_HERE, | |
220 NewRunnableMethod( | |
221 this, | |
222 &BrowsingDataRemover::ClearQuotaManagedDataOnIOThread)); | |
223 } | |
224 | |
218 database_tracker_ = profile_->GetDatabaseTracker(); | 225 database_tracker_ = profile_->GetDatabaseTracker(); |
219 if (database_tracker_.get()) { | 226 if (database_tracker_.get()) { |
220 waiting_for_clear_databases_ = true; | 227 waiting_for_clear_databases_ = true; |
221 BrowserThread::PostTask( | 228 BrowserThread::PostTask( |
222 BrowserThread::FILE, FROM_HERE, | 229 BrowserThread::FILE, FROM_HERE, |
223 NewRunnableMethod( | 230 NewRunnableMethod( |
224 this, | 231 this, |
225 &BrowsingDataRemover::ClearDatabasesOnFILEThread)); | 232 &BrowsingDataRemover::ClearDatabasesOnFILEThread)); |
michaeln
2011/07/26 22:40:19
Removal of WebSQLDatabases is taken care of by goi
| |
226 } | 233 } |
227 | 234 |
228 appcache_service_ = profile_->GetAppCacheService(); | |
229 if (appcache_service_.get()) { | |
230 waiting_for_clear_appcache_ = true; | |
231 BrowserThread::PostTask( | |
232 BrowserThread::IO, FROM_HERE, | |
233 NewRunnableMethod( | |
234 this, | |
235 &BrowsingDataRemover::ClearAppCacheOnIOThread)); | |
michaeln
2011/07/26 22:40:19
hoooray for deleted code!
| |
236 } | |
237 | |
238 waiting_for_clear_gears_data_ = true; | 235 waiting_for_clear_gears_data_ = true; |
239 BrowserThread::PostTask( | 236 BrowserThread::PostTask( |
240 BrowserThread::FILE, FROM_HERE, | 237 BrowserThread::FILE, FROM_HERE, |
241 NewRunnableMethod( | 238 NewRunnableMethod( |
242 this, | 239 this, |
243 &BrowsingDataRemover::ClearGearsDataOnFILEThread, | 240 &BrowsingDataRemover::ClearGearsDataOnFILEThread, |
244 profile_->GetPath())); | 241 profile_->GetPath())); |
245 | 242 |
246 waiting_for_clear_file_systems_ = true; | |
247 BrowserThread::PostTask( | |
248 BrowserThread::FILE, FROM_HERE, | |
249 NewRunnableMethod( | |
250 this, | |
251 &BrowsingDataRemover::ClearFileSystemsOnFILEThread)); | |
252 | |
253 if (profile_->GetTransportSecurityState()) { | 243 if (profile_->GetTransportSecurityState()) { |
254 BrowserThread::PostTask( | 244 BrowserThread::PostTask( |
255 BrowserThread::IO, FROM_HERE, | 245 BrowserThread::IO, FROM_HERE, |
256 NewRunnableMethod( | 246 NewRunnableMethod( |
257 profile_->GetTransportSecurityState(), | 247 profile_->GetTransportSecurityState(), |
258 &net::TransportSecurityState::DeleteSince, | 248 &net::TransportSecurityState::DeleteSince, |
259 delete_begin_)); | 249 delete_begin_)); |
260 } | 250 } |
261 } | 251 } |
262 | 252 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 | 497 |
508 void BrowsingDataRemover::ClearDatabasesOnFILEThread() { | 498 void BrowsingDataRemover::ClearDatabasesOnFILEThread() { |
509 // This function should be called on the FILE thread. | 499 // This function should be called on the FILE thread. |
510 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 500 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
511 int rv = database_tracker_->DeleteDataModifiedSince( | 501 int rv = database_tracker_->DeleteDataModifiedSince( |
512 delete_begin_, &database_cleared_callback_); | 502 delete_begin_, &database_cleared_callback_); |
513 if (rv != net::ERR_IO_PENDING) | 503 if (rv != net::ERR_IO_PENDING) |
514 OnClearedDatabases(rv); | 504 OnClearedDatabases(rv); |
515 } | 505 } |
516 | 506 |
517 void BrowsingDataRemover::OnClearedAppCache() { | 507 void BrowsingDataRemover::ClearQuotaManagedDataOnIOThread() { |
518 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 508 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
519 bool result = BrowserThread::PostTask( | 509 DCHECK(waiting_for_clear_temporary_quota_managed_data_); |
520 BrowserThread::UI, FROM_HERE, | 510 DCHECK(waiting_for_clear_persistent_quota_managed_data_); |
521 NewRunnableMethod(this, &BrowsingDataRemover::OnClearedAppCache)); | 511 |
522 DCHECK(result); | 512 // Ask the QuotaManager for all origins with temporary quota modified within |
523 return; | 513 // the user-specified timeframe, and deal with the resulting set in |
514 // OnGotQuotaManagedOrigins(). | |
515 temporary_quota_origins_to_delete_count_ = 0; | |
516 persistent_quota_origins_to_delete_count_ = 0; | |
517 | |
518 // If we're deleting since the beginning of time, ask the QuotaManager for all | |
519 // origins with persistent quota modified within the user-specified timeframe, | |
520 // and deal with the resulting set in OnGotPersistentQuotaManagedOrigins. | |
521 if (delete_begin_ == base::Time()) { | |
522 // FIXME(mkwst): This is broken. If I run persistent and temp, I get segfaults. | |
523 // I suspect that my mock sucks. :) | |
524 // profile_->GetQuotaManager()->GetOriginsModifiedSince( | |
525 // quota::kStorageTypePersistent, delete_begin_, NewCallback(this, | |
526 // &BrowsingDataRemover::OnGotPersistentQuotaManagedOrigins)); | |
527 waiting_for_clear_persistent_quota_managed_data_ = false; | |
528 } else { | |
529 // If not deleting since the beginning of time, we're done with any | |
530 // persistent quota. | |
531 waiting_for_clear_persistent_quota_managed_data_ = false; | |
524 } | 532 } |
525 waiting_for_clear_appcache_ = false; | 533 |
526 NotifyAndDeleteIfDone(); | 534 // Do the same for temporary quota, regardless. |
535 profile_->GetQuotaManager()->GetOriginsModifiedSince( | |
536 quota::kStorageTypeTemporary, delete_begin_, NewCallback(this, | |
537 &BrowsingDataRemover::OnGotTemporaryQuotaManagedOrigins)); | |
527 } | 538 } |
528 | 539 |
529 void BrowsingDataRemover::ClearAppCacheOnIOThread() { | 540 void BrowsingDataRemover::OnGotTemporaryQuotaManagedOrigins( |
530 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 541 const std::set<GURL>& origins) { |
531 DCHECK(waiting_for_clear_appcache_); | 542 // Walk through the origins passed in, delete temporary quota from each that |
532 appcache_info_ = new appcache::AppCacheInfoCollection; | 543 // isn't protected. |
533 appcache_service_->GetAllAppCacheInfo( | 544 std::set<GURL>::iterator origin; |
534 appcache_info_, &appcache_got_info_callback_); | 545 for (origin = origins.begin(); origin != origins.end(); ++origin) { |
535 // continues in OnGotAppCacheInfo. | 546 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) |
547 continue; | |
548 ++temporary_quota_origins_to_delete_count_; | |
549 quota_manager_->DeleteOriginData(origin->GetOrigin(), | |
550 quota::kStorageTypeTemporary, NewCallback(this, | |
551 &BrowsingDataRemover::OnTemporaryQuotaManagedOriginDeletion)); | |
552 } | |
553 CheckTemporaryQuotaManagedDataDeletionStatus(); | |
536 } | 554 } |
537 | 555 |
538 void BrowsingDataRemover::OnGotAppCacheInfo(int rv) { | 556 void BrowsingDataRemover::OnGotPersistentQuotaManagedOrigins( |
539 using appcache::AppCacheInfoVector; | 557 const std::set<GURL>& origins) { |
540 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; | 558 // Walk through the origins passed in, delete temporary quota from each that |
559 // isn't protected. | |
560 bool deleting = false; | |
561 std::set<GURL>::iterator origin; | |
562 for (origin = origins.begin(); origin != origins.end(); ++origin) { | |
563 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) | |
564 continue; | |
565 deleting = true; | |
566 ++persistent_quota_origins_to_delete_count_; | |
567 quota_manager_->DeleteOriginData(origin->GetOrigin(), | |
568 quota::kStorageTypePersistent, NewCallback(this, | |
569 &BrowsingDataRemover::OnPersistentQuotaManagedOriginDeletion)); | |
570 } | |
571 CheckPersistentQuotaManagedDataDeletionStatus(); | |
572 } | |
541 | 573 |
542 for (InfoByOrigin::const_iterator origin = | 574 void BrowsingDataRemover::OnTemporaryQuotaManagedOriginDeletion( |
543 appcache_info_->infos_by_origin.begin(); | 575 quota::QuotaStatusCode status) { |
544 origin != appcache_info_->infos_by_origin.end(); ++origin) { | 576 if (status != quota::kQuotaStatusOk) { |
545 if (special_storage_policy_->IsStorageProtected(origin->first)) | 577 // TODO(mkwst): Not really anything pretty I can think of to do here. |
546 continue; | |
547 for (AppCacheInfoVector::const_iterator info = origin->second.begin(); | |
548 info != origin->second.end(); ++info) { | |
549 if (info->creation_time > delete_begin_) { | |
550 ++appcaches_to_be_deleted_count_; | |
551 appcache_service_->DeleteAppCacheGroup( | |
552 info->manifest_url, &appcache_deleted_callback_); | |
553 } | |
554 } | |
555 } | 578 } |
556 | 579 |
557 if (!appcaches_to_be_deleted_count_) | 580 --temporary_quota_origins_to_delete_count_; |
558 OnClearedAppCache(); | 581 CheckTemporaryQuotaManagedDataDeletionStatus(); |
559 // else continues in OnAppCacheDeleted | |
560 } | 582 } |
561 | 583 |
562 void BrowsingDataRemover::OnAppCacheDeleted(int rv) { | 584 void BrowsingDataRemover::OnPersistentQuotaManagedOriginDeletion( |
563 --appcaches_to_be_deleted_count_; | 585 quota::QuotaStatusCode status) { |
564 if (!appcaches_to_be_deleted_count_) | 586 if (status != quota::kQuotaStatusOk) { |
565 OnClearedAppCache(); | 587 // TODO(mkwst): Not really anything pretty I can think of to do here. |
588 } | |
589 | |
590 --persistent_quota_origins_to_delete_count_; | |
591 CheckPersistentQuotaManagedDataDeletionStatus(); | |
566 } | 592 } |
567 | 593 |
568 void BrowsingDataRemover::ClearFileSystemsOnFILEThread() { | 594 void BrowsingDataRemover::CheckTemporaryQuotaManagedDataDeletionStatus() { |
569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 595 if (temporary_quota_origins_to_delete_count_ == 0 && |
570 DCHECK(waiting_for_clear_file_systems_); | 596 waiting_for_clear_temporary_quota_managed_data_) { |
571 scoped_refptr<fileapi::FileSystemContext> | 597 waiting_for_clear_temporary_quota_managed_data_ = false; |
572 fs_context(profile_->GetFileSystemContext()); | 598 BrowserThread::PostTask( |
573 scoped_ptr<fileapi::SandboxMountPointProvider::OriginEnumerator> | 599 BrowserThread::UI, FROM_HERE, |
574 origin_enumerator(fs_context->path_manager()->sandbox_provider()-> | 600 NewRunnableMethod( |
575 CreateOriginEnumerator()); | 601 this, |
576 | 602 &BrowsingDataRemover::NotifyAndDeleteIfDone)); |
577 GURL origin; | |
578 while (!(origin = origin_enumerator->Next()).is_empty()) { | |
579 if (special_storage_policy_->IsStorageProtected(origin)) | |
580 continue; | |
581 if (delete_begin_ == base::Time()) { | |
582 // If the user chooses to delete browsing data "since the beginning of | |
583 // time" remove both temporary and persistent file systems entirely. | |
584 fs_context->DeleteDataForOriginAndTypeOnFileThread(origin, | |
585 fileapi::kFileSystemTypeTemporary); | |
586 fs_context->DeleteDataForOriginAndTypeOnFileThread(origin, | |
587 fileapi::kFileSystemTypePersistent); | |
588 } | |
589 // TODO(mkwst): Else? Decide what to do for time-based deletion: crbug/63700 | |
590 } | 603 } |
591 | |
592 BrowserThread::PostTask( | |
593 BrowserThread::UI, FROM_HERE, | |
594 NewRunnableMethod(this, &BrowsingDataRemover::OnClearedFileSystems)); | |
595 } | 604 } |
596 | 605 |
597 void BrowsingDataRemover::OnClearedFileSystems() { | 606 void BrowsingDataRemover::CheckPersistentQuotaManagedDataDeletionStatus() { |
598 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 607 if (persistent_quota_origins_to_delete_count_ == 0 && |
599 waiting_for_clear_file_systems_ = false; | 608 waiting_for_clear_persistent_quota_managed_data_) { |
600 NotifyAndDeleteIfDone(); | 609 waiting_for_clear_persistent_quota_managed_data_ = false; |
610 BrowserThread::PostTask( | |
611 BrowserThread::UI, FROM_HERE, | |
612 NewRunnableMethod( | |
613 this, | |
614 &BrowsingDataRemover::NotifyAndDeleteIfDone)); | |
615 } | |
601 } | 616 } |
602 | 617 |
603 // static | 618 // static |
604 void BrowsingDataRemover::ClearGearsData(const FilePath& profile_dir) { | 619 void BrowsingDataRemover::ClearGearsData(const FilePath& profile_dir) { |
605 FilePath plugin_data = profile_dir.AppendASCII("Plugin Data"); | 620 FilePath plugin_data = profile_dir.AppendASCII("Plugin Data"); |
606 if (file_util::DirectoryExists(plugin_data)) | 621 if (file_util::DirectoryExists(plugin_data)) |
607 file_util::Delete(plugin_data, true); | 622 file_util::Delete(plugin_data, true); |
608 } | 623 } |
609 | 624 |
610 void BrowsingDataRemover::OnClearedGearsData() { | 625 void BrowsingDataRemover::OnClearedGearsData() { |
(...skipping 15 matching lines...) Expand all Loading... | |
626 | 641 |
627 ClearGearsData(profile_dir); | 642 ClearGearsData(profile_dir); |
628 OnClearedGearsData(); | 643 OnClearedGearsData(); |
629 } | 644 } |
630 | 645 |
631 void BrowsingDataRemover::OnWaitableEventSignaled( | 646 void BrowsingDataRemover::OnWaitableEventSignaled( |
632 base::WaitableEvent* waitable_event) { | 647 base::WaitableEvent* waitable_event) { |
633 waiting_for_clear_lso_data_ = false; | 648 waiting_for_clear_lso_data_ = false; |
634 NotifyAndDeleteIfDone(); | 649 NotifyAndDeleteIfDone(); |
635 } | 650 } |
OLD | NEW |