| OLD | NEW |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 NavigationIsPageReload(url, referrer, transition)) { | 194 NavigationIsPageReload(url, referrer, transition)) { |
| 195 // Whitelist this host for the current as well as subsequent navigations. | 195 // Whitelist this host for the current as well as subsequent navigations. |
| 196 client_->WhitelistInCurrentWebContents(url); | 196 client_->WhitelistInCurrentWebContents(url); |
| 197 } | 197 } |
| 198 | 198 |
| 199 activation_decision_ = | 199 activation_decision_ = |
| 200 ComputeActivationDecisionForMainFrameNavigation(navigation_handle); | 200 ComputeActivationDecisionForMainFrameNavigation(navigation_handle); |
| 201 DCHECK(activation_decision_ != ActivationDecision::UNKNOWN); | 201 DCHECK(activation_decision_ != ActivationDecision::UNKNOWN); |
| 202 if (activation_decision_ != ActivationDecision::ACTIVATED) { | 202 if (activation_decision_ != ActivationDecision::ACTIVATED) { |
| 203 ResetActivationState(); | 203 ResetActivationState(); |
| 204 return; | 204 } else { |
| 205 activation_level_ = configurations->the_one_and_only().activation_level; |
| 206 measure_performance_ = |
| 207 activation_level_ != ActivationLevel::DISABLED && |
| 208 ShouldMeasurePerformanceForPageLoad( |
| 209 configurations->the_one_and_only().performance_measurement_rate); |
| 205 } | 210 } |
| 206 | 211 |
| 207 activation_level_ = configurations->the_one_and_only().activation_level; | |
| 208 measure_performance_ = | |
| 209 activation_level_ != ActivationLevel::DISABLED && | |
| 210 ShouldMeasurePerformanceForPageLoad( | |
| 211 configurations->the_one_and_only().performance_measurement_rate); | |
| 212 ActivationState state = ActivationState(activation_level_); | 212 ActivationState state = ActivationState(activation_level_); |
| 213 state.measure_performance = measure_performance_; | 213 state.measure_performance = measure_performance_; |
| 214 throttle_manager_->NotifyPageActivationComputed(navigation_handle, state); | 214 |
| 215 if (activation_level_ != ActivationLevel::DISABLED) |
| 216 throttle_manager_->NotifyPageActivationComputed(navigation_handle, state); |
| 215 } | 217 } |
| 216 | 218 |
| 217 void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() { | 219 void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() { |
| 218 auto configurations = GetActiveConfigurations(); | 220 auto configurations = GetActiveConfigurations(); |
| 219 if (configurations->the_one_and_only().should_suppress_notifications) | 221 if (configurations->the_one_and_only().should_suppress_notifications) |
| 220 return; | 222 return; |
| 221 | 223 |
| 222 client_->ToggleNotificationVisibility(activation_level_ == | 224 client_->ToggleNotificationVisibility(activation_level_ == |
| 223 ActivationLevel::ENABLED); | 225 ActivationLevel::ENABLED); |
| 224 } | 226 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 REPORT_REDIRECT_PATTERN_FOR_SUFFIX("SubresourceFilterOnly", hits_pattern, | 330 REPORT_REDIRECT_PATTERN_FOR_SUFFIX("SubresourceFilterOnly", hits_pattern, |
| 329 chain_size); | 331 chain_size); |
| 330 break; | 332 break; |
| 331 default: | 333 default: |
| 332 NOTREACHED(); | 334 NOTREACHED(); |
| 333 break; | 335 break; |
| 334 } | 336 } |
| 335 } | 337 } |
| 336 | 338 |
| 337 } // namespace subresource_filter | 339 } // namespace subresource_filter |
| OLD | NEW |