| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chrome_browsing_data_remover_delegate.h" | 5 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/callback.h" |
| 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 12 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" | 15 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 16 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 17 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 19 #include "chrome/browser/domain_reliability/service_factory.h" | 20 #include "chrome/browser/domain_reliability/service_factory.h" |
| 20 #include "chrome/browser/download/download_prefs.h" | 21 #include "chrome/browser/download/download_prefs.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 void ClearHostnameResolutionCacheOnIOThread( | 202 void ClearHostnameResolutionCacheOnIOThread( |
| 202 IOThread* io_thread, | 203 IOThread* io_thread, |
| 203 base::Callback<bool(const std::string&)> host_filter) { | 204 base::Callback<bool(const std::string&)> host_filter) { |
| 204 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 205 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 205 | 206 |
| 206 io_thread->ClearHostCache(host_filter); | 207 io_thread->ClearHostCache(host_filter); |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace | 210 } // namespace |
| 210 | 211 |
| 212 ChromeBrowsingDataRemoverDelegate::SubTask::SubTask( |
| 213 const base::Closure& forward_callback) |
| 214 : is_pending_(false), |
| 215 forward_callback_(forward_callback), |
| 216 weak_ptr_factory_(this) { |
| 217 DCHECK(!forward_callback_.is_null()); |
| 218 } |
| 219 |
| 220 ChromeBrowsingDataRemoverDelegate::SubTask::~SubTask() {} |
| 221 |
| 222 void ChromeBrowsingDataRemoverDelegate::SubTask::Start() { |
| 223 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 224 DCHECK(!is_pending_); |
| 225 is_pending_ = true; |
| 226 } |
| 227 |
| 228 base::Closure |
| 229 ChromeBrowsingDataRemoverDelegate::SubTask::GetCompletionCallback() { |
| 230 return base::Bind(&SubTask::CompletionCallback, |
| 231 weak_ptr_factory_.GetWeakPtr()); |
| 232 } |
| 233 |
| 234 void ChromeBrowsingDataRemoverDelegate::SubTask::CompletionCallback() { |
| 235 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 236 DCHECK(is_pending_); |
| 237 is_pending_ = false; |
| 238 forward_callback_.Run(); |
| 239 } |
| 240 |
| 211 ChromeBrowsingDataRemoverDelegate::ChromeBrowsingDataRemoverDelegate( | 241 ChromeBrowsingDataRemoverDelegate::ChromeBrowsingDataRemoverDelegate( |
| 212 BrowserContext* browser_context) | 242 BrowserContext* browser_context) |
| 213 : profile_(Profile::FromBrowserContext(browser_context)), | 243 : profile_(Profile::FromBrowserContext(browser_context)), |
| 214 sub_task_forward_callback_( | 244 sub_task_forward_callback_( |
| 215 base::Bind(&ChromeBrowsingDataRemoverDelegate::NotifyIfDone, | 245 base::Bind(&ChromeBrowsingDataRemoverDelegate::NotifyIfDone, |
| 216 base::Unretained(this))), | 246 base::Unretained(this))), |
| 217 synchronous_clear_operations_(sub_task_forward_callback_), | 247 synchronous_clear_operations_(sub_task_forward_callback_), |
| 218 clear_autofill_origin_urls_(sub_task_forward_callback_), | 248 clear_autofill_origin_urls_(sub_task_forward_callback_), |
| 219 clear_flash_content_licenses_(sub_task_forward_callback_), | 249 clear_flash_content_licenses_(sub_task_forward_callback_), |
| 220 clear_domain_reliability_monitor_(sub_task_forward_callback_), | 250 clear_domain_reliability_monitor_(sub_task_forward_callback_), |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 | 899 |
| 870 #if defined(OS_CHROMEOS) | 900 #if defined(OS_CHROMEOS) |
| 871 void ChromeBrowsingDataRemoverDelegate::OnClearPlatformKeys( | 901 void ChromeBrowsingDataRemoverDelegate::OnClearPlatformKeys( |
| 872 chromeos::DBusMethodCallStatus call_status, | 902 chromeos::DBusMethodCallStatus call_status, |
| 873 bool result) { | 903 bool result) { |
| 874 LOG_IF(ERROR, call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || !result) | 904 LOG_IF(ERROR, call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || !result) |
| 875 << "Failed to clear platform keys."; | 905 << "Failed to clear platform keys."; |
| 876 clear_platform_keys_.GetCompletionCallback().Run(); | 906 clear_platform_keys_.GetCompletionCallback().Run(); |
| 877 } | 907 } |
| 878 #endif | 908 #endif |
| OLD | NEW |