Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: chrome/browser/safe_browsing/local_database_manager.cc

Issue 2225113002: Reland: Move PVer4 related code from util.* to v4_protocol_manager_util.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor: Address nparker@'s comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698