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 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/safe_browsing/protocol_manager.h" | 27 #include "chrome/browser/safe_browsing/protocol_manager.h" |
28 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
30 #include "chrome/browser/safe_browsing/ui_manager.h" | 30 #include "chrome/browser/safe_browsing/ui_manager.h" |
31 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "components/prefs/pref_service.h" | 35 #include "components/prefs/pref_service.h" |
36 #include "components/safe_browsing_db/util.h" | 36 #include "components/safe_browsing_db/util.h" |
| 37 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
39 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
40 #include "url/url_constants.h" | 41 #include "url/url_constants.h" |
41 | 42 |
42 using content::BrowserThread; | 43 using content::BrowserThread; |
43 | 44 |
44 namespace safe_browsing { | 45 namespace safe_browsing { |
45 | 46 |
46 namespace { | 47 namespace { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // provided full hashes. Returns the list id of the severest matching result | 130 // provided full hashes. Returns the list id of the severest matching result |
130 // from |full_hashes|, or INVALID if none match. | 131 // from |full_hashes|, or INVALID if none match. |
131 ListType GetUrlSeverestThreatListType( | 132 ListType GetUrlSeverestThreatListType( |
132 const GURL& url, | 133 const GURL& url, |
133 const std::vector<SBFullHashResult>& full_hashes, | 134 const std::vector<SBFullHashResult>& full_hashes, |
134 size_t* index) { | 135 size_t* index) { |
135 if (full_hashes.empty()) | 136 if (full_hashes.empty()) |
136 return INVALID; | 137 return INVALID; |
137 | 138 |
138 std::vector<std::string> patterns; | 139 std::vector<std::string> patterns; |
139 GeneratePatternsToCheck(url, &patterns); | 140 V4ProtocolManagerUtil::GeneratePatternsToCheck(url, &patterns); |
140 | 141 |
141 ListType pending_threat = INVALID; | 142 ListType pending_threat = INVALID; |
142 int pending_threat_severity = GetThreatSeverity(INVALID); | 143 int pending_threat_severity = GetThreatSeverity(INVALID); |
143 for (size_t i = 0; i < patterns.size(); ++i) { | 144 for (size_t i = 0; i < patterns.size(); ++i) { |
144 ListType threat = GetHashSeverestThreatListType( | 145 ListType threat = GetHashSeverestThreatListType( |
145 SBFullHashForString(patterns[i]), full_hashes, index); | 146 SBFullHashForString(patterns[i]), full_hashes, index); |
146 int threat_severity = GetThreatSeverity(threat); | 147 int threat_severity = GetThreatSeverity(threat); |
147 if (threat_severity < pending_threat_severity) { | 148 if (threat_severity < pending_threat_severity) { |
148 pending_threat = threat; | 149 pending_threat = threat; |
149 pending_threat_severity = threat_severity; | 150 pending_threat_severity = threat_severity; |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1243 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
1243 check->weak_ptr_factory_->GetWeakPtr(), check), | 1244 check->weak_ptr_factory_->GetWeakPtr(), check), |
1244 check_timeout_); | 1245 check_timeout_); |
1245 } | 1246 } |
1246 | 1247 |
1247 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { | 1248 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { |
1248 return enable_download_protection_; | 1249 return enable_download_protection_; |
1249 } | 1250 } |
1250 | 1251 |
1251 } // namespace safe_browsing | 1252 } // namespace safe_browsing |
OLD | NEW |