OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/browser/frame_host/navigation_request_info.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/common/navigation_params.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class ResourceRequestBody; | 15 class ResourceRequestBody; |
| 16 struct NavigationRequestInfo; |
15 | 17 |
16 // PlzNavigate | 18 // PlzNavigate |
17 // A UI thread object that owns a navigation request until it commits. It | 19 // A UI thread object that owns a navigation request until it commits. It |
18 // ensures the UI thread can start a navigation request in the | 20 // ensures the UI thread can start a navigation request in the |
19 // ResourceDispatcherHost (that lives on the IO thread). | 21 // ResourceDispatcherHost (that lives on the IO thread). |
20 // TODO(clamy): Describe the interactions between the UI and IO thread during | 22 // TODO(clamy): Describe the interactions between the UI and IO thread during |
21 // the navigation following its refactoring. | 23 // the navigation following its refactoring. |
22 class NavigationRequest { | 24 class CONTENT_EXPORT NavigationRequest { |
23 public: | 25 public: |
24 NavigationRequest(const NavigationRequestInfo& info, | 26 NavigationRequest(int64 frame_tree_node_id, |
25 int64 frame_tree_node_id); | 27 const CommonNavigationParams& common_params, |
| 28 const CommitNavigationParams& commit_params); |
26 | 29 |
27 ~NavigationRequest(); | 30 ~NavigationRequest(); |
28 | 31 |
29 // Called on the UI thread by the RenderFrameHostManager which owns the | 32 // Called on the UI thread by the RenderFrameHostManager which owns the |
30 // NavigationRequest. After calling this function, |body| can no longer be | 33 // NavigationRequest. Takes ownership of |info|. After calling this function, |
31 // manipulated on the UI thread. | 34 // |body| can no longer be manipulated on the UI thread. |
32 void BeginNavigation(scoped_refptr<ResourceRequestBody> body); | 35 void BeginNavigation(scoped_ptr<NavigationRequestInfo> info, |
| 36 scoped_refptr<ResourceRequestBody> body); |
33 | 37 |
34 // Called on the UI thread by the RenderFrameHostManager which owns the | 38 // Called on the UI thread by the RenderFrameHostManager which owns the |
35 // NavigationRequest whenever this navigation request should be canceled. | 39 // NavigationRequest whenever this navigation request should be canceled. |
36 void CancelNavigation(); | 40 void CancelNavigation(); |
37 | 41 |
38 const NavigationRequestInfo& info() const { return info_; } | 42 int64 frame_tree_node_id() const { return frame_tree_node_id_; } |
| 43 int64 navigation_request_id() const { return navigation_request_id_; } |
39 | 44 |
40 int64 frame_tree_node_id() const { return frame_tree_node_id_; } | 45 CommonNavigationParams& common_params() { return common_params_; } |
41 | 46 |
42 int64 navigation_request_id() const { return navigation_request_id_; } | 47 const CommitNavigationParams& commit_params() const { return commit_params_; } |
| 48 |
| 49 NavigationRequestInfo* info_for_test() const { return info_.get(); } |
43 | 50 |
44 private: | 51 private: |
45 const int64 navigation_request_id_; | 52 const int64 navigation_request_id_; |
46 const NavigationRequestInfo info_; | |
47 const int64 frame_tree_node_id_; | 53 const int64 frame_tree_node_id_; |
48 | 54 |
| 55 // Initialized on creation of the NavigationRequest. Sent to the renderer when |
| 56 // the navigation is ready to commit. |
| 57 // Note: When the navigation is ready to commit, the url in |common_params| |
| 58 // will be set to the final navigation url, obtained after following all |
| 59 // redirects. |
| 60 CommonNavigationParams common_params_; |
| 61 const CommitNavigationParams commit_params_; |
| 62 |
| 63 // Initialized when beginning the navigation. |
| 64 scoped_ptr<NavigationRequestInfo> info_; |
| 65 |
49 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); | 66 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); |
50 }; | 67 }; |
51 | 68 |
52 } // namespace content | 69 } // namespace content |
53 | 70 |
54 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 71 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
OLD | NEW |