Index: chrome/renderer/safe_browsing/features.h |
diff --git a/chrome/renderer/safe_browsing/features.h b/chrome/renderer/safe_browsing/features.h |
index 1a82c6137f0d47d16ba5a5979b7a3c75b905b86c..f3c8348cc4c3c548dd4d65f260647780ba30f2f5 100644 |
--- a/chrome/renderer/safe_browsing/features.h |
+++ b/chrome/renderer/safe_browsing/features.h |
@@ -44,6 +44,12 @@ class FeatureMap { |
// kMaxFeatureMapSize. |
bool AddBooleanFeature(const std::string& name); |
+ // Adds a real-valued feature to a FeatureMap with the given value. |
+ // Values must always be in the range [0.0, 1.0]. Returns true on |
+ // success, or false if the feature map exceeds kMaxFeatureMapSize |
+ // or the value is outside of the allowed range. |
+ bool AddRealFeature(const std::string& name, double value); |
+ |
// Provides read-only access to the current set of features. |
const base::hash_map<std::string, double>& features() const { |
return features_; |
@@ -103,6 +109,55 @@ extern const char kUrlNumOtherHostTokensGTThree[]; |
// token features, "abc" and "efg". Query parameters are not included. |
extern const char kUrlPathToken[]; |
+//////////////////////////////////////////////////// |
+// DOM HTML form features |
+//////////////////////////////////////////////////// |
+ |
+// Set if the page has any <form> elements. |
+extern const char kPageHasForms[]; |
+// The fraction of form elements whose |action| attribute points to a |
+// URL on a different domain from the document URL. |
+extern const char kPageActionOtherDomainFreq[]; |
+ |
+// Set if the page has any <input type="text"> elements |
+// (includes inputs with missing or unknown types). |
+extern const char kPageHasTextInputs[]; |
+// Set if the page has any <input type="password"> elements. |
+extern const char kPageHasPswdInputs[]; |
+// Set if the page has any <input type="radio"> elements. |
+extern const char kPageHasRadioInputs[]; |
+// Set if the page has any <input type="checkbox"> elements. |
+extern const char kPageHasCheckInputs[]; |
+ |
+//////////////////////////////////////////////////// |
+// DOM HTML link features |
+//////////////////////////////////////////////////// |
+ |
+// The fraction of links in the page which point to a domain other than the |
+// domain of the document. See "URL host features" above for a discussion |
+// of how the doamin is computed. |
+extern const char kPageExternalLinksFreq[]; |
+// Token feature containing each external domain that is linked to. |
+extern const char kPageLinkDomain[]; |
+// Fraction of links in the page that use https. |
+extern const char kPageSecureLinksFreq[]; |
+ |
+//////////////////////////////////////////////////// |
+// DOM HTML script features |
+//////////////////////////////////////////////////// |
+ |
+// Set if the number of <script> elements in the page is greater than 1. |
+extern const char kPageNumScriptTagsGTOne[]; |
+// Set if the number of <script> elements in the page is greater than 6. |
+extern const char kPageNumScriptTagsGTSix[]; |
+ |
+//////////////////////////////////////////////////// |
+// Other DOM HTML features |
+//////////////////////////////////////////////////// |
+ |
+// The fraction of images whose src attribute points to an external domain. |
+extern const char kPageImgOtherDomainFreq[]; |
+ |
} // namespace features |
} // namepsace safe_browsing |