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

Side by Side Diff: components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.h

Issue 2696493003: Introduce SubframeNavigationFilteringThrottle (Closed)
Patch Set: remove tests Created 3 years, 9 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
(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_NAVIGATION_FILTER ING_THROTTLE_H_
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_NAVIGATION_FILTER ING_THROTTLE_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/subresource_filter/content/browser/async_document_subresour ce_filter.h"
11 #include "content/public/browser/navigation_throttle.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 filtering subframe document loads, which
22 // are considered subresource loads of their parent frame, hence are subject to
23 // subresource filtering using the parent frame's
24 // AsyncDocumentSubresourceFilter.
25 //
26 // The throttle should only be instantiated for navigations occuring in
27 // subframes owned by documents which already have filtering activated, and
28 // therefore an associated (Async)DocumentSubresourceFilter.
29 class SubframeNavigationFilteringThrottle : public content::NavigationThrottle {
30 public:
31 SubframeNavigationFilteringThrottle(
32 content::NavigationHandle* handle,
33 AsyncDocumentSubresourceFilter* parent_frame_filter);
34 ~SubframeNavigationFilteringThrottle() override;
35
36 // content::NavigationThrottle:
37 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
38 content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest()
39 override;
40
41 private:
42 content::NavigationThrottle::ThrottleCheckResult DeferToCalculateLoadPolicy();
43 void OnCalculatedLoadPolicy(LoadPolicy policy);
44
45 // Must outlive this class.
46 AsyncDocumentSubresourceFilter* parent_frame_filter_;
47
48 base::WeakPtrFactory<SubframeNavigationFilteringThrottle> weak_ptr_factory_;
49
50 DISALLOW_COPY_AND_ASSIGN(SubframeNavigationFilteringThrottle);
51 };
52
53 } // namespace subresource_filter
54
55 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBFRAME_NAVIGATION_FIL TERING_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698