| 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/browser/frame_host/navigation_handle_impl.h" |
| 10 #include "content/browser/frame_host/navigator_delegate.h" | 11 #include "content/browser/frame_host/navigator_delegate.h" |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 13 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 17 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
| 17 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; | 18 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class TimeTicks; | 21 class TimeTicks; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 class FrameNavigationEntry; | 26 class FrameNavigationEntry; |
| 26 class FrameTreeNode; | 27 class FrameTreeNode; |
| 27 class NavigationHandleImpl; | |
| 28 class NavigationRequest; | 28 class NavigationRequest; |
| 29 class RenderFrameHostImpl; | 29 class RenderFrameHostImpl; |
| 30 class ResourceRequestBodyImpl; | 30 class ResourceRequestBodyImpl; |
| 31 struct BeginNavigationParams; | 31 struct BeginNavigationParams; |
| 32 struct CommonNavigationParams; | 32 struct CommonNavigationParams; |
| 33 | 33 |
| 34 // Implementations of this interface are responsible for performing navigations | 34 // Implementations of this interface are responsible for performing navigations |
| 35 // 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 |
| 36 // 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 |
| 37 // 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 60 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {}; | 60 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {}; |
| 61 | 61 |
| 62 // The RenderFrameHostImpl has failed to load the document. | 62 // The RenderFrameHostImpl has failed to load the document. |
| 63 virtual void DidFailLoadWithError( | 63 virtual void DidFailLoadWithError( |
| 64 RenderFrameHostImpl* render_frame_host, | 64 RenderFrameHostImpl* render_frame_host, |
| 65 const GURL& url, | 65 const GURL& url, |
| 66 int error_code, | 66 int error_code, |
| 67 const base::string16& error_description, | 67 const base::string16& error_description, |
| 68 bool was_ignored_by_handler) {} | 68 bool was_ignored_by_handler) {} |
| 69 | 69 |
| 70 // The RenderFrameHostImpl has committed a navigation. | 70 // The RenderFrameHostImpl has committed a navigation. The Navigator is |
| 71 // responsible for resetting |navigation_handle| at the end of this method and |
| 72 // should not attempt to keep it alive. |
| 73 // Note: it is possible that |navigation_handle| is not the NavigationHandle |
| 74 // stored in the RenderFrameHost that just committed. This happens for example |
| 75 // when a same-page navigation commits while another navigation is ongoing. |
| 76 // The Navigator should use the NavigationHandle provided by this method and |
| 77 // not attempt to access the RenderFrameHost's NavigationsHandle. |
| 71 virtual void DidNavigate( | 78 virtual void DidNavigate( |
| 72 RenderFrameHostImpl* render_frame_host, | 79 RenderFrameHostImpl* render_frame_host, |
| 73 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {} | 80 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 81 std::unique_ptr<NavigationHandleImpl> navigation_handle) {} |
| 74 | 82 |
| 75 // Called by the NavigationController to cause the Navigator to navigate | 83 // Called by the NavigationController to cause the Navigator to navigate |
| 76 // to the current pending entry. The NavigationController should be called | 84 // to the current pending entry. The NavigationController should be called |
| 77 // back with RendererDidNavigate on success or DiscardPendingEntry on failure. | 85 // back with RendererDidNavigate on success or DiscardPendingEntry on failure. |
| 78 // The callbacks can be inside of this function, or at some future time. | 86 // The callbacks can be inside of this function, or at some future time. |
| 79 // | 87 // |
| 80 // If this method returns false, then the navigation is discarded (equivalent | 88 // If this method returns false, then the navigation is discarded (equivalent |
| 81 // to calling DiscardPendingEntry on the NavigationController). | 89 // to calling DiscardPendingEntry on the NavigationController). |
| 82 // | 90 // |
| 83 // TODO(nasko): Remove this method from the interface, since Navigator and | 91 // TODO(nasko): Remove this method from the interface, since Navigator and |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // conventions. | 177 // conventions. |
| 170 virtual void LogResourceRequestTime( | 178 virtual void LogResourceRequestTime( |
| 171 base::TimeTicks timestamp, const GURL& url) {}; | 179 base::TimeTicks timestamp, const GURL& url) {}; |
| 172 | 180 |
| 173 // Called to record the time it took to execute the before unload hook for the | 181 // Called to record the time it took to execute the before unload hook for the |
| 174 // current navigation. | 182 // current navigation. |
| 175 virtual void LogBeforeUnloadTime( | 183 virtual void LogBeforeUnloadTime( |
| 176 const base::TimeTicks& renderer_before_unload_start_time, | 184 const base::TimeTicks& renderer_before_unload_start_time, |
| 177 const base::TimeTicks& renderer_before_unload_end_time) {} | 185 const base::TimeTicks& renderer_before_unload_end_time) {} |
| 178 | 186 |
| 179 // Returns the NavigationHandle associated with a navigation in | |
| 180 // |render_frame_host|. Normally, each frame can have its own | |
| 181 // NavigationHandle. However, in the case of a navigation to an interstitial | |
| 182 // page, there's just one NavigationHandle for the whole page (since it's | |
| 183 // assumed to only have one RenderFrameHost and navigate once). | |
| 184 virtual NavigationHandleImpl* GetNavigationHandleForFrameHost( | |
| 185 RenderFrameHostImpl* render_frame_host); | |
| 186 | |
| 187 // Called when a navigation has failed or the response is 204/205 to discard | 187 // Called when a navigation has failed or the response is 204/205 to discard |
| 188 // the pending entry in order to avoid url spoofs. | 188 // the pending entry in order to avoid url spoofs. |
| 189 virtual void DiscardPendingEntryIfNeeded(NavigationHandleImpl* handle) {} | 189 virtual void DiscardPendingEntryIfNeeded(NavigationHandleImpl* handle) {} |
| 190 | 190 |
| 191 protected: | 191 protected: |
| 192 friend class base::RefCounted<Navigator>; | 192 friend class base::RefCounted<Navigator>; |
| 193 virtual ~Navigator() {} | 193 virtual ~Navigator() {} |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 } // namespace content | 196 } // namespace content |
| 197 | 197 |
| 198 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ | 198 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_ |
| OLD | NEW |