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

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: engedy review Created 3 years, 8 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..f1b2b5105c669399762b0a3ed293380be0172368 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
@@ -6,6 +6,7 @@
#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER_DRIVER_FACTORY_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -15,6 +16,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 +46,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 +116,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 +142,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 +151,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 +165,8 @@ class ContentSubresourceFilterDriverFactory
std::unique_ptr<SubresourceFilterClient> client_;
+ std::unique_ptr<ContentSubresourceFilterThrottleManager> throttle_manager_;
+
// 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