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

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

Issue 2893183002: [subresource_filter] Use the SubresourceFilterObserver for PageLoadMetrics (Closed)
Patch Set: bmcquade review Created 3 years, 6 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/feature_list.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 settings_manager_ = context->settings_manager(); 45 settings_manager_ = context->settings_manager();
46 subresource_filter::ContentSubresourceFilterDriverFactory:: 46 subresource_filter::ContentSubresourceFilterDriverFactory::
47 CreateForWebContents(web_contents, this); 47 CreateForWebContents(web_contents, this);
48 } 48 }
49 49
50 ChromeSubresourceFilterClient::~ChromeSubresourceFilterClient() {} 50 ChromeSubresourceFilterClient::~ChromeSubresourceFilterClient() {}
51 51
52 void ChromeSubresourceFilterClient::MaybeAppendNavigationThrottles( 52 void ChromeSubresourceFilterClient::MaybeAppendNavigationThrottles(
53 content::NavigationHandle* navigation_handle, 53 content::NavigationHandle* navigation_handle,
54 std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) { 54 std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) {
55 // Don't add any throttles if the feature isn't enabled at all.
56 if (!base::FeatureList::IsEnabled(
57 subresource_filter::kSafeBrowsingSubresourceFilter)) {
58 return;
59 }
60
61 if (navigation_handle->IsInMainFrame()) { 55 if (navigation_handle->IsInMainFrame()) {
62 safe_browsing::SafeBrowsingService* safe_browsing_service = 56 safe_browsing::SafeBrowsingService* safe_browsing_service =
63 g_browser_process->safe_browsing_service(); 57 g_browser_process->safe_browsing_service();
64 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager; 58 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager;
65 if (safe_browsing_service && 59 if (safe_browsing_service &&
66 safe_browsing_service->database_manager()->IsSupported() && 60 safe_browsing_service->database_manager()->IsSupported() &&
67 safe_browsing::V4FeatureList::GetV4UsageStatus() == 61 safe_browsing::V4FeatureList::GetV4UsageStatus() ==
68 safe_browsing::V4FeatureList::V4UsageStatus::V4_ONLY) { 62 safe_browsing::V4FeatureList::V4UsageStatus::V4_ONLY) {
69 database_manager = safe_browsing_service->database_manager(); 63 database_manager = safe_browsing_service->database_manager();
70 } 64 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.Actions", action, 161 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.Actions", action,
168 kActionLastEntry); 162 kActionLastEntry);
169 } 163 }
170 164
171 subresource_filter::VerifiedRulesetDealer::Handle* 165 subresource_filter::VerifiedRulesetDealer::Handle*
172 ChromeSubresourceFilterClient::GetRulesetDealer() { 166 ChromeSubresourceFilterClient::GetRulesetDealer() {
173 subresource_filter::ContentRulesetService* ruleset_service = 167 subresource_filter::ContentRulesetService* ruleset_service =
174 g_browser_process->subresource_filter_ruleset_service(); 168 g_browser_process->subresource_filter_ruleset_service();
175 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr; 169 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr;
176 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698