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

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

Issue 2871013002: [subresource_filter] Refactor activation suppression (Closed)
Patch Set: rebase on #470635 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 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/subresource_filter/content/browser/activation_state_computi ng_navigation_throttle.h" 10 #include "components/subresource_filter/content/browser/activation_state_computi ng_navigation_throttle.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 private: 46 private:
47 ContentSubresourceFilterThrottleManager::Delegate* delegate_; 47 ContentSubresourceFilterThrottleManager::Delegate* delegate_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(ForwardingNavigationThrottle); 49 DISALLOW_COPY_AND_ASSIGN(ForwardingNavigationThrottle);
50 }; 50 };
51 51
52 } // namespace 52 } // namespace
53 53
54 bool ContentSubresourceFilterThrottleManager::Delegate::
55 ShouldSuppressActivation(content::NavigationHandle* navigation_handle) {
56 return false;
57 }
58
59 ContentSubresourceFilterThrottleManager:: 54 ContentSubresourceFilterThrottleManager::
60 ContentSubresourceFilterThrottleManager( 55 ContentSubresourceFilterThrottleManager(
61 Delegate* delegate, 56 Delegate* delegate,
62 VerifiedRulesetDealer::Handle* dealer_handle, 57 VerifiedRulesetDealer::Handle* dealer_handle,
63 content::WebContents* web_contents) 58 content::WebContents* web_contents)
64 : content::WebContentsObserver(web_contents), 59 : content::WebContentsObserver(web_contents),
65 dealer_handle_(dealer_handle), 60 dealer_handle_(dealer_handle),
66 delegate_(delegate), 61 delegate_(delegate),
67 weak_ptr_factory_(this) {} 62 weak_ptr_factory_(this) {}
68 63
(...skipping 24 matching lines...) Expand all
93 void ContentSubresourceFilterThrottleManager::ReadyToCommitNavigation( 88 void ContentSubresourceFilterThrottleManager::ReadyToCommitNavigation(
94 content::NavigationHandle* navigation_handle) { 89 content::NavigationHandle* navigation_handle) {
95 auto throttle = ongoing_activation_throttles_.find(navigation_handle); 90 auto throttle = ongoing_activation_throttles_.find(navigation_handle);
96 if (throttle == ongoing_activation_throttles_.end()) 91 if (throttle == ongoing_activation_throttles_.end())
97 return; 92 return;
98 93
99 // A filter with DISABLED activation indicates a corrupted ruleset. 94 // A filter with DISABLED activation indicates a corrupted ruleset.
100 AsyncDocumentSubresourceFilter* filter = throttle->second->filter(); 95 AsyncDocumentSubresourceFilter* filter = throttle->second->filter();
101 if (!filter || navigation_handle->GetNetErrorCode() != net::OK || 96 if (!filter || navigation_handle->GetNetErrorCode() != net::OK ||
102 filter->activation_state().activation_level == 97 filter->activation_state().activation_level ==
103 ActivationLevel::DISABLED || 98 ActivationLevel::DISABLED) {
104 delegate_->ShouldSuppressActivation(navigation_handle)) {
105 return; 99 return;
106 } 100 }
107 101
108 throttle->second->WillSendActivationToRenderer(); 102 throttle->second->WillSendActivationToRenderer();
109 103
110 content::RenderFrameHost* frame_host = 104 content::RenderFrameHost* frame_host =
111 navigation_handle->GetRenderFrameHost(); 105 navigation_handle->GetRenderFrameHost();
112 frame_host->Send(new SubresourceFilterMsg_ActivateForNextCommittedLoad( 106 frame_host->Send(new SubresourceFilterMsg_ActivateForNextCommittedLoad(
113 frame_host->GetRoutingID(), filter->activation_state())); 107 frame_host->GetRoutingID(), filter->activation_state()));
114 } 108 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 270 }
277 } 271 }
278 272
279 void ContentSubresourceFilterThrottleManager::OnDocumentLoadStatistics( 273 void ContentSubresourceFilterThrottleManager::OnDocumentLoadStatistics(
280 const DocumentLoadStatistics& statistics) { 274 const DocumentLoadStatistics& statistics) {
281 if (statistics_) 275 if (statistics_)
282 statistics_->OnDocumentLoadStatistics(statistics); 276 statistics_->OnDocumentLoadStatistics(statistics);
283 } 277 }
284 278
285 } // namespace subresource_filter 279 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698