Index: components/safe_browsing_db/util.h |
diff --git a/components/safe_browsing_db/util.h b/components/safe_browsing_db/util.h |
index 8f82c609e6ee5b1fde14aac459385daa270ac02b..edf12f3278f6e7385a25488e8b7816e6a323b671 100644 |
--- a/components/safe_browsing_db/util.h |
+++ b/components/safe_browsing_db/util.h |
@@ -53,6 +53,37 @@ enum SBThreatType { |
SB_THREAT_TYPE_BLACKLISTED_RESOURCE, |
}; |
+// Metadata that indicates what kind of URL match this is. |
+enum class ThreatPatternType { |
+ NONE, // Pattern type didn't appear in the metadata |
+ LANDING, // The match is a landing page |
+ DISTRIBUTION, // The match is a distribution page |
+}; |
+ |
+// Metadata that was returned by a GetFullHash call. This is the parsed version |
+// of the PB (from Pver3, or Pver4 local) or JSON (from Pver4 via GMSCore). |
+// Some fields are only applicable to certain lists. |
+struct ThreatMetadata { |
+ ThreatMetadata(); |
+ ~ThreatMetadata(); |
+ |
+ // Type of blacklisted page. Used on malware and UwS lists. |
+ // This will be NONE if it wasn't present in the reponse. |
+ ThreatPatternType threat_pattern_type; |
+ |
+ // List of permissions blocked. Used with threat_type API_ABUSE. |
+ // This will be empty if it wasn't present in the response. |
+ std::vector<std::string> api_permissions; |
+ |
+ // Opaque base64 string used for user-population experiments in pver4. |
+ // This will be empty if it wasn't present in the response. |
+ std::string population_id; |
+ |
+ // This is the only field currently populated, and it'll be removed |
+ // when the others are used. |
+ // TODO(nparker): Remove this as part of crbug/589610. |
+ std::string raw_metadata; |
+}; |
// A truncated hash's type. |
typedef uint32_t SBPrefix; |
@@ -68,7 +99,7 @@ struct SBFullHashResult { |
SBFullHash hash; |
// TODO(shess): Refactor to allow ListType here. |
int list_id; |
- std::string metadata; |
+ ThreatMetadata metadata; |
// Used only for V4 results. The cache lifetime for this result. The response |
// must not be cached for more than this duration to avoid false positives. |
base::TimeDelta cache_duration; |