Chromium Code Reviews| 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..4fc56d8dc23b433514beb5d4a7c4d67aa6996a9d 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,7 +24,7 @@ class RenderFrameHost; |
| namespace subresource_filter { |
| -using HostSet = std::set<std::string>; |
| +using HostPathSet = std::set<std::string>; |
| class ContentSubresourceFilterDriver; |
| class SubresourceFilterClient; |
| @@ -61,8 +61,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,9 +74,12 @@ class ContentSubresourceFilterDriverFactory |
| // Reloads the page and inserts the url to the whitelist. |
| void OnReloadRequested(); |
| - const HostSet& safe_browsing_blacklisted_patterns_set() const { |
| + const HostPathSet& 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_; } |
| private: |
| @@ -99,10 +100,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 +123,39 @@ class ContentSubresourceFilterDriverFactory |
| content::RenderFrameHost* render_frame_host, |
| const GURL& url); |
| - bool IsHit(const GURL& url) const; |
| + bool IsBlacklistedBySafeBrowsing(const GURL& url) const; |
| + bool IsInActivationSet(const GURL& url) const; |
| + |
| + void AddToBlacklistedBySafebrowsing(const GURL& url); |
| + void AddToActivationSet(const GURL& url); |
| + |
| + void RecordRedirectChainMatchPattern() const; |
| static const char kWebContentsUserDataKey[]; |
| FrameHostToOwnedDriverMap frame_drivers_; |
| std::unique_ptr<SubresourceFilterClient> client_; |
| - HostSet whitelisted_hosts_; |
| + HostPathSet 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_; |
| + // list on navigation start. The list is used to collect metrics for the |
| + // activation patterns. |
| + HostPathSet safe_browsing_blacklisted_patterns_; |
| + |
| + // Host+path list of the URLs, where the Safe Browsing detected hit to the |
| + // list, where the activation is enabled. The list is used to make activation |
| + // decision. All entities are deleted from the list on navigation start. |
| + HostPathSet activation_patterns_; |
|
engedy
2016/10/28 10:58:07
As discussed, let's combine this member, |navigati
melandory
2016/11/16 15:59:35
Done.
|
| ActivationState activation_state_; |
| + // The first URL in the navigation. |
| + std::vector<GURL> navigation_chain_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterDriverFactory); |
| }; |