Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_BLOCKING_NAVIGATI ON_THROTTLE_H_ | |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_BLOCKING_NAVIGATI ON_THROTTLE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "content/public/browser/navigation_throttle.h" | |
| 11 #include "third_party/WebKit/public/platform/WebDocumentSubresourceFilter.h" | |
| 12 | |
| 13 namespace content { | |
| 14 class NavigationHandle; | |
| 15 } // namespace content | |
| 16 | |
| 17 namespace subresource_filter { | |
| 18 | |
| 19 class AsyncDocumentSubresourceFilter; | |
| 20 | |
| 21 // NavigationThrottle responsible for determining the activation level for a | |
| 22 // given frame (including main frames and subframes). This class should only be | |
| 23 // created for subframe navigations occuring in document's which are already | |
|
pkalinnikov
2017/02/14 12:11:07
nit: s/document's/documents/
Charlie Harrison
2017/02/14 14:09:38
Done.
| |
| 24 // activated and have associated DocumentSubresourceFilters. | |
|
pkalinnikov
2017/02/14 12:11:07
Phrasing suggestion:
NavigationThrottle responsib
Charlie Harrison
2017/02/14 14:09:38
Reworded even more, because this class *doesn't* d
| |
| 25 class SubframeFilteringNavigationThrottle : public content::NavigationThrottle { | |
| 26 public: | |
| 27 SubframeFilteringNavigationThrottle( | |
| 28 content::NavigationHandle* handle, | |
| 29 AsyncDocumentSubresourceFilter* async_filter); | |
|
pkalinnikov
2017/02/14 12:11:07
nit: Please call this consistently with the stored
Charlie Harrison
2017/02/14 14:09:38
Done.
| |
| 30 ~SubframeFilteringNavigationThrottle() override; | |
| 31 | |
| 32 // content::NavigationThrottle: | |
| 33 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | |
| 34 content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest() | |
| 35 override; | |
| 36 | |
| 37 private: | |
| 38 content::NavigationThrottle::ThrottleCheckResult DeferToCalculateLoadPolicy(); | |
| 39 void OnCalculatedLoadPolicy( | |
| 40 blink::WebDocumentSubresourceFilter::LoadPolicy policy); | |
| 41 | |
| 42 // Must outlive this class. | |
| 43 AsyncDocumentSubresourceFilter* parent_filter_; | |
| 44 | |
| 45 base::WeakPtrFactory<SubframeFilteringNavigationThrottle> weak_ptr_factory_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(SubframeFilteringNavigationThrottle); | |
| 48 }; | |
| 49 | |
| 50 } // namespace subresource_filter | |
| 51 | |
| 52 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_BLOCKING_NAVIG ATION_THROTTLE_H_ | |
| OLD | NEW |