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

Unified Diff: chrome/browser/subresource_filter/navigation_throttle_util.cc

Issue 2645283007: Add the client for accessing Subresource Filter only list. (Closed)
Patch Set: feature 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: chrome/browser/subresource_filter/navigation_throttle_util.cc
diff --git a/chrome/browser/subresource_filter/navigation_throttle_util.cc b/chrome/browser/subresource_filter/navigation_throttle_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0225e4bb763009d4a80d79b8b91dd7bc9a138ece
--- /dev/null
+++ b/chrome/browser/subresource_filter/navigation_throttle_util.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 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.
+
+#include "chrome/browser/subresource_filter/navigation_throttle_util.h"
+
+#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing_db/v4_feature_list.h"
+#include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h"
+#include "components/subresource_filter/core/browser/subresource_filter_features.h"
+#include "content/public/browser/navigation_handle.h"
+
+content::NavigationThrottle* MaybeCreateSubresourceFilterNavigationThrottle(
+ content::NavigationHandle* navigation_handle,
+ safe_browsing::SafeBrowsingService* safe_browsing_service) {
+ bool feature_enabled = base::FeatureList::IsEnabled(
+ subresource_filter::kSubresourceFilterSafeBrowsingActivationThrottle);
+ if (feature_enabled && navigation_handle->IsInMainFrame() &&
+ safe_browsing_service &&
+ safe_browsing_service->database_manager()->IsSupported() &&
+ safe_browsing::V4FeatureList::GetV4UsageStatus() ==
+ safe_browsing::V4FeatureList::V4UsageStatus::V4_ONLY) {
+ return new subresource_filter::
+ SubresourceFilterSafeBrowsingActivationThrottle(
+ navigation_handle, safe_browsing_service->database_manager());
+ }
+ return nullptr;
+}

Powered by Google App Engine
This is Rietveld 408576698