| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/subresource_filter/navigation_throttle_util.h" | 5 #include "chrome/browser/subresource_filter/navigation_throttle_util.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/timer/timer.h" |
| 7 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 8 #include "components/safe_browsing_db/database_manager.h" | 10 #include "components/safe_browsing_db/database_manager.h" |
| 9 #include "components/safe_browsing_db/v4_feature_list.h" | 11 #include "components/safe_browsing_db/v4_feature_list.h" |
| 10 #include "components/subresource_filter/content/browser/subresource_filter_safe_
browsing_activation_throttle.h" | 12 #include "components/subresource_filter/content/browser/subresource_filter_safe_
browsing_activation_throttle.h" |
| 11 #include "components/subresource_filter/core/browser/subresource_filter_features
.h" | 13 #include "components/subresource_filter/core/browser/subresource_filter_features
.h" |
| 12 #include "content/public/browser/navigation_handle.h" | 14 #include "content/public/browser/navigation_handle.h" |
| 13 | 15 |
| 14 content::NavigationThrottle* MaybeCreateSubresourceFilterNavigationThrottle( | 16 content::NavigationThrottle* MaybeCreateSubresourceFilterNavigationThrottle( |
| 15 content::NavigationHandle* navigation_handle, | 17 content::NavigationHandle* navigation_handle, |
| 16 safe_browsing::SafeBrowsingService* safe_browsing_service) { | 18 safe_browsing::SafeBrowsingService* safe_browsing_service) { |
| 17 if (navigation_handle->IsInMainFrame() && safe_browsing_service && | 19 if (navigation_handle->IsInMainFrame() && safe_browsing_service && |
| 18 safe_browsing_service->database_manager()->IsSupported() && | 20 safe_browsing_service->database_manager()->IsSupported() && |
| 19 safe_browsing::V4FeatureList::GetV4UsageStatus() == | 21 safe_browsing::V4FeatureList::GetV4UsageStatus() == |
| 20 safe_browsing::V4FeatureList::V4UsageStatus::V4_ONLY) { | 22 safe_browsing::V4FeatureList::V4UsageStatus::V4_ONLY) { |
| 21 return new subresource_filter:: | 23 return new subresource_filter:: |
| 22 SubresourceFilterSafeBrowsingActivationThrottle( | 24 SubresourceFilterSafeBrowsingActivationThrottle( |
| 23 navigation_handle, safe_browsing_service->database_manager()); | 25 navigation_handle, |
| 26 base::MakeUnique<base::Timer>(false /* retain_user_task */, |
| 27 false /* repeating */), |
| 28 safe_browsing_service->database_manager()); |
| 24 } | 29 } |
| 25 return nullptr; | 30 return nullptr; |
| 26 } | 31 } |
| OLD | NEW |