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

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

Issue 2834543003: [subresource_filter] SB throttle can send multiple speculative requests. (Closed)
Patch Set: rebase on #468982 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/subresource_filter_safe_browsing_activation_throttle.h
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
index 4430781aa11b69441222688b907423b94b5ca766..cf7d542856198c567d515cb2ba4b3be3f9128b63 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
@@ -1,17 +1,23 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_
#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_
+#include <stddef.h>
+
+#include <memory>
+#include <vector>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
+#include "base/time/time.h"
#include "components/safe_browsing_db/database_manager.h"
+#include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h"
#include "content/public/browser/navigation_throttle.h"
-#include "url/gurl.h"
namespace subresource_filter {
@@ -24,25 +30,38 @@ class SubresourceFilterSafeBrowsingActivationThrottle
public:
SubresourceFilterSafeBrowsingActivationThrottle(
content::NavigationHandle* handle,
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>
database_manager);
~SubresourceFilterSafeBrowsingActivationThrottle() override;
// content::NavigationThrottle:
+ content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
+ content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest()
+ override;
content::NavigationThrottle::ThrottleCheckResult WillProcessResponse()
override;
const char* GetNameForLogging() override;
- void OnCheckUrlResultOnUI(const GURL& url,
- safe_browsing::SBThreatType threat_type,
- safe_browsing::ThreatPatternType pattern_type);
+ void OnCheckUrlResultOnUI(
+ const SubresourceFilterSafeBrowsingClient::CheckResult& result);
private:
- class SBDatabaseClient;
+ void CheckCurrentUrl();
+ void NotifyResult();
+ std::vector<SubresourceFilterSafeBrowsingClient::CheckResult> check_results_;
+ scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
- std::unique_ptr<SBDatabaseClient, base::OnTaskRunnerDeleter> database_client_;
+
+ std::unique_ptr<SubresourceFilterSafeBrowsingClient,
+ base::OnTaskRunnerDeleter>
+ database_client_;
+
+ // Set to TimeTicks::Now() when the navigation is deferred in
+ // WillProcessResponse. If deferral was not necessary, will remain null.
+ base::TimeTicks defer_time_;
DISALLOW_COPY_AND_ASSIGN(SubresourceFilterSafeBrowsingActivationThrottle);
};

Powered by Google App Engine
This is Rietveld 408576698