OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/browsing_data/browsing_data_remover_util.h" |
| 6 |
| 7 #include "content/public/browser/browsing_data_filter_builder.h" |
| 8 |
| 9 void BrowsingDataRemoverUtil::Remove( |
| 10 int remove_mask, |
| 11 int origin_mask, |
| 12 browsing_data::TimePeriod time_period, |
| 13 const std::vector<std::string>& excluded_domains, |
| 14 BrowsingDataRemover* remover, |
| 15 BrowsingDataRemover::Observer* observer) { |
| 16 int filterable_mask = |
| 17 remove_mask & BrowsingDataRemover::IMPORTANT_SITES_DATATYPES; |
| 18 int nonfilterable_mask = |
| 19 remove_mask & ~BrowsingDataRemover::IMPORTANT_SITES_DATATYPES; |
| 20 |
| 21 std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder( |
| 22 content::BrowsingDataFilterBuilder::Create( |
| 23 content::BrowsingDataFilterBuilder::BLACKLIST)); |
| 24 for (const std::string& domain : excluded_domains) { |
| 25 filter_builder->AddRegisterableDomain(domain); |
| 26 } |
| 27 |
| 28 browsing_data::RecordDeletionForPeriod(time_period); |
| 29 |
| 30 if (filterable_mask) { |
| 31 remover->RemoveWithFilterAndReply( |
| 32 browsing_data::CalculateBeginDeleteTime(time_period), |
| 33 browsing_data::CalculateEndDeleteTime(time_period), filterable_mask, |
| 34 origin_mask, std::move(filter_builder), observer); |
| 35 } else { |
| 36 // Make sure |observer| doesn't wait for the filtered task. |
| 37 observer->OnBrowsingDataRemoverDone(); |
| 38 } |
| 39 |
| 40 if (nonfilterable_mask) { |
| 41 remover->RemoveAndReply( |
| 42 browsing_data::CalculateBeginDeleteTime(time_period), |
| 43 browsing_data::CalculateEndDeleteTime(time_period), nonfilterable_mask, |
| 44 origin_mask, observer); |
| 45 } else { |
| 46 // Make sure |observer| doesn't wait for the non-filtered task. |
| 47 observer->OnBrowsingDataRemoverDone(); |
| 48 } |
| 49 } |
OLD | NEW |