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

Side by Side Diff: components/safe_browsing_db/v4_protocol_manager_util.h

Issue 2353413002: Store list information in ListInfo (was: StoreIdAndFIleName) (Closed)
Patch Set: s/StoreIdAndFileName/ListInfo. Move SBThreatType into ListInfo. 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_
7 7
8 // A class that implements the stateless methods used by the GetHashUpdate and 8 // A class that implements the stateless methods used by the GetHashUpdate and
9 // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol. 9 // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol.
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 std::string key_param; 56 std::string key_param;
57 57
58 // Disable auto-updates using a command line switch? 58 // Disable auto-updates using a command line switch?
59 bool disable_auto_update; 59 bool disable_auto_update;
60 60
61 V4ProtocolConfig(); 61 V4ProtocolConfig();
62 V4ProtocolConfig(const V4ProtocolConfig& other); 62 V4ProtocolConfig(const V4ProtocolConfig& other);
63 ~V4ProtocolConfig(); 63 ~V4ProtocolConfig();
64 }; 64 };
65 65
66 // Different types of threats that SafeBrowsing protects against. This is the
67 // type that's returned to the clients of SafeBrowsing in Chromium.
68 enum SBThreatType {
69 // No threat at all.
70 SB_THREAT_TYPE_SAFE,
71
72 // The URL is being used for phishing.
73 SB_THREAT_TYPE_URL_PHISHING,
74
75 // The URL hosts malware.
76 SB_THREAT_TYPE_URL_MALWARE,
77
78 // The URL hosts unwanted programs.
79 SB_THREAT_TYPE_URL_UNWANTED,
80
81 // The download URL is malware.
82 SB_THREAT_TYPE_BINARY_MALWARE_URL,
83
84 // Url detected by the client-side phishing model. Note that unlike the
85 // above values, this does not correspond to a downloaded list.
86 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL,
87
88 // The Chrome extension or app (given by its ID) is malware.
89 SB_THREAT_TYPE_EXTENSION,
90
91 // Url detected by the client-side malware IP list. This IP list is part
92 // of the client side detection model.
93 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL,
94
95 // Url leads to a blacklisted resource script. Note that no warnings should be
96 // shown on this threat type, but an incident report might be sent.
97 SB_THREAT_TYPE_BLACKLISTED_RESOURCE,
98
99 // Url abuses a permission API.
100 SB_THREAT_TYPE_API_ABUSE,
101 };
102
66 // The information required to uniquely identify each list the client is 103 // The information required to uniquely identify each list the client is
67 // interested in maintaining and downloading from the SafeBrowsing servers. 104 // interested in maintaining and downloading from the SafeBrowsing servers.
68 // For example, for digests of Malware binaries on Windows: 105 // For example, for digests of Malware binaries on Windows:
69 // platform_type = WINDOWS, 106 // platform_type = WINDOWS,
70 // threat_entry_type = EXECUTABLE, 107 // threat_entry_type = EXECUTABLE,
71 // threat_type = MALWARE 108 // threat_type = MALWARE
72 struct ListIdentifier { 109 struct ListIdentifier {
73 public: 110 public:
74 PlatformType platform_type; 111 ListIdentifier(PlatformType, ThreatEntryType, ThreatType, SBThreatType);
75 ThreatEntryType threat_entry_type;
76 ThreatType threat_type;
77
78 ListIdentifier(PlatformType, ThreatEntryType, ThreatType); 112 ListIdentifier(PlatformType, ThreatEntryType, ThreatType);
79 explicit ListIdentifier(const ListUpdateResponse&); 113 explicit ListIdentifier(const ListUpdateResponse&);
80 114
81 bool operator==(const ListIdentifier& other) const; 115 bool operator==(const ListIdentifier& other) const;
82 bool operator!=(const ListIdentifier& other) const; 116 bool operator!=(const ListIdentifier& other) const;
83 size_t hash() const; 117 size_t hash() const;
84 118
119 PlatformType platform_type() const { return platform_type_; }
120 ThreatEntryType threat_entry_type() const { return threat_entry_type_; }
121 ThreatType threat_type() const { return threat_type_; }
122 SBThreatType sb_threat_type() const { return sb_threat_type_; }
123
85 private: 124 private:
125 PlatformType platform_type_;
126 ThreatEntryType threat_entry_type_;
127 ThreatType threat_type_;
128 SBThreatType sb_threat_type_;
Nathan Parker 2016/09/22 18:35:13 You don't need sb_threat_type_ here if it's in Lis
vakh (use Gerrit instead) 2016/09/22 20:33:41 Done.
129
86 ListIdentifier(); 130 ListIdentifier();
87 }; 131 };
88 132
89 std::ostream& operator<<(std::ostream& os, const ListIdentifier& id); 133 std::ostream& operator<<(std::ostream& os, const ListIdentifier& id);
90 134
91 PlatformType GetCurrentPlatformType(); 135 PlatformType GetCurrentPlatformType();
92 const ListIdentifier GetChromeUrlApiId(); 136 const ListIdentifier GetChromeUrlApiId();
93 const ListIdentifier GetUrlMalwareId(); 137 const ListIdentifier GetUrlMalwareId();
94 const ListIdentifier GetUrlSocEngId(); 138 const ListIdentifier GetUrlSocEngId();
95 139
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 326
283 template <> 327 template <>
284 struct hash<safe_browsing::ListIdentifier> { 328 struct hash<safe_browsing::ListIdentifier> {
285 std::size_t operator()(const safe_browsing::ListIdentifier& id) const { 329 std::size_t operator()(const safe_browsing::ListIdentifier& id) const {
286 return id.hash(); 330 return id.hash();
287 } 331 }
288 }; 332 };
289 } 333 }
290 334
291 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ 335 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698