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.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 UserMetricsAction("ClearBrowsingData_Everything")); | 293 UserMetricsAction("ClearBrowsingData_Everything")); |
294 break; | 294 break; |
295 } | 295 } |
296 return TimeRange(CalculateBeginDeleteTime(period), base::Time::Max()); | 296 return TimeRange(CalculateBeginDeleteTime(period), base::Time::Max()); |
297 } | 297 } |
298 | 298 |
299 BrowsingDataRemover::BrowsingDataRemover( | 299 BrowsingDataRemover::BrowsingDataRemover( |
300 content::BrowserContext* browser_context) | 300 content::BrowserContext* browser_context) |
301 : profile_(Profile::FromBrowserContext(browser_context)), | 301 : profile_(Profile::FromBrowserContext(browser_context)), |
302 is_removing_(false), | 302 is_removing_(false), |
| 303 main_context_getter_(browser_context->GetRequestContext()), |
| 304 media_context_getter_(browser_context->GetMediaRequestContext()), |
303 #if BUILDFLAG(ANDROID_JAVA_UI) | 305 #if BUILDFLAG(ANDROID_JAVA_UI) |
304 webapp_registry_(new WebappRegistry()), | 306 webapp_registry_(new WebappRegistry()), |
305 #endif | 307 #endif |
306 weak_ptr_factory_(this) { | 308 weak_ptr_factory_(this) { |
307 DCHECK(browser_context); | 309 DCHECK(browser_context); |
308 } | 310 } |
309 | 311 |
310 BrowsingDataRemover::~BrowsingDataRemover() { | 312 BrowsingDataRemover::~BrowsingDataRemover() { |
311 // If we are still removing data, notify observers so they can remove | 313 // If we are still removing data, notify observers so they can remove |
312 // themselves from the observer list. | 314 // themselves from the observer list. |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 } | 637 } |
636 | 638 |
637 // Channel IDs are not separated for protected and unprotected web | 639 // Channel IDs are not separated for protected and unprotected web |
638 // origins. We check the origin_type_mask_ to prevent unintended deletion. | 640 // origins. We check the origin_type_mask_ to prevent unintended deletion. |
639 if (remove_mask & REMOVE_CHANNEL_IDS && | 641 if (remove_mask & REMOVE_CHANNEL_IDS && |
640 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { | 642 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { |
641 content::RecordAction( | 643 content::RecordAction( |
642 UserMetricsAction("ClearBrowsingData_ChannelIDs")); | 644 UserMetricsAction("ClearBrowsingData_ChannelIDs")); |
643 // Since we are running on the UI thread don't call GetURLRequestContext(). | 645 // Since we are running on the UI thread don't call GetURLRequestContext(). |
644 scoped_refptr<net::URLRequestContextGetter> rq_context = | 646 scoped_refptr<net::URLRequestContextGetter> rq_context = |
645 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 647 profile_->GetRequestContext(); |
646 GetURLRequestContext(); | 648 if (rq_context) { |
647 waiting_for_clear_channel_ids_ = true; | 649 waiting_for_clear_channel_ids_ = true; |
648 BrowserThread::PostTask( | 650 BrowserThread::PostTask( |
649 BrowserThread::IO, FROM_HERE, | 651 BrowserThread::IO, FROM_HERE, |
650 base::Bind(&ClearChannelIDsOnIOThread, delete_begin_, delete_end_, | 652 base::Bind(&ClearChannelIDsOnIOThread, delete_begin_, delete_end_, |
651 std::move(rq_context), | 653 std::move(rq_context), |
652 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs, | 654 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs, |
653 weak_ptr_factory_.GetWeakPtr()))); | 655 weak_ptr_factory_.GetWeakPtr()))); |
| 656 } |
654 } | 657 } |
655 | 658 |
656 if (remove_mask & REMOVE_LOCAL_STORAGE) { | 659 if (remove_mask & REMOVE_LOCAL_STORAGE) { |
657 storage_partition_remove_mask |= | 660 storage_partition_remove_mask |= |
658 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 661 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
659 } | 662 } |
660 | 663 |
661 if (remove_mask & REMOVE_INDEXEDDB) { | 664 if (remove_mask & REMOVE_INDEXEDDB) { |
662 storage_partition_remove_mask |= | 665 storage_partition_remove_mask |= |
663 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; | 666 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 waiting_for_clear_domain_reliability_monitor_ = false; | 1248 waiting_for_clear_domain_reliability_monitor_ = false; |
1246 NotifyIfDone(); | 1249 NotifyIfDone(); |
1247 } | 1250 } |
1248 | 1251 |
1249 // static | 1252 // static |
1250 BrowsingDataRemover::CallbackSubscription | 1253 BrowsingDataRemover::CallbackSubscription |
1251 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1254 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
1252 const BrowsingDataRemover::Callback& callback) { | 1255 const BrowsingDataRemover::Callback& callback) { |
1253 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1256 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
1254 } | 1257 } |
OLD | NEW |