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

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

Issue 2691423006: Introduce the ThrottleManager (Closed)
Patch Set: update NavigationSimulator description 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
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 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FRAME_ACTIVATION_NAVIGATIO N_THROTTLE_H_ 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FRAME_ACTIVATION_NAVIGATIO N_THROTTLE_H_
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FRAME_ACTIVATION_NAVIGATIO N_THROTTLE_H_ 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FRAME_ACTIVATION_NAVIGATIO N_THROTTLE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() 56 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse()
57 override; 57 override;
58 58
59 // After the navigation is finished, the client may optionally choose to 59 // After the navigation is finished, the client may optionally choose to
60 // continue using the DocumentSubresourceFilter that was used to compute the 60 // continue using the DocumentSubresourceFilter that was used to compute the
61 // activation state for this frame. The transfered filter can be cached and 61 // activation state for this frame. The transfered filter can be cached and
62 // used to calculate load policy for subframe navigations occuring in this 62 // used to calculate load policy for subframe navigations occuring in this
63 // frame. 63 // frame.
64 std::unique_ptr<AsyncDocumentSubresourceFilter> ReleaseFilter(); 64 std::unique_ptr<AsyncDocumentSubresourceFilter> ReleaseFilter();
65 65
66 // Gets the activation state calculated for this navigation. Must be called 66 AsyncDocumentSubresourceFilter* filter() { return async_filter_.get(); }
67 // after the navigation is resumed from getting paused in WillProcessResponse, 67
68 // which, for example, will have happened at ReadyToCommitNavigation. 68 void WillSendActivationToRenderer();
69 const ActivationState& GetActivationState() const;
70 69
71 private: 70 private:
72 void SetActivationStateAndResume(ActivationState state); 71 void OnActivationStateComputed(ActivationState state);
72 void set_async_filter(
engedy 2017/03/20 18:58:14 nit: set_filter for consistency with methods above
Charlie Harrison 2017/03/20 20:02:56 Done.
73 std::unique_ptr<AsyncDocumentSubresourceFilter> async_filter) {
74 async_filter_ = std::move(async_filter);
75 }
73 76
74 ActivationStateComputingNavigationThrottle( 77 ActivationStateComputingNavigationThrottle(
75 content::NavigationHandle* navigation_handle, 78 content::NavigationHandle* navigation_handle,
76 const base::Optional<ActivationState> parent_activation_state, 79 const base::Optional<ActivationState> parent_activation_state,
77 VerifiedRuleset::Handle* ruleset_handle); 80 VerifiedRuleset::Handle* ruleset_handle);
78 81
79 // These members are optional to allow DCHECKing their existence at certain 82 // Optional to allow for DCHECKing.
80 // points in the navigation flow.
81 base::Optional<ActivationState> activation_state_;
82 base::Optional<ActivationState> parent_activation_state_; 83 base::Optional<ActivationState> parent_activation_state_;
83 84
84 std::unique_ptr<AsyncDocumentSubresourceFilter> async_filter_; 85 std::unique_ptr<AsyncDocumentSubresourceFilter> async_filter_;
85 86
86 // Must outlive this class. For main frame navigations, this member will be 87 // Must outlive this class. For main frame navigations, this member will be
87 // nullptr until NotifyPageActivationWithRuleset is called. 88 // nullptr until NotifyPageActivationWithRuleset is called.
88 VerifiedRuleset::Handle* ruleset_handle_; 89 VerifiedRuleset::Handle* ruleset_handle_;
89 90
91 // Becomes set to true when the throttle manager reaches
engedy 2017/03/20 18:58:14 nit: s/set to//
Charlie Harrison 2017/03/20 20:02:56 Done.
92 // ReadyToCommitNavigation and sends an activation IPC to the render process.
93 // Makes sure a caller cannot take ownership of the subresource filter unless
94 // an activation IPC is sent to the renderer.
95 bool will_send_activation_to_renderer_ = false;
96
90 base::WeakPtrFactory<ActivationStateComputingNavigationThrottle> 97 base::WeakPtrFactory<ActivationStateComputingNavigationThrottle>
91 weak_ptr_factory_; 98 weak_ptr_factory_;
92 99
93 DISALLOW_COPY_AND_ASSIGN(ActivationStateComputingNavigationThrottle); 100 DISALLOW_COPY_AND_ASSIGN(ActivationStateComputingNavigationThrottle);
94 }; 101 };
95 102
96 } // namespace subresource_filter 103 } // namespace subresource_filter
97 104
98 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FRAME_ACTIVATION_NAVIGA TION_THROTTLE_H_ 105 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FRAME_ACTIVATION_NAVIGA TION_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698