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