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

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

Issue 2802013002: Move BrowsingDataRemoverImpl:: CompletionInhibitor to the public interface (Closed)
Patch Set: Created 3 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_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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 net::ChannelIDService* channel_id_service = 117 net::ChannelIDService* channel_id_service =
118 rq_context->GetURLRequestContext()->channel_id_service(); 118 rq_context->GetURLRequestContext()->channel_id_service();
119 channel_id_service->GetChannelIDStore()->DeleteForDomainsCreatedBetween( 119 channel_id_service->GetChannelIDStore()->DeleteForDomainsCreatedBetween(
120 domain_predicate, delete_begin, delete_end, 120 domain_predicate, delete_begin, delete_end,
121 base::Bind(&OnClearedChannelIDsOnIOThread, 121 base::Bind(&OnClearedChannelIDsOnIOThread,
122 base::RetainedRef(std::move(rq_context)), callback)); 122 base::RetainedRef(std::move(rq_context)), callback));
123 } 123 }
124 124
125 } // namespace 125 } // namespace
126 126
127 BrowsingDataRemoverImpl::CompletionInhibitor*
128 BrowsingDataRemoverImpl::completion_inhibitor_ = nullptr;
129
130 BrowsingDataRemoverImpl::SubTask::SubTask(const base::Closure& forward_callback) 127 BrowsingDataRemoverImpl::SubTask::SubTask(const base::Closure& forward_callback)
131 : is_pending_(false), 128 : is_pending_(false),
132 forward_callback_(forward_callback), 129 forward_callback_(forward_callback),
133 weak_ptr_factory_(this) { 130 weak_ptr_factory_(this) {
134 DCHECK(!forward_callback_.is_null()); 131 DCHECK(!forward_callback_.is_null());
135 } 132 }
136 133
137 BrowsingDataRemoverImpl::SubTask::~SubTask() {} 134 BrowsingDataRemoverImpl::SubTask::~SubTask() {}
138 135
139 void BrowsingDataRemoverImpl::SubTask::Start() { 136 void BrowsingDataRemoverImpl::SubTask::Start() {
(...skipping 13 matching lines...) Expand all
153 is_pending_ = false; 150 is_pending_ = false;
154 forward_callback_.Run(); 151 forward_callback_.Run();
155 } 152 }
156 153
157 BrowsingDataRemoverImpl::BrowsingDataRemoverImpl( 154 BrowsingDataRemoverImpl::BrowsingDataRemoverImpl(
158 content::BrowserContext* browser_context) 155 content::BrowserContext* browser_context)
159 : browser_context_(browser_context), 156 : browser_context_(browser_context),
160 remove_mask_(-1), 157 remove_mask_(-1),
161 origin_type_mask_(-1), 158 origin_type_mask_(-1),
162 is_removing_(false), 159 is_removing_(false),
160 completion_inhibitor_(nullptr),
163 sub_task_forward_callback_( 161 sub_task_forward_callback_(
164 base::Bind(&BrowsingDataRemoverImpl::NotifyIfDone, 162 base::Bind(&BrowsingDataRemoverImpl::NotifyIfDone,
165 base::Unretained(this))), 163 base::Unretained(this))),
166 synchronous_clear_operations_(sub_task_forward_callback_), 164 synchronous_clear_operations_(sub_task_forward_callback_),
167 clear_embedder_data_(sub_task_forward_callback_), 165 clear_embedder_data_(sub_task_forward_callback_),
168 clear_cache_(sub_task_forward_callback_), 166 clear_cache_(sub_task_forward_callback_),
169 clear_channel_ids_(sub_task_forward_callback_), 167 clear_channel_ids_(sub_task_forward_callback_),
170 clear_http_auth_cache_(sub_task_forward_callback_), 168 clear_http_auth_cache_(sub_task_forward_callback_),
171 clear_storage_partition_data_(sub_task_forward_callback_), 169 clear_storage_partition_data_(sub_task_forward_callback_),
170 storage_partition_for_testing_(nullptr),
172 weak_ptr_factory_(this) { 171 weak_ptr_factory_(this) {
173 DCHECK(browser_context_); 172 DCHECK(browser_context_);
174 } 173 }
175 174
176 BrowsingDataRemoverImpl::~BrowsingDataRemoverImpl() { 175 BrowsingDataRemoverImpl::~BrowsingDataRemoverImpl() {
177 if (!task_queue_.empty()) { 176 if (!task_queue_.empty()) {
178 VLOG(1) << "BrowsingDataRemoverImpl shuts down with " << task_queue_.size() 177 VLOG(1) << "BrowsingDataRemoverImpl shuts down with " << task_queue_.size()
179 << " pending tasks"; 178 << " pending tasks";
180 } 179 }
181 180
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 560 }
562 561
563 void BrowsingDataRemoverImpl::AddObserver(Observer* observer) { 562 void BrowsingDataRemoverImpl::AddObserver(Observer* observer) {
564 observer_list_.AddObserver(observer); 563 observer_list_.AddObserver(observer);
565 } 564 }
566 565
567 void BrowsingDataRemoverImpl::RemoveObserver(Observer* observer) { 566 void BrowsingDataRemoverImpl::RemoveObserver(Observer* observer) {
568 observer_list_.RemoveObserver(observer); 567 observer_list_.RemoveObserver(observer);
569 } 568 }
570 569
570 void BrowsingDataRemoverImpl::SetCompletionInhibitorForTesting(
571 CompletionInhibitor* inhibitor) {
572 completion_inhibitor_ = inhibitor;
573 }
574
571 void BrowsingDataRemoverImpl::OverrideStoragePartitionForTesting( 575 void BrowsingDataRemoverImpl::OverrideStoragePartitionForTesting(
572 content::StoragePartition* storage_partition) { 576 content::StoragePartition* storage_partition) {
573 storage_partition_for_testing_ = storage_partition; 577 storage_partition_for_testing_ = storage_partition;
574 } 578 }
575 579
576 const base::Time& BrowsingDataRemoverImpl::GetLastUsedBeginTime() { 580 const base::Time& BrowsingDataRemoverImpl::GetLastUsedBeginTime() {
577 return delete_begin_; 581 return delete_begin_;
578 } 582 }
579 583
580 const base::Time& BrowsingDataRemoverImpl::GetLastUsedEndTime() { 584 const base::Time& BrowsingDataRemoverImpl::GetLastUsedEndTime() {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 665
662 if (completion_inhibitor_) { 666 if (completion_inhibitor_) {
663 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( 667 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete(
664 this, base::Bind(&BrowsingDataRemoverImpl::Notify, 668 this, base::Bind(&BrowsingDataRemoverImpl::Notify,
665 weak_ptr_factory_.GetWeakPtr())); 669 weak_ptr_factory_.GetWeakPtr()));
666 return; 670 return;
667 } 671 }
668 672
669 Notify(); 673 Notify();
670 } 674 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698