| 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_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "base/tuple.h" | 12 #include "base/tuple.h" |
| 12 #include "content/browser/frame_host/navigation_controller_impl.h" | 13 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 13 #include "content/browser/frame_host/navigator.h" | 14 #include "content/browser/frame_host/navigator.h" |
| 14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 struct FrameMsg_Navigate_Params; | 19 struct FrameMsg_Navigate_Params; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 class NavigationControllerImpl; | 23 class NavigationControllerImpl; |
| 23 class NavigatorDelegate; | 24 class NavigatorDelegate; |
| 25 class NavigatorTest; |
| 24 struct LoadCommittedDetails; | 26 struct LoadCommittedDetails; |
| 25 struct CommitNavigationParams; | 27 struct CommitNavigationParams; |
| 26 struct CommonNavigationParams; | 28 struct CommonNavigationParams; |
| 27 struct RequestNavigationParams; | 29 struct RequestNavigationParams; |
| 28 | 30 |
| 29 // This class is an implementation of Navigator, responsible for managing | 31 // This class is an implementation of Navigator, responsible for managing |
| 30 // navigations in regular browser tabs. | 32 // navigations in regular browser tabs. |
| 31 class CONTENT_EXPORT NavigatorImpl : public Navigator { | 33 class CONTENT_EXPORT NavigatorImpl : public Navigator { |
| 32 public: | 34 public: |
| 33 NavigatorImpl(NavigationControllerImpl* navigation_controller, | 35 NavigatorImpl(NavigationControllerImpl* navigation_controller, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 63 virtual void RequestTransferURL( | 65 virtual void RequestTransferURL( |
| 64 RenderFrameHostImpl* render_frame_host, | 66 RenderFrameHostImpl* render_frame_host, |
| 65 const GURL& url, | 67 const GURL& url, |
| 66 const std::vector<GURL>& redirect_chain, | 68 const std::vector<GURL>& redirect_chain, |
| 67 const Referrer& referrer, | 69 const Referrer& referrer, |
| 68 ui::PageTransition page_transition, | 70 ui::PageTransition page_transition, |
| 69 WindowOpenDisposition disposition, | 71 WindowOpenDisposition disposition, |
| 70 const GlobalRequestID& transferred_global_request_id, | 72 const GlobalRequestID& transferred_global_request_id, |
| 71 bool should_replace_current_entry, | 73 bool should_replace_current_entry, |
| 72 bool user_gesture) OVERRIDE; | 74 bool user_gesture) OVERRIDE; |
| 75 virtual void OnBeginNavigation( |
| 76 FrameTreeNode* frame_tree_node, |
| 77 const FrameHostMsg_BeginNavigation_Params& params, |
| 78 const CommonNavigationParams& common_params) OVERRIDE; |
| 73 virtual void CommitNavigation( | 79 virtual void CommitNavigation( |
| 74 RenderFrameHostImpl* render_frame_host, | 80 FrameTreeNode* frame_tree_node, |
| 75 const GURL& stream_url, | 81 const NavigationBeforeCommitInfo& info) OVERRIDE; |
| 76 const CommonNavigationParams& common_params, | |
| 77 const CommitNavigationParams& commit_params) OVERRIDE; | |
| 78 virtual void LogResourceRequestTime( | 82 virtual void LogResourceRequestTime( |
| 79 base::TimeTicks timestamp, const GURL& url) OVERRIDE; | 83 base::TimeTicks timestamp, const GURL& url) OVERRIDE; |
| 84 virtual void CancelNavigation(FrameTreeNode* frame_tree_node) OVERRIDE; |
| 80 | 85 |
| 81 private: | 86 private: |
| 87 friend class NavigatorTest; |
| 82 virtual ~NavigatorImpl(); | 88 virtual ~NavigatorImpl(); |
| 83 | 89 |
| 84 // Navigates to the given entry, which must be the pending entry. Private | 90 // Navigates to the given entry, which must be the pending entry. Private |
| 85 // because all callers should use NavigateToPendingEntry. | 91 // because all callers should use NavigateToPendingEntry. |
| 86 bool NavigateToEntry( | 92 bool NavigateToEntry( |
| 87 RenderFrameHostImpl* render_frame_host, | 93 RenderFrameHostImpl* render_frame_host, |
| 88 const NavigationEntryImpl& entry, | 94 const NavigationEntryImpl& entry, |
| 89 NavigationController::ReloadType reload_type); | 95 NavigationController::ReloadType reload_type); |
| 90 | 96 |
| 91 bool ShouldAssignSiteForURL(const GURL& url); | 97 bool ShouldAssignSiteForURL(const GURL& url); |
| 92 | 98 |
| 93 void CheckWebUIRendererDoesNotDisplayNormalURL( | 99 void CheckWebUIRendererDoesNotDisplayNormalURL( |
| 94 RenderFrameHostImpl* render_frame_host, | 100 RenderFrameHostImpl* render_frame_host, |
| 95 const GURL& url); | 101 const GURL& url); |
| 96 | 102 |
| 103 // PlzNavigate: sends a RequestNavigation IPC to the renderer to ask it to |
| 104 // navigate. If no live renderer is present, then the navigation request will |
| 105 // be sent directly to the ResourceDispatcherHost. |
| 106 bool RequestNavigation(FrameTreeNode* frame_tree_node, |
| 107 const NavigationEntryImpl& entry, |
| 108 NavigationController::ReloadType reload_type, |
| 109 base::TimeTicks navigation_start); |
| 110 |
| 97 // The NavigationController that will keep track of session history for all | 111 // The NavigationController that will keep track of session history for all |
| 98 // RenderFrameHost objects using this NavigatorImpl. | 112 // RenderFrameHost objects using this NavigatorImpl. |
| 99 // TODO(nasko): Move ownership of the NavigationController from | 113 // TODO(nasko): Move ownership of the NavigationController from |
| 100 // WebContentsImpl to this class. | 114 // WebContentsImpl to this class. |
| 101 NavigationControllerImpl* controller_; | 115 NavigationControllerImpl* controller_; |
| 102 | 116 |
| 103 // Used to notify the object embedding this Navigator about navigation | 117 // Used to notify the object embedding this Navigator about navigation |
| 104 // events. Can be NULL in tests. | 118 // events. Can be NULL in tests. |
| 105 NavigatorDelegate* delegate_; | 119 NavigatorDelegate* delegate_; |
| 106 | 120 |
| 107 // The start time and URL for latest navigation request, used for feeding a | 121 // The start time and URL for latest navigation request, used for feeding a |
| 108 // few histograms under the Navigation group. | 122 // few histograms under the Navigation group. |
| 109 Tuple2<base::TimeTicks, GURL> navigation_start_time_and_url; | 123 Tuple2<base::TimeTicks, GURL> navigation_start_time_and_url; |
| 110 | 124 |
| 125 // PlzNavigate: used to track the various ongoing NavigationRequests in the |
| 126 // different FrameTreeNodes, based on the frame_tree_node_id. |
| 127 typedef base::ScopedPtrHashMap<int64, NavigationRequest> NavigationRequestMap; |
| 128 NavigationRequestMap navigation_request_map_; |
| 129 |
| 111 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); | 130 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); |
| 112 }; | 131 }; |
| 113 | 132 |
| 114 } // namespace content | 133 } // namespace content |
| 115 | 134 |
| 116 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 135 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
| OLD | NEW |