| OLD | NEW |
| 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 Loading... |
| 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; | |
| 75 ThreatEntryType threat_entry_type; | |
| 76 ThreatType threat_type; | |
| 77 | |
| 78 ListIdentifier(PlatformType, ThreatEntryType, ThreatType); | 111 ListIdentifier(PlatformType, ThreatEntryType, ThreatType); |
| 79 explicit ListIdentifier(const ListUpdateResponse&); | 112 explicit ListIdentifier(const ListUpdateResponse&); |
| 80 | 113 |
| 81 bool operator==(const ListIdentifier& other) const; | 114 bool operator==(const ListIdentifier& other) const; |
| 82 bool operator!=(const ListIdentifier& other) const; | 115 bool operator!=(const ListIdentifier& other) const; |
| 83 size_t hash() const; | 116 size_t hash() const; |
| 84 | 117 |
| 118 PlatformType platform_type() const { return platform_type_; } |
| 119 ThreatEntryType threat_entry_type() const { return threat_entry_type_; } |
| 120 ThreatType threat_type() const { return threat_type_; } |
| 121 |
| 85 private: | 122 private: |
| 123 PlatformType platform_type_; |
| 124 ThreatEntryType threat_entry_type_; |
| 125 ThreatType threat_type_; |
| 126 |
| 86 ListIdentifier(); | 127 ListIdentifier(); |
| 87 }; | 128 }; |
| 88 | 129 |
| 89 std::ostream& operator<<(std::ostream& os, const ListIdentifier& id); | 130 std::ostream& operator<<(std::ostream& os, const ListIdentifier& id); |
| 90 | 131 |
| 91 PlatformType GetCurrentPlatformType(); | 132 PlatformType GetCurrentPlatformType(); |
| 92 const ListIdentifier GetChromeUrlApiId(); | 133 const ListIdentifier GetChromeUrlApiId(); |
| 93 const ListIdentifier GetUrlMalwareId(); | 134 const ListIdentifier GetUrlMalwareId(); |
| 94 const ListIdentifier GetUrlSocEngId(); | 135 const ListIdentifier GetUrlSocEngId(); |
| 95 | 136 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 323 |
| 283 template <> | 324 template <> |
| 284 struct hash<safe_browsing::ListIdentifier> { | 325 struct hash<safe_browsing::ListIdentifier> { |
| 285 std::size_t operator()(const safe_browsing::ListIdentifier& id) const { | 326 std::size_t operator()(const safe_browsing::ListIdentifier& id) const { |
| 286 return id.hash(); | 327 return id.hash(); |
| 287 } | 328 } |
| 288 }; | 329 }; |
| 289 } | 330 } |
| 290 | 331 |
| 291 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ | 332 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ |
| OLD | NEW |