| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
| 19 #include "base/guid.h" | 19 #include "base/guid.h" |
| 20 #include "base/location.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 22 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
| 23 #include "base/run_loop.h" | 24 #include "base/run_loop.h" |
| 25 #include "base/single_thread_task_runner.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/task/cancelable_task_tracker.h" | 27 #include "base/task/cancelable_task_tracker.h" |
| 28 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "build/build_config.h" | 29 #include "build/build_config.h" |
| 27 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 30 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 28 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 31 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 29 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" | 32 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" |
| 30 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 33 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 31 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 34 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 32 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 35 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 33 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 36 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
| 34 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 37 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 35 #include "chrome/browser/domain_reliability/service_factory.h" | 38 #include "chrome/browser/domain_reliability/service_factory.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 "chrome-extension_abcdefghijklmnopqrstuvwxyz_0.localstorage"); | 159 "chrome-extension_abcdefghijklmnopqrstuvwxyz_0.localstorage"); |
| 157 | 160 |
| 158 bool MatchPrimaryPattern(const ContentSettingsPattern& expected_primary, | 161 bool MatchPrimaryPattern(const ContentSettingsPattern& expected_primary, |
| 159 const ContentSettingsPattern& primary_pattern, | 162 const ContentSettingsPattern& primary_pattern, |
| 160 const ContentSettingsPattern& secondary_pattern) { | 163 const ContentSettingsPattern& secondary_pattern) { |
| 161 return expected_primary == primary_pattern; | 164 return expected_primary == primary_pattern; |
| 162 } | 165 } |
| 163 | 166 |
| 164 #if defined(OS_CHROMEOS) | 167 #if defined(OS_CHROMEOS) |
| 165 void FakeDBusCall(const chromeos::BoolDBusMethodCallback& callback) { | 168 void FakeDBusCall(const chromeos::BoolDBusMethodCallback& callback) { |
| 166 base::MessageLoop::current()->PostTask( | 169 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 167 FROM_HERE, | 170 FROM_HERE, |
| 168 base::Bind(callback, chromeos::DBUS_METHOD_CALL_SUCCESS, true)); | 171 base::Bind(callback, chromeos::DBUS_METHOD_CALL_SUCCESS, true)); |
| 169 } | 172 } |
| 170 #endif | 173 #endif |
| 171 | 174 |
| 172 struct StoragePartitionRemovalData { | 175 struct StoragePartitionRemovalData { |
| 173 uint32_t remove_mask = 0; | 176 uint32_t remove_mask = 0; |
| 174 uint32_t quota_storage_remove_mask = 0; | 177 uint32_t quota_storage_remove_mask = 0; |
| 175 base::Time remove_begin; | 178 base::Time remove_begin; |
| 176 base::Time remove_end; | 179 base::Time remove_end; |
| (...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2534 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( | 2537 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( |
| 2535 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, | 2538 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, |
| 2536 base::Bind(&MatchPrimaryPattern, http_pattern)); | 2539 base::Bind(&MatchPrimaryPattern, http_pattern)); |
| 2537 // Verify we only have one, and it's url1. | 2540 // Verify we only have one, and it's url1. |
| 2538 host_content_settings_map->GetSettingsForOneType( | 2541 host_content_settings_map->GetSettingsForOneType( |
| 2539 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); | 2542 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
| 2540 EXPECT_EQ(1u, host_settings.size()); | 2543 EXPECT_EQ(1u, host_settings.size()); |
| 2541 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), | 2544 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), |
| 2542 host_settings[0].primary_pattern); | 2545 host_settings[0].primary_pattern); |
| 2543 } | 2546 } |
| OLD | NEW |