Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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()),
305 #if BUILDFLAG(ANDROID_JAVA_UI) 303 #if BUILDFLAG(ANDROID_JAVA_UI)
306 webapp_registry_(new WebappRegistry()), 304 webapp_registry_(new WebappRegistry()),
307 #endif 305 #endif
308 weak_ptr_factory_(this) { 306 weak_ptr_factory_(this) {
309 DCHECK(browser_context); 307 DCHECK(browser_context);
310 } 308 }
311 309
312 BrowsingDataRemover::~BrowsingDataRemover() { 310 BrowsingDataRemover::~BrowsingDataRemover() {
313 // If we are still removing data, notify observers so they can remove 311 // If we are still removing data, notify observers so they can remove
314 // themselves from the observer list. 312 // themselves from the observer list.
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 635 }
638 636
639 // Channel IDs are not separated for protected and unprotected web 637 // Channel IDs are not separated for protected and unprotected web
640 // origins. We check the origin_type_mask_ to prevent unintended deletion. 638 // origins. We check the origin_type_mask_ to prevent unintended deletion.
641 if (remove_mask & REMOVE_CHANNEL_IDS && 639 if (remove_mask & REMOVE_CHANNEL_IDS &&
642 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { 640 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) {
643 content::RecordAction( 641 content::RecordAction(
644 UserMetricsAction("ClearBrowsingData_ChannelIDs")); 642 UserMetricsAction("ClearBrowsingData_ChannelIDs"));
645 // Since we are running on the UI thread don't call GetURLRequestContext(). 643 // Since we are running on the UI thread don't call GetURLRequestContext().
646 scoped_refptr<net::URLRequestContextGetter> rq_context = 644 scoped_refptr<net::URLRequestContextGetter> rq_context =
647 profile_->GetRequestContext(); 645 content::BrowserContext::GetDefaultStoragePartition(profile_)->
648 if (rq_context) { 646 GetURLRequestContext();
649 waiting_for_clear_channel_ids_ = true; 647 waiting_for_clear_channel_ids_ = true;
650 BrowserThread::PostTask( 648 BrowserThread::PostTask(
651 BrowserThread::IO, FROM_HERE, 649 BrowserThread::IO, FROM_HERE,
652 base::Bind(&ClearChannelIDsOnIOThread, delete_begin_, delete_end_, 650 base::Bind(&ClearChannelIDsOnIOThread, delete_begin_, delete_end_,
653 std::move(rq_context), 651 std::move(rq_context),
654 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs, 652 base::Bind(&BrowsingDataRemover::OnClearedChannelIDs,
655 weak_ptr_factory_.GetWeakPtr()))); 653 weak_ptr_factory_.GetWeakPtr())));
656 }
657 } 654 }
658 655
659 if (remove_mask & REMOVE_LOCAL_STORAGE) { 656 if (remove_mask & REMOVE_LOCAL_STORAGE) {
660 storage_partition_remove_mask |= 657 storage_partition_remove_mask |=
661 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; 658 content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE;
662 } 659 }
663 660
664 if (remove_mask & REMOVE_INDEXEDDB) { 661 if (remove_mask & REMOVE_INDEXEDDB) {
665 storage_partition_remove_mask |= 662 storage_partition_remove_mask |=
666 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; 663 content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB;
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 waiting_for_clear_domain_reliability_monitor_ = false; 1245 waiting_for_clear_domain_reliability_monitor_ = false;
1249 NotifyIfDone(); 1246 NotifyIfDone();
1250 } 1247 }
1251 1248
1252 // static 1249 // static
1253 BrowsingDataRemover::CallbackSubscription 1250 BrowsingDataRemover::CallbackSubscription
1254 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( 1251 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
1255 const BrowsingDataRemover::Callback& callback) { 1252 const BrowsingDataRemover::Callback& callback) {
1256 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); 1253 return GetOnBrowsingDataRemovedCallbacks()->Add(callback);
1257 } 1254 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/chromeos/login/profile_auth_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698