Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.h

Issue 1427633004: Send navigation_start to the browser in DidStartProvisionalLoad IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation_start_renderer
Patch Set: Remove public method from NavigationHandle until consumers need it Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_NAVIGATION_HANDLE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
7 7
8 #include "content/public/browser/navigation_handle.h" 8 #include "content/public/browser/navigation_handle.h"
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // transferred to the RenderFrameHost in which the navigation will commit. 52 // transferred to the RenderFrameHost in which the navigation will commit.
53 // 53 //
54 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset 54 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset
55 // following the receipt of a DidStartProvisionalLoad IPC. There are also no 55 // following the receipt of a DidStartProvisionalLoad IPC. There are also no
56 // transferring navigations. The other causes of NavigationHandleImpl reset in 56 // transferring navigations. The other causes of NavigationHandleImpl reset in
57 // the RenderFrameHost still apply. 57 // the RenderFrameHost still apply.
58 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { 58 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
59 public: 59 public:
60 static scoped_ptr<NavigationHandleImpl> Create( 60 static scoped_ptr<NavigationHandleImpl> Create(
61 const GURL& url, 61 const GURL& url,
62 FrameTreeNode* frame_tree_node); 62 FrameTreeNode* frame_tree_node,
63 const base::TimeTicks& navigation_start);
63 ~NavigationHandleImpl() override; 64 ~NavigationHandleImpl() override;
64 65
65 // NavigationHandle implementation: 66 // NavigationHandle implementation:
66 const GURL& GetURL() override; 67 const GURL& GetURL() override;
67 bool IsInMainFrame() override; 68 bool IsInMainFrame() override;
68 bool IsPost() override; 69 bool IsPost() override;
69 const Referrer& GetReferrer() override; 70 const Referrer& GetReferrer() override;
70 bool HasUserGesture() override; 71 bool HasUserGesture() override;
71 ui::PageTransition GetPageTransition() override; 72 ui::PageTransition GetPageTransition() override;
72 bool IsExternalProtocol() override; 73 bool IsExternalProtocol() override;
(...skipping 10 matching lines...) Expand all
83 const Referrer& sanitized_referrer, 84 const Referrer& sanitized_referrer,
84 bool has_user_gesture, 85 bool has_user_gesture,
85 ui::PageTransition transition, 86 ui::PageTransition transition,
86 bool is_external_protocol) override; 87 bool is_external_protocol) override;
87 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( 88 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting(
88 const GURL& new_url, 89 const GURL& new_url,
89 bool new_method_is_post, 90 bool new_method_is_post,
90 const GURL& new_referrer_url, 91 const GURL& new_referrer_url,
91 bool new_is_external_protocol) override; 92 bool new_is_external_protocol) override;
92 93
94 // TODO(csharrison) add this to the public class and mark this override.
clamy 2015/11/06 16:28:20 nit: please put the comment that was with the publ
95 const base::TimeTicks& GetNavigationStart();
96
93 NavigatorDelegate* GetDelegate() const; 97 NavigatorDelegate* GetDelegate() const;
94 98
95 void set_net_error_code(net::Error net_error_code) { 99 void set_net_error_code(net::Error net_error_code) {
96 net_error_code_ = net_error_code; 100 net_error_code_ = net_error_code;
97 } 101 }
98 102
99 // Returns whether the navigation is currently being transferred from one 103 // Returns whether the navigation is currently being transferred from one
100 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC 104 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC
101 // for the navigation URL, received in the new RenderFrameHost, should not 105 // for the navigation URL, received in the new RenderFrameHost, should not
102 // indicate the start of a new navigation in that case. 106 // indicate the start of a new navigation in that case.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 INITIAL = 0, 158 INITIAL = 0,
155 WILL_SEND_REQUEST, 159 WILL_SEND_REQUEST,
156 DEFERRING_START, 160 DEFERRING_START,
157 WILL_REDIRECT_REQUEST, 161 WILL_REDIRECT_REQUEST,
158 DEFERRING_REDIRECT, 162 DEFERRING_REDIRECT,
159 READY_TO_COMMIT, 163 READY_TO_COMMIT,
160 DID_COMMIT, 164 DID_COMMIT,
161 DID_COMMIT_ERROR_PAGE, 165 DID_COMMIT_ERROR_PAGE,
162 }; 166 };
163 167
168 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks
clamy 2015/11/06 16:28:20 nit: I would move this comment to the factory meth
169 // both renderer-initiated and browser-initiated navigation start.
170 // PlzNavigate: This value always comes from the CommonNavigationParams
171 // associated with this navigation.
164 NavigationHandleImpl(const GURL& url, 172 NavigationHandleImpl(const GURL& url,
165 FrameTreeNode* frame_tree_node); 173 FrameTreeNode* frame_tree_node,
174 const base::TimeTicks& navigation_start);
166 175
167 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 176 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
168 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 177 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
169 178
170 // Used in tests. 179 // Used in tests.
171 State state() const { return state_; } 180 State state() const { return state_; }
172 181
173 // See NavigationHandle for a description of those member variables. 182 // See NavigationHandle for a description of those member variables.
174 GURL url_; 183 GURL url_;
175 bool is_post_; 184 bool is_post_;
(...skipping 14 matching lines...) Expand all
190 199
191 // The FrameTreeNode this navigation is happening in. 200 // The FrameTreeNode this navigation is happening in.
192 FrameTreeNode* frame_tree_node_; 201 FrameTreeNode* frame_tree_node_;
193 202
194 // A list of Throttles registered for this navigation. 203 // A list of Throttles registered for this navigation.
195 ScopedVector<NavigationThrottle> throttles_; 204 ScopedVector<NavigationThrottle> throttles_;
196 205
197 // The index of the next throttle to check. 206 // The index of the next throttle to check.
198 size_t next_index_; 207 size_t next_index_;
199 208
209 // The time this navigation started.
210 const base::TimeTicks navigation_start_;
211
200 // This callback will be run when all throttle checks have been performed. 212 // This callback will be run when all throttle checks have been performed.
201 ThrottleChecksFinishedCallback complete_callback_; 213 ThrottleChecksFinishedCallback complete_callback_;
202 214
203 // PlzNavigate 215 // PlzNavigate
204 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a 216 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
205 // corresponding ServiceWorkerNetworkProvider is created in the renderer. 217 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
206 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; 218 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
207 219
208 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 220 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
209 }; 221 };
210 222
211 } // namespace content 223 } // namespace content
212 224
213 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 225 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698