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( | 79 virtual void CommitNavigation( |
80 FrameTreeNode* frame_tree_node, | 80 FrameTreeNode* frame_tree_node, |
81 const NavigationBeforeCommitInfo& info) OVERRIDE; | 81 const NavigationBeforeCommitInfo& info) 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 class NavigationMetricsData { | |
nasko
2014/10/08 17:10:42
Don't nest classes like this for non-class specifi
carlosk
2014/10/09 16:53:45
So I kinda followed what's described here:
http:/
clamy
2014/10/09 19:02:32
Normally you are not supposed to change some class
carlosk
2014/10/10 10:00:03
Acknowledged.
I'll also ask in chromium-dev askin
| |
92 public: | |
93 NavigationMetricsData() {} | |
94 NavigationMetricsData(base::TimeTicks start_time, GURL url); | |
95 ~NavigationMetricsData() {} | |
96 | |
97 void Reset(); | |
98 bool IsTracking(); | |
99 | |
100 base::TimeTicks start_time_; | |
101 GURL url_; | |
102 base::TimeTicks url_job_start_time_; | |
103 base::TimeDelta before_unload_delay_; | |
104 }; | |
105 | |
87 friend class NavigatorTest; | 106 friend class NavigatorTest; |
88 virtual ~NavigatorImpl(); | 107 virtual ~NavigatorImpl(); |
89 | 108 |
90 // Navigates to the given entry, which must be the pending entry. Private | 109 // Navigates to the given entry, which must be the pending entry. Private |
91 // because all callers should use NavigateToPendingEntry. | 110 // because all callers should use NavigateToPendingEntry. |
92 bool NavigateToEntry( | 111 bool NavigateToEntry( |
93 RenderFrameHostImpl* render_frame_host, | 112 RenderFrameHostImpl* render_frame_host, |
94 const NavigationEntryImpl& entry, | 113 const NavigationEntryImpl& entry, |
95 NavigationController::ReloadType reload_type); | 114 NavigationController::ReloadType reload_type); |
96 | 115 |
97 bool ShouldAssignSiteForURL(const GURL& url); | 116 bool ShouldAssignSiteForURL(const GURL& url); |
98 | 117 |
99 void CheckWebUIRendererDoesNotDisplayNormalURL( | 118 void CheckWebUIRendererDoesNotDisplayNormalURL( |
100 RenderFrameHostImpl* render_frame_host, | 119 RenderFrameHostImpl* render_frame_host, |
101 const GURL& url); | 120 const GURL& url); |
102 | 121 |
103 // PlzNavigate: sends a RequestNavigation IPC to the renderer to ask it to | 122 // 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 | 123 // navigate. If no live renderer is present, then the navigation request will |
105 // be sent directly to the ResourceDispatcherHost. | 124 // be sent directly to the ResourceDispatcherHost. |
106 bool RequestNavigation(FrameTreeNode* frame_tree_node, | 125 bool RequestNavigation(FrameTreeNode* frame_tree_node, |
107 const NavigationEntryImpl& entry, | 126 const NavigationEntryImpl& entry, |
108 NavigationController::ReloadType reload_type, | 127 NavigationController::ReloadType reload_type, |
109 base::TimeTicks navigation_start); | 128 base::TimeTicks navigation_start); |
110 | 129 |
130 void RecordNavigationMetrics( | |
131 const LoadCommittedDetails& details, | |
132 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | |
133 SiteInstance* site_instance); | |
134 | |
111 // The NavigationController that will keep track of session history for all | 135 // The NavigationController that will keep track of session history for all |
112 // RenderFrameHost objects using this NavigatorImpl. | 136 // RenderFrameHost objects using this NavigatorImpl. |
113 // TODO(nasko): Move ownership of the NavigationController from | 137 // TODO(nasko): Move ownership of the NavigationController from |
114 // WebContentsImpl to this class. | 138 // WebContentsImpl to this class. |
115 NavigationControllerImpl* controller_; | 139 NavigationControllerImpl* controller_; |
116 | 140 |
117 // Used to notify the object embedding this Navigator about navigation | 141 // Used to notify the object embedding this Navigator about navigation |
118 // events. Can be NULL in tests. | 142 // events. Can be NULL in tests. |
119 NavigatorDelegate* delegate_; | 143 NavigatorDelegate* delegate_; |
120 | 144 |
121 // The start time and URL for latest navigation request, used for feeding a | 145 NavigatorImpl::NavigationMetricsData navigation_data; |
122 // few histograms under the Navigation group. | |
123 Tuple2<base::TimeTicks, GURL> navigation_start_time_and_url; | |
124 | 146 |
125 // PlzNavigate: used to track the various ongoing NavigationRequests in the | 147 // PlzNavigate: used to track the various ongoing NavigationRequests in the |
126 // different FrameTreeNodes, based on the frame_tree_node_id. | 148 // different FrameTreeNodes, based on the frame_tree_node_id. |
127 typedef base::ScopedPtrHashMap<int64, NavigationRequest> NavigationRequestMap; | 149 typedef base::ScopedPtrHashMap<int64, NavigationRequest> NavigationRequestMap; |
128 NavigationRequestMap navigation_request_map_; | 150 NavigationRequestMap navigation_request_map_; |
129 | 151 |
130 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); | 152 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); |
131 }; | 153 }; |
132 | 154 |
133 } // namespace content | 155 } // namespace content |
134 | 156 |
135 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 157 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
OLD | NEW |