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

Unified Diff: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h

Issue 2415553002: Metrics for tracking Safe Browsing hit patterns for the Safe Browsing lists Subresource Filter. (Closed)
Patch Set: fix browser side navigation tests Created 4 years, 1 month 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
Index: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
index 2e1056e39988ce7fcba95a7b8a5bebd1eecae79a..e632d131cd4079c70dc443e0afc696b611504873 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
@@ -24,11 +24,13 @@ class RenderFrameHost;
namespace subresource_filter {
-using HostSet = std::set<std::string>;
-
class ContentSubresourceFilterDriver;
class SubresourceFilterClient;
enum class ActivationState;
+enum class ActivationList;
+
+using HostPathSet = std::set<std::string>;
+using Matches = std::unordered_map<std::string, std::set<ActivationList>>;
engedy 2016/11/18 14:12:04 nit: How about URLToActivationListsMap?
melandory 2016/11/22 14:16:24 Done.
// Controls the activation of subresource filtering for each page load in a
// WebContents and manufactures the per-frame ContentSubresourceFilterDrivers.
@@ -61,8 +63,6 @@ class ContentSubresourceFilterDriverFactory
// filtering for the lifetime of this WebContents.
void AddHostOfURLToWhitelistSet(const GURL& url);
- void AddToActivationHitsSet(const GURL& url);
-
// Called when Safe Browsing detects that the |url| corresponding to the load
// of the main frame belongs to the blacklist with |threat_type|. If the
// blacklist is the Safe Browsing Social Engineering ads landing, then |url|
@@ -76,11 +76,14 @@ class ContentSubresourceFilterDriverFactory
// Reloads the page and inserts the url to the whitelist.
void OnReloadRequested();
- const HostSet& safe_browsing_blacklisted_patterns_set() const {
- return safe_browsing_blacklisted_patterns_;
- }
+ const HostPathSet& whitelisted_set() const { return whitelisted_hosts_; }
+
ActivationState activation_state() { return activation_state_; }
+ const Matches& safe_browsing_blacklisted_patterns_set() const {
+ return safe_browsing_matches_;
+ }
+
private:
friend class ContentSubresourceFilterDriverFactoryTest;
friend class SubresourceFilterNavigationThrottleTest;
@@ -99,10 +102,12 @@ class ContentSubresourceFilterDriverFactory
void OnFirstSubresourceLoadDisallowed();
// content::WebContentsObserver:
- void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
- void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
void DidStartNavigation(
content::NavigationHandle* navigation_handle) override;
+ void DidRedirectNavigation(
+ content::NavigationHandle* navigation_handle) override;
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
void ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) override;
bool OnMessageReceived(const IPC::Message& message,
@@ -120,24 +125,27 @@ class ContentSubresourceFilterDriverFactory
content::RenderFrameHost* render_frame_host,
const GURL& url);
- bool IsHit(const GURL& url) const;
+ bool IsBlacklistedBySafeBrowsing(const GURL& url) const;
engedy 2016/11/18 14:12:04 nit: Unused method.
melandory 2016/11/22 14:16:24 Done.
+ bool IsInActivationSet(const GURL& url) const;
+
+ void AddToBlacklistedBySafebrowsing(const GURL& url,
+ ActivationList match_type);
+ void RecordRedirectChainMatchPattern() const;
static const char kWebContentsUserDataKey[];
FrameHostToOwnedDriverMap frame_drivers_;
std::unique_ptr<SubresourceFilterClient> client_;
- HostSet whitelisted_hosts_;
-
- // Host+path list of the URLs, where the Safe Browsing detected hit to the
- // threat list of interest. When the navigation is commited
- // |safe_browsing_blacklisted_patterns_| is used to determine whenever
- // the activation signal should be sent. All entities are deleted from the
- // list on navigation commit event.
- HostSet safe_browsing_blacklisted_patterns_;
+ HostPathSet whitelisted_hosts_;
ActivationState activation_state_;
+ // The URLs in the navigation chain.
+ std::vector<GURL> navigation_chain_;
+
+ Matches safe_browsing_matches_;
engedy 2016/11/18 14:12:04 Naming nit: activation_list_matches_?
melandory 2016/11/22 14:16:24 Done.
+
DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterDriverFactory);
};

Powered by Google App Engine
This is Rietveld 408576698