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/safe_browsing/local_database_manager.h" | 5 #include "chrome/browser/safe_browsing/local_database_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/leak_tracker.h" | 13 #include "base/debug/leak_tracker.h" |
| 14 #include "base/location.h" |
14 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/single_thread_task_runner.h" |
15 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
16 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/thread_task_runner_handle.h" |
17 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/prerender/prerender_field_trial.h" | 22 #include "chrome/browser/prerender/prerender_field_trial.h" |
20 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 23 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
21 #include "chrome/browser/safe_browsing/download_protection_service.h" | 24 #include "chrome/browser/safe_browsing/download_protection_service.h" |
22 #include "chrome/browser/safe_browsing/malware_details.h" | 25 #include "chrome/browser/safe_browsing/malware_details.h" |
23 #include "chrome/browser/safe_browsing/protocol_manager.h" | 26 #include "chrome/browser/safe_browsing/protocol_manager.h" |
24 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 27 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
26 #include "chrome/browser/safe_browsing/ui_manager.h" | 29 #include "chrome/browser/safe_browsing/ui_manager.h" |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 const base::Callback<std::vector<SBPrefix>(void)>& task) { | 1105 const base::Callback<std::vector<SBPrefix>(void)>& task) { |
1103 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1106 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1104 check->weak_ptr_factory_.reset( | 1107 check->weak_ptr_factory_.reset( |
1105 new base::WeakPtrFactory<LocalSafeBrowsingDatabaseManager>(this)); | 1108 new base::WeakPtrFactory<LocalSafeBrowsingDatabaseManager>(this)); |
1106 checks_.insert(check); | 1109 checks_.insert(check); |
1107 | 1110 |
1108 base::PostTaskAndReplyWithResult( | 1111 base::PostTaskAndReplyWithResult( |
1109 safe_browsing_task_runner_.get(), FROM_HERE, task, | 1112 safe_browsing_task_runner_.get(), FROM_HERE, task, |
1110 base::Bind(&LocalSafeBrowsingDatabaseManager::OnAsyncCheckDone, | 1113 base::Bind(&LocalSafeBrowsingDatabaseManager::OnAsyncCheckDone, |
1111 check->weak_ptr_factory_->GetWeakPtr(), check)); | 1114 check->weak_ptr_factory_->GetWeakPtr(), check)); |
1112 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1115 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1113 base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1116 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
1114 check->weak_ptr_factory_->GetWeakPtr(), check), | 1117 check->weak_ptr_factory_->GetWeakPtr(), check), |
1115 check_timeout_); | 1118 check_timeout_); |
1116 } | 1119 } |
1117 | 1120 |
1118 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { | 1121 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { |
1119 return enable_download_protection_; | 1122 return enable_download_protection_; |
1120 } | 1123 } |
OLD | NEW |