| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_throttle_manager.h" | 5 #include "components/subresource_filter/content/browser/content_subresource_filt
er_throttle_manager.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 10 #include "components/subresource_filter/content/browser/activation_state_computi
ng_navigation_throttle.h" | 12 #include "components/subresource_filter/content/browser/activation_state_computi
ng_navigation_throttle.h" |
| 11 #include "components/subresource_filter/content/browser/async_document_subresour
ce_filter.h" | 13 #include "components/subresource_filter/content/browser/async_document_subresour
ce_filter.h" |
| 12 #include "components/subresource_filter/content/browser/page_load_statistics.h" | 14 #include "components/subresource_filter/content/browser/page_load_statistics.h" |
| 13 #include "components/subresource_filter/content/browser/subframe_navigation_filt
ering_throttle.h" | 15 #include "components/subresource_filter/content/browser/subframe_navigation_filt
ering_throttle.h" |
| 14 #include "components/subresource_filter/content/common/subresource_filter_messag
es.h" | 16 #include "components/subresource_filter/content/common/subresource_filter_messag
es.h" |
| 15 #include "content/public/browser/navigation_handle.h" | 17 #include "content/public/browser/navigation_handle.h" |
| 16 #include "content/public/browser/navigation_throttle.h" | 18 #include "content/public/browser/navigation_throttle.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 100 |
| 99 // A filter with DISABLED activation indicates a corrupted ruleset. | 101 // A filter with DISABLED activation indicates a corrupted ruleset. |
| 100 AsyncDocumentSubresourceFilter* filter = throttle->second->filter(); | 102 AsyncDocumentSubresourceFilter* filter = throttle->second->filter(); |
| 101 if (!filter || navigation_handle->GetNetErrorCode() != net::OK || | 103 if (!filter || navigation_handle->GetNetErrorCode() != net::OK || |
| 102 filter->activation_state().activation_level == | 104 filter->activation_state().activation_level == |
| 103 ActivationLevel::DISABLED || | 105 ActivationLevel::DISABLED || |
| 104 delegate_->ShouldSuppressActivation(navigation_handle)) { | 106 delegate_->ShouldSuppressActivation(navigation_handle)) { |
| 105 return; | 107 return; |
| 106 } | 108 } |
| 107 | 109 |
| 110 if (navigation_handle->IsInMainFrame()) |
| 111 delegate_->OnPageActivated(filter->activation_state()); |
| 108 throttle->second->WillSendActivationToRenderer(); | 112 throttle->second->WillSendActivationToRenderer(); |
| 109 | 113 |
| 110 content::RenderFrameHost* frame_host = | 114 content::RenderFrameHost* frame_host = |
| 111 navigation_handle->GetRenderFrameHost(); | 115 navigation_handle->GetRenderFrameHost(); |
| 112 frame_host->Send(new SubresourceFilterMsg_ActivateForNextCommittedLoad( | 116 frame_host->Send(new SubresourceFilterMsg_ActivateForNextCommittedLoad( |
| 113 frame_host->GetRoutingID(), filter->activation_state())); | 117 frame_host->GetRoutingID(), filter->activation_state())); |
| 114 } | 118 } |
| 115 | 119 |
| 116 void ContentSubresourceFilterThrottleManager::DidFinishNavigation( | 120 void ContentSubresourceFilterThrottleManager::DidFinishNavigation( |
| 117 content::NavigationHandle* navigation_handle) { | 121 content::NavigationHandle* navigation_handle) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 281 } |
| 278 } | 282 } |
| 279 | 283 |
| 280 void ContentSubresourceFilterThrottleManager::OnDocumentLoadStatistics( | 284 void ContentSubresourceFilterThrottleManager::OnDocumentLoadStatistics( |
| 281 const DocumentLoadStatistics& statistics) { | 285 const DocumentLoadStatistics& statistics) { |
| 282 if (statistics_) | 286 if (statistics_) |
| 283 statistics_->OnDocumentLoadStatistics(statistics); | 287 statistics_->OnDocumentLoadStatistics(statistics); |
| 284 } | 288 } |
| 285 | 289 |
| 286 } // namespace subresource_filter | 290 } // namespace subresource_filter |
| OLD | NEW |