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

Side by Side Diff: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc

Issue 2890253002: [subresource_filter] Move OnReloadRequested to the ChromeClient (Closed)
Patch Set: remove from the base class 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 "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" 5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h"
6 6
7 #include "base/feature_list.h"
8 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
9 #include "base/metrics/histogram_macros.h"
10 #include "base/rand_util.h" 8 #include "base/rand_util.h"
11 #include "base/time/time.h" 9 #include "base/time/time.h"
12 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
13 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
14 #include "components/subresource_filter/content/browser/content_activation_list_ utils.h" 12 #include "components/subresource_filter/content/browser/content_activation_list_ utils.h"
15 #include "components/subresource_filter/content/browser/subresource_filter_clien t.h" 13 #include "components/subresource_filter/content/browser/subresource_filter_clien t.h"
16 #include "components/subresource_filter/core/browser/subresource_filter_features .h" 14 #include "components/subresource_filter/core/browser/subresource_filter_features .h"
17 #include "components/subresource_filter/core/common/activation_list.h" 15 #include "components/subresource_filter/core/common/activation_list.h"
18 #include "components/subresource_filter/core/common/activation_state.h" 16 #include "components/subresource_filter/core/common/activation_state.h"
19 #include "content/public/browser/navigation_handle.h" 17 #include "content/public/browser/navigation_handle.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return true; 148 return true;
151 } 149 }
152 return false; 150 return false;
153 case ActivationScope::NO_SITES: 151 case ActivationScope::NO_SITES:
154 return false; 152 return false;
155 } 153 }
156 NOTREACHED(); 154 NOTREACHED();
157 return false; 155 return false;
158 } 156 }
159 157
160 void ContentSubresourceFilterDriverFactory::OnReloadRequested() {
161 UMA_HISTOGRAM_BOOLEAN("SubresourceFilter.Prompt.NumReloads", true);
162 const GURL& whitelist_url = web_contents()->GetLastCommittedURL();
163
164 // Only whitelist via content settings when using the experimental UI,
165 // otherwise could get into a situation where content settings cannot be
166 // adjusted.
167 if (base::FeatureList::IsEnabled(
168 subresource_filter::kSafeBrowsingSubresourceFilterExperimentalUI)) {
169 client_->WhitelistByContentSettings(whitelist_url);
170 } else {
171 client_->WhitelistInCurrentWebContents(whitelist_url);
172 }
173 web_contents()->GetController().Reload(content::ReloadType::NORMAL, true);
174 }
175
176 void ContentSubresourceFilterDriverFactory::WillProcessResponse( 158 void ContentSubresourceFilterDriverFactory::WillProcessResponse(
177 content::NavigationHandle* navigation_handle) { 159 content::NavigationHandle* navigation_handle) {
178 DCHECK(!navigation_handle->IsSameDocument()); 160 DCHECK(!navigation_handle->IsSameDocument());
179 if (!navigation_handle->IsInMainFrame() || 161 if (!navigation_handle->IsInMainFrame() ||
180 navigation_handle->GetNetErrorCode() != net::OK) { 162 navigation_handle->GetNetErrorCode() != net::OK) {
181 return; 163 return;
182 } 164 }
183 165
184 const GURL& url = navigation_handle->GetURL(); 166 const GURL& url = navigation_handle->GetURL();
185 const content::Referrer& referrer = navigation_handle->GetReferrer(); 167 const content::Referrer& referrer = navigation_handle->GetReferrer();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void ContentSubresourceFilterDriverFactory::AddActivationListMatch( 244 void ContentSubresourceFilterDriverFactory::AddActivationListMatch(
263 const GURL& url, 245 const GURL& url,
264 ActivationList match_type) { 246 ActivationList match_type) {
265 if (match_type == ActivationList::NONE) 247 if (match_type == ActivationList::NONE)
266 return; 248 return;
267 if (url.has_host() && url.SchemeIsHTTPOrHTTPS()) 249 if (url.has_host() && url.SchemeIsHTTPOrHTTPS())
268 activation_list_matches_[DistillURLToHostAndPath(url)].insert(match_type); 250 activation_list_matches_[DistillURLToHostAndPath(url)].insert(match_type);
269 } 251 }
270 252
271 } // namespace subresource_filter 253 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698