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

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

Issue 2795053002: [subresource_filter] Implement the "Smart" UI on Android (Closed)
Patch Set: raymes review Created 3 years, 8 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" 7 #include "base/feature_list.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if (configuration_.should_whitelist_site_on_reload && 216 if (configuration_.should_whitelist_site_on_reload &&
217 NavigationIsPageReload(url, referrer, transition)) { 217 NavigationIsPageReload(url, referrer, transition)) {
218 // Whitelist this host for the current as well as subsequent navigations. 218 // Whitelist this host for the current as well as subsequent navigations.
219 AddHostOfURLToWhitelistSet(url); 219 AddHostOfURLToWhitelistSet(url);
220 } 220 }
221 221
222 activation_decision_ = ComputeActivationDecisionForMainFrameURL(url); 222 activation_decision_ = ComputeActivationDecisionForMainFrameURL(url);
223 DCHECK(activation_decision_ != ActivationDecision::UNKNOWN); 223 DCHECK(activation_decision_ != ActivationDecision::UNKNOWN);
224 if (activation_decision_ != ActivationDecision::ACTIVATED) { 224 if (activation_decision_ != ActivationDecision::ACTIVATED) {
225 ResetActivationState(); 225 ResetActivationState();
226 return; 226 } else {
227 activation_level_ = configuration_.activation_level;
228 measure_performance_ = activation_level_ != ActivationLevel::DISABLED &&
229 ShouldMeasurePerformanceForPageLoad(
230 configuration_.performance_measurement_rate);
227 } 231 }
228 232
229 activation_level_ = configuration_.activation_level;
230 measure_performance_ = activation_level_ != ActivationLevel::DISABLED &&
231 ShouldMeasurePerformanceForPageLoad(
232 configuration_.performance_measurement_rate);
233 ActivationState state = ActivationState(activation_level_); 233 ActivationState state = ActivationState(activation_level_);
234 state.measure_performance = measure_performance_; 234 state.measure_performance = measure_performance_;
235 throttle_manager_->NotifyPageActivationComputed(navigation_handle, state); 235
236 client_->OnActivationComputed(navigation_handle->GetURL(), state);
237 if (activation_level_ != ActivationLevel::DISABLED)
238 throttle_manager_->NotifyPageActivationComputed(navigation_handle, state);
236 } 239 }
237 240
238 void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() { 241 void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() {
239 if (configuration_.should_suppress_notifications) 242 if (configuration_.should_suppress_notifications)
240 return; 243 return;
241 244
242 client_->ToggleNotificationVisibility(activation_level_ == 245 client_->ToggleNotificationVisibility(activation_level_ ==
243 ActivationLevel::ENABLED); 246 ActivationLevel::ENABLED);
244 } 247 }
245 248
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 REPORT_REDIRECT_PATTERN_FOR_SUFFIX("SubresourceFilterOnly", hits_pattern, 407 REPORT_REDIRECT_PATTERN_FOR_SUFFIX("SubresourceFilterOnly", hits_pattern,
405 chain_size); 408 chain_size);
406 break; 409 break;
407 default: 410 default:
408 NOTREACHED(); 411 NOTREACHED();
409 break; 412 break;
410 } 413 }
411 } 414 }
412 415
413 } // namespace subresource_filter 416 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698