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

Unified Diff: components/safe_browsing_db/util.h

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ParseJson in test Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/safe_browsing_db/testing_util.h ('k') | components/safe_browsing_db/util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « components/safe_browsing_db/testing_util.h ('k') | components/safe_browsing_db/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698