Chromium Code Reviews| Index: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc |
| diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc |
| index b7b65090bb2342f4df00441fa0c4ac7b598c89a5..12b21a1b8f435eb4a18586d283cf3ffd4e2b17bf 100644 |
| --- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc |
| +++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc |
| @@ -7,7 +7,6 @@ |
| #include "base/metrics/histogram_macros.h" |
| #include "base/rand_util.h" |
| #include "base/time/time.h" |
| -#include "components/subresource_filter/content/browser/content_subresource_filter_driver.h" |
| #include "components/subresource_filter/content/common/subresource_filter_messages.h" |
| #include "components/subresource_filter/core/browser/subresource_filter_client.h" |
| #include "components/subresource_filter/core/browser/subresource_filter_features.h" |
| @@ -77,25 +76,11 @@ ContentSubresourceFilterDriverFactory::ContentSubresourceFilterDriverFactory( |
| : content::WebContentsObserver(web_contents), |
| client_(std::move(client)), |
| activation_level_(ActivationLevel::DISABLED), |
| - measure_performance_(false) { |
| - content::RenderFrameHost* main_frame_host = web_contents->GetMainFrame(); |
| - if (main_frame_host && main_frame_host->IsRenderFrameLive()) |
| - CreateDriverForFrameHostIfNeeded(main_frame_host); |
| -} |
| + measure_performance_(false) {} |
| ContentSubresourceFilterDriverFactory:: |
| ~ContentSubresourceFilterDriverFactory() {} |
| -void ContentSubresourceFilterDriverFactory::CreateDriverForFrameHostIfNeeded( |
| - content::RenderFrameHost* render_frame_host) { |
| - auto iterator_and_inserted = |
| - frame_drivers_.insert(std::make_pair(render_frame_host, nullptr)); |
| - if (iterator_and_inserted.second) { |
| - iterator_and_inserted.first->second.reset( |
| - new ContentSubresourceFilterDriver(render_frame_host)); |
| - } |
| -} |
| - |
| void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() { |
| if (ShouldSuppressNotifications()) |
| return; |
| @@ -179,10 +164,10 @@ void ContentSubresourceFilterDriverFactory::ActivateForFrameHostIfNeeded( |
| // filtering for the subsequent error page load. This is probably harmless, |
| // but not sending an activation message is even cleaner. |
| if (activation_level_ != ActivationLevel::DISABLED && !failed_navigation) { |
| - auto* driver = DriverFromFrameHost(render_frame_host); |
| - DCHECK(driver); |
| - driver->ActivateForNextCommittedLoad(GetMaximumActivationLevel(), |
| - measure_performance_); |
| + render_frame_host->Send( |
| + new SubresourceFilterMsg_ActivateForNextCommittedLoad( |
| + render_frame_host->GetRoutingID(), activation_level_, |
|
Charlie Harrison
2017/02/15 19:22:23
Is removing GetMaximumActivationLevel here just a
engedy
2017/02/15 21:36:55
Yes, the two should always have the same value, so
|
| + measure_performance_)); |
| } |
| } |
| @@ -193,21 +178,6 @@ void ContentSubresourceFilterDriverFactory::OnReloadRequested() { |
| web_contents()->GetController().Reload(content::ReloadType::NORMAL, true); |
| } |
| -void ContentSubresourceFilterDriverFactory::SetDriverForFrameHostForTesting( |
| - content::RenderFrameHost* render_frame_host, |
| - std::unique_ptr<ContentSubresourceFilterDriver> driver) { |
| - auto iterator_and_inserted = |
| - frame_drivers_.insert(std::make_pair(render_frame_host, nullptr)); |
| - iterator_and_inserted.first->second = std::move(driver); |
| -} |
| - |
| -ContentSubresourceFilterDriver* |
| -ContentSubresourceFilterDriverFactory::DriverFromFrameHost( |
| - content::RenderFrameHost* render_frame_host) { |
| - auto iterator = frame_drivers_.find(render_frame_host); |
| - return iterator == frame_drivers_.end() ? nullptr : iterator->second.get(); |
| -} |
| - |
| void ContentSubresourceFilterDriverFactory::ResetActivationState() { |
| navigation_chain_.clear(); |
| activation_list_matches_.clear(); |
| @@ -232,16 +202,6 @@ void ContentSubresourceFilterDriverFactory::DidRedirectNavigation( |
| navigation_chain_.push_back(navigation_handle->GetURL()); |
| } |
| -void ContentSubresourceFilterDriverFactory::RenderFrameCreated( |
| - content::RenderFrameHost* render_frame_host) { |
| - CreateDriverForFrameHostIfNeeded(render_frame_host); |
| -} |
| - |
| -void ContentSubresourceFilterDriverFactory::RenderFrameDeleted( |
| - content::RenderFrameHost* render_frame_host) { |
| - frame_drivers_.erase(render_frame_host); |
| -} |
| - |
| void ContentSubresourceFilterDriverFactory::ReadyToCommitNavigation( |
| content::NavigationHandle* navigation_handle) { |
| DCHECK(!navigation_handle->IsSamePage()); |