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