OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NAVIGATOR_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
12 #include "ui/base/window_open_disposition.h" | 12 #include "ui/base/window_open_disposition.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 struct FrameHostMsg_BeginNavigation_Params; | 15 struct FrameHostMsg_BeginNavigation_Params; |
16 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 16 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
17 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; | 17 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class TimeTicks; | 20 class TimeTicks; |
21 } | 21 } |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
| 25 class FrameTreeNode; |
25 class NavigationControllerImpl; | 26 class NavigationControllerImpl; |
26 class NavigationEntryImpl; | 27 class NavigationEntryImpl; |
| 28 class NavigationRequest; |
27 class NavigatorDelegate; | 29 class NavigatorDelegate; |
28 class RenderFrameHostImpl; | 30 class RenderFrameHostImpl; |
29 struct CommitNavigationParams; | |
30 struct CommonNavigationParams; | 31 struct CommonNavigationParams; |
| 32 struct NavigationBeforeCommitInfo; |
31 | 33 |
32 // Implementations of this interface are responsible for performing navigations | 34 // Implementations of this interface are responsible for performing navigations |
33 // in a node of the FrameTree. Its lifetime is bound to all FrameTreeNode | 35 // in a node of the FrameTree. Its lifetime is bound to all FrameTreeNode |
34 // objects that are using it and will be released once all nodes that use it are | 36 // objects that are using it and will be released once all nodes that use it are |
35 // freed. The Navigator is bound to a single frame tree and cannot be used by | 37 // freed. The Navigator is bound to a single frame tree and cannot be used by |
36 // multiple instances of FrameTree. | 38 // multiple instances of FrameTree. |
37 // TODO(nasko): Move all navigation methods, such as didStartProvisionalLoad | 39 // TODO(nasko): Move all navigation methods, such as didStartProvisionalLoad |
38 // from WebContentsImpl to this interface. | 40 // from WebContentsImpl to this interface. |
39 class CONTENT_EXPORT Navigator : public base::RefCounted<Navigator> { | 41 class CONTENT_EXPORT Navigator : public base::RefCounted<Navigator> { |
40 public: | 42 public: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 RenderFrameHostImpl* render_frame_host, | 106 RenderFrameHostImpl* render_frame_host, |
105 const GURL& url, | 107 const GURL& url, |
106 const std::vector<GURL>& redirect_chain, | 108 const std::vector<GURL>& redirect_chain, |
107 const Referrer& referrer, | 109 const Referrer& referrer, |
108 ui::PageTransition page_transition, | 110 ui::PageTransition page_transition, |
109 WindowOpenDisposition disposition, | 111 WindowOpenDisposition disposition, |
110 const GlobalRequestID& transferred_global_request_id, | 112 const GlobalRequestID& transferred_global_request_id, |
111 bool should_replace_current_entry, | 113 bool should_replace_current_entry, |
112 bool user_gesture) {} | 114 bool user_gesture) {} |
113 | 115 |
| 116 // PlzNavigate: Used to start a navigation. OnBeginNavigation is called |
| 117 // directly by RequestNavigation when there is no live renderer. Otherwise, it |
| 118 // is called following a BeginNavigation IPC from the renderer (which in |
| 119 // browser-initiated navigation also happens after RequestNavigation has been |
| 120 // called). |
| 121 virtual void OnBeginNavigation( |
| 122 FrameTreeNode* frame_tree_node, |
| 123 const FrameHostMsg_BeginNavigation_Params& params, |
| 124 const CommonNavigationParams& common_params) {} |
| 125 |
114 // PlzNavigate | 126 // PlzNavigate |
115 // Signal |render_frame_host| that a navigation is ready to commit (the | 127 // Signal |render_frame_host| that a navigation is ready to commit (the |
116 // response to the navigation request has been received). | 128 // response to the navigation request has been received). |
117 virtual void CommitNavigation(RenderFrameHostImpl* render_frame_host, | 129 virtual void CommitNavigation(FrameTreeNode* frame_tree_node, |
118 const GURL& stream_url, | 130 const NavigationBeforeCommitInfo& info) {} |
119 const CommonNavigationParams& common_params, | 131 |
120 const CommitNavigationParams& commit_params) {} | 132 // PlzNavigate |
| 133 // Cancel a NavigationRequest for |frame_tree_node|. Called when |
| 134 // |frame_tree_node| is destroyed. |
| 135 virtual void CancelNavigation(FrameTreeNode* frame_tree_node) {} |
121 | 136 |
122 // Called when the first resource request for a given navigation is executed | 137 // Called when the first resource request for a given navigation is executed |
123 // so that it can be tracked into an histogram. | 138 // so that it can be tracked into an histogram. |
124 virtual void LogResourceRequestTime( | 139 virtual void LogResourceRequestTime( |
125 base::TimeTicks timestamp, const GURL& url) {}; | 140 base::TimeTicks timestamp, const GURL& url) {}; |
126 | 141 |
127 protected: | 142 protected: |
128 friend class base::RefCounted<Navigator>; | 143 friend class base::RefCounted<Navigator>; |
129 virtual ~Navigator() {} | 144 virtual ~Navigator() {} |
130 }; | 145 }; |
131 | 146 |
132 } // namespace content | 147 } // namespace content |
133 | 148 |
134 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ | 149 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ |
OLD | NEW |