| 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/browsing_data_remover_impl.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 if (remove_mask & DATA_TYPE_CHANNEL_IDS && | 397 if (remove_mask & DATA_TYPE_CHANNEL_IDS && |
| 398 origin_type_mask_ & ORIGIN_TYPE_UNPROTECTED_WEB) { | 398 origin_type_mask_ & ORIGIN_TYPE_UNPROTECTED_WEB) { |
| 399 base::RecordAction(UserMetricsAction("ClearBrowsingData_ChannelIDs")); | 399 base::RecordAction(UserMetricsAction("ClearBrowsingData_ChannelIDs")); |
| 400 // Since we are running on the UI thread don't call GetURLRequestContext(). | 400 // Since we are running on the UI thread don't call GetURLRequestContext(). |
| 401 scoped_refptr<net::URLRequestContextGetter> rq_context = | 401 scoped_refptr<net::URLRequestContextGetter> rq_context = |
| 402 content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> | 402 content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> |
| 403 GetURLRequestContext(); | 403 GetURLRequestContext(); |
| 404 clear_channel_ids_.Start(); | 404 clear_channel_ids_.Start(); |
| 405 BrowserThread::PostTask( | 405 BrowserThread::PostTask( |
| 406 BrowserThread::IO, FROM_HERE, | 406 BrowserThread::IO, FROM_HERE, |
| 407 base::Bind(&ClearChannelIDsOnIOThread, | 407 base::BindOnce(&ClearChannelIDsOnIOThread, |
| 408 filter_builder.BuildChannelIDFilter(), | 408 filter_builder.BuildChannelIDFilter(), delete_begin_, |
| 409 delete_begin_, delete_end_, std::move(rq_context), | 409 delete_end_, std::move(rq_context), |
| 410 clear_channel_ids_.GetCompletionCallback())); | 410 clear_channel_ids_.GetCompletionCallback())); |
| 411 } | 411 } |
| 412 | 412 |
| 413 ////////////////////////////////////////////////////////////////////////////// | 413 ////////////////////////////////////////////////////////////////////////////// |
| 414 // STORAGE PARTITION DATA | 414 // STORAGE PARTITION DATA |
| 415 uint32_t storage_partition_remove_mask = 0; | 415 uint32_t storage_partition_remove_mask = 0; |
| 416 | 416 |
| 417 // We ignore the DATA_TYPE_COOKIES request if UNPROTECTED_WEB is not set, | 417 // We ignore the DATA_TYPE_COOKIES request if UNPROTECTED_WEB is not set, |
| 418 // so that callers who request DATA_TYPE_SITE_DATA with another origin type | 418 // so that callers who request DATA_TYPE_SITE_DATA with another origin type |
| 419 // don't accidentally remove the cookies that are associated with the | 419 // don't accidentally remove the cookies that are associated with the |
| 420 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | 420 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 526 |
| 527 ////////////////////////////////////////////////////////////////////////////// | 527 ////////////////////////////////////////////////////////////////////////////// |
| 528 // Auth cache. | 528 // Auth cache. |
| 529 if (remove_mask & DATA_TYPE_COOKIES) { | 529 if (remove_mask & DATA_TYPE_COOKIES) { |
| 530 scoped_refptr<net::URLRequestContextGetter> request_context = | 530 scoped_refptr<net::URLRequestContextGetter> request_context = |
| 531 BrowserContext::GetDefaultStoragePartition(browser_context_) | 531 BrowserContext::GetDefaultStoragePartition(browser_context_) |
| 532 ->GetURLRequestContext(); | 532 ->GetURLRequestContext(); |
| 533 clear_http_auth_cache_.Start(); | 533 clear_http_auth_cache_.Start(); |
| 534 BrowserThread::PostTaskAndReply( | 534 BrowserThread::PostTaskAndReply( |
| 535 BrowserThread::IO, FROM_HERE, | 535 BrowserThread::IO, FROM_HERE, |
| 536 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), | 536 base::BindOnce(&ClearHttpAuthCacheOnIOThread, |
| 537 delete_begin_), | 537 std::move(request_context), delete_begin_), |
| 538 clear_http_auth_cache_.GetCompletionCallback()); | 538 clear_http_auth_cache_.GetCompletionCallback()); |
| 539 } | 539 } |
| 540 | 540 |
| 541 ////////////////////////////////////////////////////////////////////////////// | 541 ////////////////////////////////////////////////////////////////////////////// |
| 542 // Embedder data. | 542 // Embedder data. |
| 543 if (embedder_delegate_) { | 543 if (embedder_delegate_) { |
| 544 clear_embedder_data_.Start(); | 544 clear_embedder_data_.Start(); |
| 545 embedder_delegate_->RemoveEmbedderData( | 545 embedder_delegate_->RemoveEmbedderData( |
| 546 delete_begin_, | 546 delete_begin_, |
| 547 delete_end_, | 547 delete_end_, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 // All removal tasks have finished. Inform the observers that we're idle. | 641 // All removal tasks have finished. Inform the observers that we're idle. |
| 642 SetRemoving(false); | 642 SetRemoving(false); |
| 643 return; | 643 return; |
| 644 } | 644 } |
| 645 | 645 |
| 646 // Yield to the UI thread before executing the next removal task. | 646 // Yield to the UI thread before executing the next removal task. |
| 647 // TODO(msramek): Consider also adding a backoff if too many tasks | 647 // TODO(msramek): Consider also adding a backoff if too many tasks |
| 648 // are scheduled. | 648 // are scheduled. |
| 649 BrowserThread::PostTask( | 649 BrowserThread::PostTask( |
| 650 BrowserThread::UI, FROM_HERE, | 650 BrowserThread::UI, FROM_HERE, |
| 651 base::Bind(&BrowsingDataRemoverImpl::RunNextTask, GetWeakPtr())); | 651 base::BindOnce(&BrowsingDataRemoverImpl::RunNextTask, GetWeakPtr())); |
| 652 } | 652 } |
| 653 | 653 |
| 654 void BrowsingDataRemoverImpl::NotifyIfDone() { | 654 void BrowsingDataRemoverImpl::NotifyIfDone() { |
| 655 // TODO(brettw) http://crbug.com/305259: This should also observe session | 655 // TODO(brettw) http://crbug.com/305259: This should also observe session |
| 656 // clearing (what about other things such as passwords, etc.?) and wait for | 656 // clearing (what about other things such as passwords, etc.?) and wait for |
| 657 // them to complete before continuing. | 657 // them to complete before continuing. |
| 658 | 658 |
| 659 if (!AllDone()) | 659 if (!AllDone()) |
| 660 return; | 660 return; |
| 661 | 661 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 672 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 672 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 673 base::WeakPtr<BrowsingDataRemoverImpl> weak_ptr = | 673 base::WeakPtr<BrowsingDataRemoverImpl> weak_ptr = |
| 674 weak_ptr_factory_.GetWeakPtr(); | 674 weak_ptr_factory_.GetWeakPtr(); |
| 675 | 675 |
| 676 // Immediately bind the weak pointer to the UI thread. This makes it easier | 676 // Immediately bind the weak pointer to the UI thread. This makes it easier |
| 677 // to discover potential misuse on the IO thread. | 677 // to discover potential misuse on the IO thread. |
| 678 weak_ptr.get(); | 678 weak_ptr.get(); |
| 679 | 679 |
| 680 return weak_ptr; | 680 return weak_ptr; |
| 681 } | 681 } |
| OLD | NEW |