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/containers/scoped_ptr_hash_map.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool user_gesture) override; | 74 bool user_gesture) override; |
75 virtual void OnBeginNavigation( | 75 virtual void OnBeginNavigation( |
76 FrameTreeNode* frame_tree_node, | 76 FrameTreeNode* frame_tree_node, |
77 const FrameHostMsg_BeginNavigation_Params& params, | 77 const FrameHostMsg_BeginNavigation_Params& params, |
78 const CommonNavigationParams& common_params) override; | 78 const CommonNavigationParams& common_params) override; |
79 virtual void CommitNavigation(FrameTreeNode* frame_tree_node, | 79 virtual void CommitNavigation(FrameTreeNode* frame_tree_node, |
80 ResourceResponse* response, | 80 ResourceResponse* response, |
81 scoped_ptr<StreamHandle> body) override; | 81 scoped_ptr<StreamHandle> body) override; |
82 virtual void LogResourceRequestTime( | 82 virtual void LogResourceRequestTime( |
83 base::TimeTicks timestamp, const GURL& url) override; | 83 base::TimeTicks timestamp, const GURL& url) override; |
| 84 virtual void LogBeforeUnloadTime( |
| 85 const base::TimeTicks& renderer_before_unload_start_time, |
| 86 const base::TimeTicks& renderer_before_unload_end_time) override; |
84 virtual void CancelNavigation(FrameTreeNode* frame_tree_node) override; | 87 virtual void CancelNavigation(FrameTreeNode* frame_tree_node) override; |
85 | 88 |
86 private: | 89 private: |
| 90 // Holds data used to track browser side navigation metrics. |
| 91 struct NavigationMetricsData; |
| 92 |
87 friend class NavigatorTest; | 93 friend class NavigatorTest; |
88 virtual ~NavigatorImpl(); | 94 virtual ~NavigatorImpl(); |
89 | 95 |
90 // Navigates to the given entry, which must be the pending entry. Private | 96 // Navigates to the given entry, which must be the pending entry. Private |
91 // because all callers should use NavigateToPendingEntry. | 97 // because all callers should use NavigateToPendingEntry. |
92 bool NavigateToEntry( | 98 bool NavigateToEntry( |
93 RenderFrameHostImpl* render_frame_host, | 99 RenderFrameHostImpl* render_frame_host, |
94 const NavigationEntryImpl& entry, | 100 const NavigationEntryImpl& entry, |
95 NavigationController::ReloadType reload_type); | 101 NavigationController::ReloadType reload_type); |
96 | 102 |
97 bool ShouldAssignSiteForURL(const GURL& url); | 103 bool ShouldAssignSiteForURL(const GURL& url); |
98 | 104 |
99 void CheckWebUIRendererDoesNotDisplayNormalURL( | 105 void CheckWebUIRendererDoesNotDisplayNormalURL( |
100 RenderFrameHostImpl* render_frame_host, | 106 RenderFrameHostImpl* render_frame_host, |
101 const GURL& url); | 107 const GURL& url); |
102 | 108 |
103 // PlzNavigate: sends a RequestNavigation IPC to the renderer to ask it to | 109 // 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 | 110 // navigate. If no live renderer is present, then the navigation request will |
105 // be sent directly to the ResourceDispatcherHost. | 111 // be sent directly to the ResourceDispatcherHost. |
106 bool RequestNavigation(FrameTreeNode* frame_tree_node, | 112 bool RequestNavigation(FrameTreeNode* frame_tree_node, |
107 const NavigationEntryImpl& entry, | 113 const NavigationEntryImpl& entry, |
108 NavigationController::ReloadType reload_type, | 114 NavigationController::ReloadType reload_type, |
109 base::TimeTicks navigation_start); | 115 base::TimeTicks navigation_start); |
110 | 116 |
| 117 void RecordNavigationMetrics( |
| 118 const LoadCommittedDetails& details, |
| 119 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 120 SiteInstance* site_instance); |
| 121 |
111 // The NavigationController that will keep track of session history for all | 122 // The NavigationController that will keep track of session history for all |
112 // RenderFrameHost objects using this NavigatorImpl. | 123 // RenderFrameHost objects using this NavigatorImpl. |
113 // TODO(nasko): Move ownership of the NavigationController from | 124 // TODO(nasko): Move ownership of the NavigationController from |
114 // WebContentsImpl to this class. | 125 // WebContentsImpl to this class. |
115 NavigationControllerImpl* controller_; | 126 NavigationControllerImpl* controller_; |
116 | 127 |
117 // Used to notify the object embedding this Navigator about navigation | 128 // Used to notify the object embedding this Navigator about navigation |
118 // events. Can be NULL in tests. | 129 // events. Can be NULL in tests. |
119 NavigatorDelegate* delegate_; | 130 NavigatorDelegate* delegate_; |
120 | 131 |
121 // The start time and URL for latest navigation request, used for feeding a | 132 scoped_ptr<NavigatorImpl::NavigationMetricsData> navigation_data_; |
122 // few histograms under the Navigation group. | |
123 Tuple2<base::TimeTicks, GURL> navigation_start_time_and_url; | |
124 | 133 |
125 // PlzNavigate: used to track the various ongoing NavigationRequests in the | 134 // PlzNavigate: used to track the various ongoing NavigationRequests in the |
126 // different FrameTreeNodes, based on the frame_tree_node_id. | 135 // different FrameTreeNodes, based on the frame_tree_node_id. |
127 typedef base::ScopedPtrHashMap<int64, NavigationRequest> NavigationRequestMap; | 136 typedef base::ScopedPtrHashMap<int64, NavigationRequest> NavigationRequestMap; |
128 NavigationRequestMap navigation_request_map_; | 137 NavigationRequestMap navigation_request_map_; |
129 | 138 |
130 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); | 139 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); |
131 }; | 140 }; |
132 | 141 |
133 } // namespace content | 142 } // namespace content |
134 | 143 |
135 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 144 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
OLD | NEW |