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

Side by Side Diff: components/safe_browsing_db/util.cc

Issue 2233103002: Move full hash caching logic to v4_get_hash_protocol_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shess@ feedback - part 2. Created 4 years, 3 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 | « components/safe_browsing_db/util.h ('k') | components/safe_browsing_db/v4_database.h » ('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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "components/safe_browsing_db/util.h" 5 #include "components/safe_browsing_db/util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 20 matching lines...) Expand all
31 } // namespace 31 } // namespace
32 32
33 // ThreatMetadata ------------------------------------------------------------ 33 // ThreatMetadata ------------------------------------------------------------
34 ThreatMetadata::ThreatMetadata() 34 ThreatMetadata::ThreatMetadata()
35 : threat_pattern_type(ThreatPatternType::NONE) {} 35 : threat_pattern_type(ThreatPatternType::NONE) {}
36 36
37 ThreatMetadata::ThreatMetadata(const ThreatMetadata& other) = default; 37 ThreatMetadata::ThreatMetadata(const ThreatMetadata& other) = default;
38 38
39 ThreatMetadata::~ThreatMetadata() {} 39 ThreatMetadata::~ThreatMetadata() {}
40 40
41 bool ThreatMetadata::operator==(const ThreatMetadata& other) const {
42 return threat_pattern_type == other.threat_pattern_type &&
43 api_permissions == other.api_permissions &&
44 population_id == other.population_id;
45 }
46
47 bool ThreatMetadata::operator!=(const ThreatMetadata& other) const {
48 return !operator==(other);
49 }
50
41 // SBCachedFullHashResult ------------------------------------------------------ 51 // SBCachedFullHashResult ------------------------------------------------------
42 52
43 SBCachedFullHashResult::SBCachedFullHashResult() {} 53 SBCachedFullHashResult::SBCachedFullHashResult() {}
44 54
45 SBCachedFullHashResult::SBCachedFullHashResult( 55 SBCachedFullHashResult::SBCachedFullHashResult(
46 const base::Time& in_expire_after) 56 const base::Time& in_expire_after)
47 : expire_after(in_expire_after) {} 57 : expire_after(in_expire_after) {}
48 58
49 SBCachedFullHashResult::SBCachedFullHashResult( 59 SBCachedFullHashResult::SBCachedFullHashResult(
50 const SBCachedFullHashResult& other) = default; 60 const SBCachedFullHashResult& other) = default;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // that ends in '/' we also add the path without the slash. 198 // that ends in '/' we also add the path without the slash.
189 if (include_whitelist_hashes && path.size() > 1 && path.back() == '/') { 199 if (include_whitelist_hashes && path.size() > 1 && path.back() == '/') {
190 full_hashes->push_back(SBFullHashForString( 200 full_hashes->push_back(SBFullHashForString(
191 host + path.substr(0, path.size() - 1))); 201 host + path.substr(0, path.size() - 1)));
192 } 202 }
193 } 203 }
194 } 204 }
195 } 205 }
196 206
197 } // namespace safe_browsing 207 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/util.h ('k') | components/safe_browsing_db/v4_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698