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

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

Issue 2890253002: [subresource_filter] Move OnReloadRequested to the ChromeClient (Closed)
Patch Set: rebase on #473448 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/feature_list.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 std::move(database_manager))); 78 std::move(database_manager)));
79 } 79 }
80 80
81 auto* driver_factory = 81 auto* driver_factory =
82 subresource_filter::ContentSubresourceFilterDriverFactory:: 82 subresource_filter::ContentSubresourceFilterDriverFactory::
83 FromWebContents(navigation_handle->GetWebContents()); 83 FromWebContents(navigation_handle->GetWebContents());
84 driver_factory->throttle_manager()->MaybeAppendNavigationThrottles( 84 driver_factory->throttle_manager()->MaybeAppendNavigationThrottles(
85 navigation_handle, throttles); 85 navigation_handle, throttles);
86 } 86 }
87 87
88 void ChromeSubresourceFilterClient::OnReloadRequested() {
89 UMA_HISTOGRAM_BOOLEAN("SubresourceFilter.Prompt.NumReloads", true);
90 const GURL& whitelist_url = web_contents_->GetLastCommittedURL();
91
92 // Only whitelist via content settings when using the experimental UI,
93 // otherwise could get into a situation where content settings cannot be
94 // adjusted.
95 if (base::FeatureList::IsEnabled(
96 subresource_filter::kSafeBrowsingSubresourceFilterExperimentalUI)) {
97 WhitelistByContentSettings(whitelist_url);
98 } else {
99 WhitelistInCurrentWebContents(whitelist_url);
100 }
101 web_contents_->GetController().Reload(content::ReloadType::NORMAL, true);
102 }
103
88 void ChromeSubresourceFilterClient::ToggleNotificationVisibility( 104 void ChromeSubresourceFilterClient::ToggleNotificationVisibility(
89 bool visibility) { 105 bool visibility) {
90 if (did_show_ui_for_navigation_ && visibility) 106 if (did_show_ui_for_navigation_ && visibility)
91 return; 107 return;
92 did_show_ui_for_navigation_ = false; 108 did_show_ui_for_navigation_ = false;
93 109
94 // |visibility| is false when a new navigation starts. 110 // |visibility| is false when a new navigation starts.
95 if (visibility) { 111 if (visibility) {
96 const GURL& top_level_url = web_contents_->GetLastCommittedURL(); 112 const GURL& top_level_url = web_contents_->GetLastCommittedURL();
97 if (!settings_manager_->ShouldShowUIForSite(top_level_url)) { 113 if (!settings_manager_->ShouldShowUIForSite(top_level_url)) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.Actions", action, 167 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.Actions", action,
152 kActionLastEntry); 168 kActionLastEntry);
153 } 169 }
154 170
155 subresource_filter::VerifiedRulesetDealer::Handle* 171 subresource_filter::VerifiedRulesetDealer::Handle*
156 ChromeSubresourceFilterClient::GetRulesetDealer() { 172 ChromeSubresourceFilterClient::GetRulesetDealer() {
157 subresource_filter::ContentRulesetService* ruleset_service = 173 subresource_filter::ContentRulesetService* ruleset_service =
158 g_browser_process->subresource_filter_ruleset_service(); 174 g_browser_process->subresource_filter_ruleset_service();
159 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr; 175 return ruleset_service ? ruleset_service->ruleset_dealer() : nullptr;
160 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698