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

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

Issue 2762403002: Wire up the ThrottleManager using the existing page activation logic (Closed)
Patch Set: small tweaks Created 3 years, 9 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
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 e291814738e3c08ebc84517c9717c32ca8fc6ce9..09d1e9d73f3e985901b32429caa6b38f97aa4e59 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
@@ -15,6 +15,7 @@
#include "base/supports_user_data.h"
#include "base/time/time.h"
#include "components/safe_browsing_db/util.h"
+#include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h"
#include "components/subresource_filter/core/common/document_load_statistics.h"
#include "content/public/browser/web_contents_observer.h"
#include "ui/base/page_transition_types.h"
@@ -44,7 +45,8 @@ using URLToActivationListsMap =
// per-frame SubresourceFilterAgents on the renderer side.
class ContentSubresourceFilterDriverFactory
: public base::SupportsUserData::Data,
- public content::WebContentsObserver {
+ public content::WebContentsObserver,
+ public ContentSubresourceFilterThrottleManager::Delegate {
public:
// NOTE: ActivationDecision backs a UMA histogram, so it is append-only.
enum class ActivationDecision {
@@ -113,14 +115,23 @@ class ContentSubresourceFilterDriverFactory
return activation_decision_;
}
+ // ContentSubresourceFilterThrottleManager::Delegate:
+ void OnFirstSubresourceLoadDisallowed() override;
+ bool ShouldSuppressActivation(
+ content::NavigationHandle* navigation_handle) override;
+ void WillProcessResponse(
+ content::NavigationHandle* navigation_handle) override;
+
+ ContentSubresourceFilterThrottleManager* throttle_manager() {
+ return throttle_manager_.get();
+ }
+
private:
friend class ContentSubresourceFilterDriverFactoryTest;
friend class safe_browsing::SafeBrowsingServiceTest;
void ResetActivationState();
- void OnFirstSubresourceLoadDisallowed();
-
void OnDocumentLoadStatistics(const DocumentLoadStatistics& statistics);
bool IsWhitelisted(const GURL& url) const;
@@ -130,8 +141,6 @@ class ContentSubresourceFilterDriverFactory
content::NavigationHandle* navigation_handle) override;
void DidRedirectNavigation(
content::NavigationHandle* navigation_handle) override;
- void ReadyToCommitNavigation(
- content::NavigationHandle* navigation_handle) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
bool OnMessageReceived(const IPC::Message& message,
@@ -141,16 +150,6 @@ class ContentSubresourceFilterDriverFactory
// activation signal should be sent.
ActivationDecision ComputeActivationDecisionForMainFrameURL(
const GURL& url) const;
- void ActivateForFrameHostIfNeeded(content::RenderFrameHost* render_frame_host,
- const GURL& url);
-
- // Internal implementation of ReadyToCommitNavigation which doesn't use
- // NavigationHandle to ease unit tests.
- void ReadyToCommitNavigationInternal(
- content::RenderFrameHost* render_frame_host,
- const GURL& url,
- const content::Referrer& referrer,
- ui::PageTransition page_transition);
bool DidURLMatchActivationList(const GURL& url,
ActivationList activation_list) const;
@@ -165,6 +164,8 @@ class ContentSubresourceFilterDriverFactory
std::unique_ptr<SubresourceFilterClient> client_;
+ std::unique_ptr<ContentSubresourceFilterThrottleManager> throttle_manager_;
pkalinnikov 2017/04/03 13:40:07 nit: Please #include <memory>
Charlie Harrison 2017/04/03 15:33:31 Done.
+
// Hosts to whitelist. This is only used for per-WebContents whitelisting and
// is distinct from content settings whitelisting.
HostPathSet whitelisted_hosts_;

Powered by Google App Engine
This is Rietveld 408576698