OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
7 | 7 |
8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 const Referrer& GetReferrer() override; | 69 const Referrer& GetReferrer() override; |
70 bool HasUserGesture() override; | 70 bool HasUserGesture() override; |
71 ui::PageTransition GetPageTransition() override; | 71 ui::PageTransition GetPageTransition() override; |
72 bool IsExternalProtocol() override; | 72 bool IsExternalProtocol() override; |
73 net::Error GetNetErrorCode() override; | 73 net::Error GetNetErrorCode() override; |
74 RenderFrameHostImpl* GetRenderFrameHost() override; | 74 RenderFrameHostImpl* GetRenderFrameHost() override; |
75 bool IsSamePage() override; | 75 bool IsSamePage() override; |
76 bool HasCommitted() override; | 76 bool HasCommitted() override; |
77 bool IsErrorPage() override; | 77 bool IsErrorPage() override; |
78 void Resume() override; | 78 void Resume() override; |
| 79 void CancelDeferredNavigation( |
| 80 NavigationThrottle::ThrottleCheckResult result) override; |
79 void RegisterThrottleForTesting( | 81 void RegisterThrottleForTesting( |
80 scoped_ptr<NavigationThrottle> navigation_throttle) override; | 82 scoped_ptr<NavigationThrottle> navigation_throttle) override; |
81 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 83 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
82 bool is_post, | 84 bool is_post, |
83 const Referrer& sanitized_referrer, | 85 const Referrer& sanitized_referrer, |
84 bool has_user_gesture, | 86 bool has_user_gesture, |
85 ui::PageTransition transition, | 87 ui::PageTransition transition, |
86 bool is_external_protocol) override; | 88 bool is_external_protocol) override; |
87 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( | 89 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( |
88 const GURL& new_url, | 90 const GURL& new_url, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 private: | 151 private: |
150 friend class NavigationHandleImplTest; | 152 friend class NavigationHandleImplTest; |
151 | 153 |
152 // Used to track the state the navigation is currently in. | 154 // Used to track the state the navigation is currently in. |
153 enum State { | 155 enum State { |
154 INITIAL = 0, | 156 INITIAL = 0, |
155 WILL_SEND_REQUEST, | 157 WILL_SEND_REQUEST, |
156 DEFERRING_START, | 158 DEFERRING_START, |
157 WILL_REDIRECT_REQUEST, | 159 WILL_REDIRECT_REQUEST, |
158 DEFERRING_REDIRECT, | 160 DEFERRING_REDIRECT, |
| 161 CANCELING, |
159 READY_TO_COMMIT, | 162 READY_TO_COMMIT, |
160 DID_COMMIT, | 163 DID_COMMIT, |
161 DID_COMMIT_ERROR_PAGE, | 164 DID_COMMIT_ERROR_PAGE, |
162 }; | 165 }; |
163 | 166 |
164 NavigationHandleImpl(const GURL& url, | 167 NavigationHandleImpl(const GURL& url, |
165 FrameTreeNode* frame_tree_node); | 168 FrameTreeNode* frame_tree_node); |
166 | 169 |
167 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 170 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
168 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 171 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
169 | 172 |
| 173 // Helper function to run and reset the |complete_callback_|. This marks the |
| 174 // end of a round of NavigationThrottleChecks. |
| 175 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
| 176 |
170 // Used in tests. | 177 // Used in tests. |
171 State state() const { return state_; } | 178 State state() const { return state_; } |
172 | 179 |
173 // See NavigationHandle for a description of those member variables. | 180 // See NavigationHandle for a description of those member variables. |
174 GURL url_; | 181 GURL url_; |
175 bool is_post_; | 182 bool is_post_; |
176 Referrer sanitized_referrer_; | 183 Referrer sanitized_referrer_; |
177 bool has_user_gesture_; | 184 bool has_user_gesture_; |
178 ui::PageTransition transition_; | 185 ui::PageTransition transition_; |
179 bool is_external_protocol_; | 186 bool is_external_protocol_; |
(...skipping 24 matching lines...) Expand all Loading... |
204 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 211 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
205 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 212 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
206 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 213 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
207 | 214 |
208 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 215 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
209 }; | 216 }; |
210 | 217 |
211 } // namespace content | 218 } // namespace content |
212 | 219 |
213 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 220 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |