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

Side by Side Diff: chrome/browser/subresource_filter/chrome_subresource_filter_client.cc

Issue 2844063002: Add support for multiple simultaneous subresource_filter::Configurations. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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/tab_specific_content_settings.h" 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
14 #include "chrome/browser/infobars/infobar_service.h" 15 #include "chrome/browser/infobars/infobar_service.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 17 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/browser/subresource_filter/subresource_filter_content_settings_ manager.h" 18 #include "chrome/browser/subresource_filter/subresource_filter_content_settings_ manager.h"
18 #include "chrome/browser/subresource_filter/subresource_filter_profile_context.h " 19 #include "chrome/browser/subresource_filter/subresource_filter_profile_context.h "
19 #include "chrome/browser/subresource_filter/subresource_filter_profile_context_f actory.h" 20 #include "chrome/browser/subresource_filter/subresource_filter_profile_context_f actory.h"
(...skipping 25 matching lines...) Expand all
45 subresource_filter::ContentSubresourceFilterDriverFactory:: 46 subresource_filter::ContentSubresourceFilterDriverFactory::
46 CreateForWebContents(web_contents, this); 47 CreateForWebContents(web_contents, this);
47 } 48 }
48 49
49 ChromeSubresourceFilterClient::~ChromeSubresourceFilterClient() {} 50 ChromeSubresourceFilterClient::~ChromeSubresourceFilterClient() {}
50 51
51 void ChromeSubresourceFilterClient::MaybeAppendNavigationThrottles( 52 void ChromeSubresourceFilterClient::MaybeAppendNavigationThrottles(
52 content::NavigationHandle* navigation_handle, 53 content::NavigationHandle* navigation_handle,
53 std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) { 54 std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) {
54 // Don't add any throttles if the feature isn't enabled at all. 55 // Don't add any throttles if the feature isn't enabled at all.
55 if (subresource_filter::GetActiveConfigurations() 56 if (!base::FeatureList::IsEnabled(
56 ->the_one_and_only() 57 subresource_filter::kSafeBrowsingSubresourceFilter)) {
57 .activation_scope == subresource_filter::ActivationScope::NO_SITES) {
58 return; 58 return;
59 } 59 }
60 60
61 if (navigation_handle->IsInMainFrame()) { 61 if (navigation_handle->IsInMainFrame()) {
62 safe_browsing::SafeBrowsingService* safe_browsing_service = 62 safe_browsing::SafeBrowsingService* safe_browsing_service =
63 g_browser_process->safe_browsing_service(); 63 g_browser_process->safe_browsing_service();
64 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager; 64 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager;
65 if (safe_browsing_service && 65 if (safe_browsing_service &&
66 safe_browsing_service->database_manager()->IsSupported() && 66 safe_browsing_service->database_manager()->IsSupported() &&
67 safe_browsing::V4FeatureList::GetV4UsageStatus() == 67 safe_browsing::V4FeatureList::GetV4UsageStatus() ==
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.Actions", action, 140 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.Actions", action,
141 kActionLastEntry); 141 kActionLastEntry);
142 } 142 }
143 143
144 subresource_filter::VerifiedRulesetDealer::Handle* 144 subresource_filter::VerifiedRulesetDealer::Handle*
145 ChromeSubresourceFilterClient::GetRulesetDealer() { 145 ChromeSubresourceFilterClient::GetRulesetDealer() {
146 subresource_filter::ContentRulesetService* ruleset_service = 146 subresource_filter::ContentRulesetService* ruleset_service =
147 g_browser_process->subresource_filter_ruleset_service(); 147 g_browser_process->subresource_filter_ruleset_service();
148 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr; 148 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr;
149 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698