| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); | 294 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); |
| 295 if (rq_context) { | 295 if (rq_context) { |
| 296 waiting_for_clear_origin_bound_certs_ = true; | 296 waiting_for_clear_origin_bound_certs_ = true; |
| 297 BrowserThread::PostTask( | 297 BrowserThread::PostTask( |
| 298 BrowserThread::IO, FROM_HERE, | 298 BrowserThread::IO, FROM_HERE, |
| 299 base::Bind(&BrowsingDataRemover::ClearOriginBoundCertsOnIOThread, | 299 base::Bind(&BrowsingDataRemover::ClearOriginBoundCertsOnIOThread, |
| 300 base::Unretained(this), base::Unretained(rq_context))); | 300 base::Unretained(this), base::Unretained(rq_context))); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 if (remove_mask & REMOVE_LOCAL_STORAGE && | 304 if (remove_mask & REMOVE_LOCAL_STORAGE) { |
| 305 BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) { | |
| 306 DOMStorageContext* context = BrowserContext::GetDOMStorageContext(profile_); | 305 DOMStorageContext* context = BrowserContext::GetDOMStorageContext(profile_); |
| 307 BrowserThread::PostTask( | 306 context->task_runner()->PostTask( |
| 308 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, | 307 FROM_HERE, |
| 309 base::Bind(&BrowsingDataRemover::ClearDOMStorageOnWebKitThread, | 308 base::Bind(&BrowsingDataRemover::ClearDOMStorageInSequencedTask, |
| 310 base::Unretained(this), make_scoped_refptr(context))); | 309 base::Unretained(this), make_scoped_refptr(context))); |
| 311 } | 310 } |
| 312 | 311 |
| 313 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || | 312 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || |
| 314 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { | 313 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { |
| 315 if (!quota_manager_) | 314 if (!quota_manager_) |
| 316 quota_manager_ = content::BrowserContext::GetQuotaManager(profile_); | 315 quota_manager_ = content::BrowserContext::GetQuotaManager(profile_); |
| 317 waiting_for_clear_quota_managed_data_ = true; | 316 waiting_for_clear_quota_managed_data_ = true; |
| 318 BrowserThread::PostTask( | 317 BrowserThread::PostTask( |
| 319 BrowserThread::IO, FROM_HERE, | 318 BrowserThread::IO, FROM_HERE, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 case EVERYTHING: | 428 case EVERYTHING: |
| 430 delete_begin_time = base::Time(); | 429 delete_begin_time = base::Time(); |
| 431 break; | 430 break; |
| 432 default: | 431 default: |
| 433 NOTREACHED() << L"Missing item"; | 432 NOTREACHED() << L"Missing item"; |
| 434 break; | 433 break; |
| 435 } | 434 } |
| 436 return delete_begin_time - diff; | 435 return delete_begin_time - diff; |
| 437 } | 436 } |
| 438 | 437 |
| 439 void BrowsingDataRemover::ClearDOMStorageOnWebKitThread( | 438 void BrowsingDataRemover::ClearDOMStorageInSequencedTask( |
| 440 scoped_refptr<DOMStorageContext> dom_storage_context) { | 439 DOMStorageContext* dom_storage_context) { |
| 441 // We assume the end time is now. | 440 // We assume the end time is now. |
| 441 DCHECK(dom_storage_context->task_runner()->RunsTasksOnCurrentThread()); |
| 442 dom_storage_context->DeleteDataModifiedSince(delete_begin_); | 442 dom_storage_context->DeleteDataModifiedSince(delete_begin_); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void BrowsingDataRemover::Observe(int type, | 445 void BrowsingDataRemover::Observe(int type, |
| 446 const content::NotificationSource& source, | 446 const content::NotificationSource& source, |
| 447 const content::NotificationDetails& details) { | 447 const content::NotificationDetails& details) { |
| 448 // TODO(brettw) bug 1139736: This should also observe session | 448 // TODO(brettw) bug 1139736: This should also observe session |
| 449 // clearing (what about other things such as passwords, etc.?) and wait for | 449 // clearing (what about other things such as passwords, etc.?) and wait for |
| 450 // them to complete before continuing. | 450 // them to complete before continuing. |
| 451 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); | 451 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 BrowserThread::UI, FROM_HERE, | 712 BrowserThread::UI, FROM_HERE, |
| 713 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts, | 713 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts, |
| 714 base::Unretained(this))); | 714 base::Unretained(this))); |
| 715 } | 715 } |
| 716 | 716 |
| 717 void BrowsingDataRemover::OnClearedOriginBoundCerts() { | 717 void BrowsingDataRemover::OnClearedOriginBoundCerts() { |
| 718 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 718 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 719 waiting_for_clear_origin_bound_certs_ = false; | 719 waiting_for_clear_origin_bound_certs_ = false; |
| 720 NotifyAndDeleteIfDone(); | 720 NotifyAndDeleteIfDone(); |
| 721 } | 721 } |
| OLD | NEW |