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 <stddef.h> | 10 #include <stddef.h> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const GURL& url, | 88 const GURL& url, |
89 const std::vector<GURL>& redirect_chain, | 89 const std::vector<GURL>& redirect_chain, |
90 FrameTreeNode* frame_tree_node, | 90 FrameTreeNode* frame_tree_node, |
91 bool is_renderer_initiated, | 91 bool is_renderer_initiated, |
92 bool is_same_page, | 92 bool is_same_page, |
93 const base::TimeTicks& navigation_start, | 93 const base::TimeTicks& navigation_start, |
94 int pending_nav_entry_id, | 94 int pending_nav_entry_id, |
95 bool started_from_context_menu); | 95 bool started_from_context_menu); |
96 ~NavigationHandleImpl() override; | 96 ~NavigationHandleImpl() override; |
97 | 97 |
| 98 // Used to track the state the navigation is currently in. |
| 99 enum State { |
| 100 INITIAL = 0, |
| 101 WILL_SEND_REQUEST, |
| 102 DEFERRING_START, |
| 103 WILL_REDIRECT_REQUEST, |
| 104 DEFERRING_REDIRECT, |
| 105 CANCELING, |
| 106 WILL_PROCESS_RESPONSE, |
| 107 DEFERRING_RESPONSE, |
| 108 READY_TO_COMMIT, |
| 109 DID_COMMIT, |
| 110 DID_COMMIT_ERROR_PAGE, |
| 111 }; |
| 112 |
98 // NavigationHandle implementation: | 113 // NavigationHandle implementation: |
99 const GURL& GetURL() override; | 114 const GURL& GetURL() override; |
100 SiteInstance* GetStartingSiteInstance() override; | 115 SiteInstance* GetStartingSiteInstance() override; |
101 bool IsInMainFrame() override; | 116 bool IsInMainFrame() override; |
102 bool IsParentMainFrame() override; | 117 bool IsParentMainFrame() override; |
103 bool IsRendererInitiated() override; | 118 bool IsRendererInitiated() override; |
104 bool WasServerRedirect() override; | 119 bool WasServerRedirect() override; |
105 const std::vector<GURL>& GetRedirectChain() override; | 120 const std::vector<GURL>& GetRedirectChain() override; |
106 int GetFrameTreeNodeId() override; | 121 int GetFrameTreeNodeId() override; |
107 int GetParentFrameTreeNodeId() override; | 122 int GetParentFrameTreeNodeId() override; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void CallDidCommitNavigationForTesting(const GURL& url) override; | 159 void CallDidCommitNavigationForTesting(const GURL& url) override; |
145 bool WasStartedFromContextMenu() const override; | 160 bool WasStartedFromContextMenu() const override; |
146 const GURL& GetSearchableFormURL() override; | 161 const GURL& GetSearchableFormURL() override; |
147 const std::string& GetSearchableFormEncoding() override; | 162 const std::string& GetSearchableFormEncoding() override; |
148 ReloadType GetReloadType() override; | 163 ReloadType GetReloadType() override; |
149 RestoreType GetRestoreType() override; | 164 RestoreType GetRestoreType() override; |
150 const GlobalRequestID& GetGlobalRequestID() override; | 165 const GlobalRequestID& GetGlobalRequestID() override; |
151 | 166 |
152 NavigationData* GetNavigationData() override; | 167 NavigationData* GetNavigationData() override; |
153 | 168 |
| 169 // Used in tests. |
| 170 State state_for_testing() const { return state_; } |
| 171 |
154 // The NavigatorDelegate to notify/query for various navigation events. | 172 // The NavigatorDelegate to notify/query for various navigation events. |
155 // Normally this is the WebContents, except if this NavigationHandle was | 173 // Normally this is the WebContents, except if this NavigationHandle was |
156 // created during a navigation to an interstitial page. In this case it will | 174 // created during a navigation to an interstitial page. In this case it will |
157 // be the InterstitialPage itself. | 175 // be the InterstitialPage itself. |
158 // | 176 // |
159 // Note: due to the interstitial navigation case, all calls that can possibly | 177 // Note: due to the interstitial navigation case, all calls that can possibly |
160 // expose the NavigationHandle to code outside of content/ MUST go though the | 178 // expose the NavigationHandle to code outside of content/ MUST go though the |
161 // NavigatorDelegate. In particular, the ContentBrowserClient should not be | 179 // NavigatorDelegate. In particular, the ContentBrowserClient should not be |
162 // called directly form the NavigationHandle code. Thus, these calls will not | 180 // called directly form the NavigationHandle code. Thus, these calls will not |
163 // expose the NavigationHandle when navigating to an InterstialPage. | 181 // expose the NavigationHandle when navigating to an InterstialPage. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 342 } |
325 | 343 |
326 void set_response_headers_for_testing( | 344 void set_response_headers_for_testing( |
327 scoped_refptr<net::HttpResponseHeaders> response_headers) { | 345 scoped_refptr<net::HttpResponseHeaders> response_headers) { |
328 response_headers_ = response_headers; | 346 response_headers_ = response_headers; |
329 } | 347 } |
330 | 348 |
331 private: | 349 private: |
332 friend class NavigationHandleImplTest; | 350 friend class NavigationHandleImplTest; |
333 | 351 |
334 // Used to track the state the navigation is currently in. | |
335 enum State { | |
336 INITIAL = 0, | |
337 WILL_SEND_REQUEST, | |
338 DEFERRING_START, | |
339 WILL_REDIRECT_REQUEST, | |
340 DEFERRING_REDIRECT, | |
341 CANCELING, | |
342 WILL_PROCESS_RESPONSE, | |
343 DEFERRING_RESPONSE, | |
344 READY_TO_COMMIT, | |
345 DID_COMMIT, | |
346 DID_COMMIT_ERROR_PAGE, | |
347 }; | |
348 | |
349 NavigationHandleImpl(const GURL& url, | 352 NavigationHandleImpl(const GURL& url, |
350 const std::vector<GURL>& redirect_chain, | 353 const std::vector<GURL>& redirect_chain, |
351 FrameTreeNode* frame_tree_node, | 354 FrameTreeNode* frame_tree_node, |
352 bool is_renderer_initiated, | 355 bool is_renderer_initiated, |
353 bool is_same_page, | 356 bool is_same_page, |
354 const base::TimeTicks& navigation_start, | 357 const base::TimeTicks& navigation_start, |
355 int pending_nav_entry_id, | 358 int pending_nav_entry_id, |
356 bool started_from_context_menu); | 359 bool started_from_context_menu); |
357 | 360 |
358 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 361 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 NavigationType navigation_type_; | 504 NavigationType navigation_type_; |
502 | 505 |
503 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 506 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
504 | 507 |
505 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 508 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
506 }; | 509 }; |
507 | 510 |
508 } // namespace content | 511 } // namespace content |
509 | 512 |
510 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 513 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |