OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chrome_subresource_filter_client.h" | 5 #include "chrome/browser/subresource_filter/chrome_subresource_filter_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
| 10 #include "base/feature_list.h" |
10 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
15 #include "chrome/browser/infobars/infobar_service.h" | 16 #include "chrome/browser/infobars/infobar_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 18 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
18 #include "chrome/browser/subresource_filter/subresource_filter_profile_context_f
actory.h" | 19 #include "chrome/browser/subresource_filter/subresource_filter_profile_context_f
actory.h" |
19 #include "chrome/browser/ui/android/content_settings/subresource_filter_infobar_
delegate.h" | 20 #include "chrome/browser/ui/android/content_settings/subresource_filter_infobar_
delegate.h" |
(...skipping 21 matching lines...) Expand all Loading... |
41 subresource_filter::ContentSubresourceFilterDriverFactory:: | 42 subresource_filter::ContentSubresourceFilterDriverFactory:: |
42 CreateForWebContents(web_contents, this); | 43 CreateForWebContents(web_contents, this); |
43 } | 44 } |
44 | 45 |
45 ChromeSubresourceFilterClient::~ChromeSubresourceFilterClient() {} | 46 ChromeSubresourceFilterClient::~ChromeSubresourceFilterClient() {} |
46 | 47 |
47 void ChromeSubresourceFilterClient::MaybeAppendNavigationThrottles( | 48 void ChromeSubresourceFilterClient::MaybeAppendNavigationThrottles( |
48 content::NavigationHandle* navigation_handle, | 49 content::NavigationHandle* navigation_handle, |
49 std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) { | 50 std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) { |
50 // Don't add any throttles if the feature isn't enabled at all. | 51 // Don't add any throttles if the feature isn't enabled at all. |
51 if (subresource_filter::GetActiveConfigurations() | 52 if (!base::FeatureList::IsEnabled( |
52 ->the_one_and_only() | 53 subresource_filter::kSafeBrowsingSubresourceFilter)) { |
53 .activation_scope == subresource_filter::ActivationScope::NO_SITES) { | |
54 return; | 54 return; |
55 } | 55 } |
56 | 56 |
57 if (navigation_handle->IsInMainFrame()) { | 57 if (navigation_handle->IsInMainFrame()) { |
58 safe_browsing::SafeBrowsingService* safe_browsing_service = | 58 safe_browsing::SafeBrowsingService* safe_browsing_service = |
59 g_browser_process->safe_browsing_service(); | 59 g_browser_process->safe_browsing_service(); |
60 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager; | 60 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager; |
61 if (safe_browsing_service && | 61 if (safe_browsing_service && |
62 safe_browsing_service->database_manager()->IsSupported() && | 62 safe_browsing_service->database_manager()->IsSupported() && |
63 safe_browsing::V4FeatureList::GetV4UsageStatus() == | 63 safe_browsing::V4FeatureList::GetV4UsageStatus() == |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 url, url, ContentSettingsType::CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, | 151 url, url, ContentSettingsType::CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, |
152 std::string()); | 152 std::string()); |
153 } | 153 } |
154 | 154 |
155 subresource_filter::VerifiedRulesetDealer::Handle* | 155 subresource_filter::VerifiedRulesetDealer::Handle* |
156 ChromeSubresourceFilterClient::GetRulesetDealer() { | 156 ChromeSubresourceFilterClient::GetRulesetDealer() { |
157 subresource_filter::ContentRulesetService* ruleset_service = | 157 subresource_filter::ContentRulesetService* ruleset_service = |
158 g_browser_process->subresource_filter_ruleset_service(); | 158 g_browser_process->subresource_filter_ruleset_service(); |
159 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr; | 159 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr; |
160 } | 160 } |
OLD | NEW |