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..cdacb8364fc7c6512756c13d00fea63dfea6aee6 |
--- /dev/null |
+++ b/chrome/browser/subresource_filter/navigation_throttle_util.cc |
@@ -0,0 +1,24 @@ |
+// 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/v4_feature_list.h" |
+#include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h" |
+#include "content/public/browser/navigation_handle.h" |
+ |
+content::NavigationThrottle* MaybeCreateSubresourceFilterNavigationThrottle( |
+ content::NavigationHandle* handle, |
+ safe_browsing::SafeBrowsingService* sb_service) { |
+ if (handle->IsInMainFrame() && sb_service && |
+ sb_service->database_manager()->IsSupported() && |
+ safe_browsing::V4FeatureList::GetV4UsageStatus() == |
+ safe_browsing::V4FeatureList::V4UsageStatus::V4_ONLY) { |
+ return new subresource_filter:: |
+ SubresourceFilterSafeBrowsingActivationThrottle( |
+ handle, sb_service->database_manager()); |
+ } |
+ return nullptr; |
+} |