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

Side by Side Diff: content/public/browser/navigation_handle.h

Issue 2413663003: Expose GlobalRequestID in NavigationHandle and ResourceRequestInfo. (Closed)
Patch Set: Add comments. Relocate method. Created 4 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_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string>
9 10
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "content/public/browser/navigation_throttle.h" 12 #include "content/public/browser/navigation_throttle.h"
12 #include "content/public/common/referrer.h" 13 #include "content/public/common/referrer.h"
13 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
14 #include "ui/base/page_transition_types.h" 15 #include "ui/base/page_transition_types.h"
15 16
16 class GURL; 17 class GURL;
17 18
18 namespace net { 19 namespace net {
19 class HttpResponseHeaders; 20 class HttpResponseHeaders;
20 } // namespace net 21 } // namespace net
21 22
22 namespace content { 23 namespace content {
24 struct GlobalRequestID;
23 class NavigationData; 25 class NavigationData;
24 class NavigationThrottle; 26 class NavigationThrottle;
25 class RenderFrameHost; 27 class RenderFrameHost;
26 class SiteInstance; 28 class SiteInstance;
27 class WebContents; 29 class WebContents;
28 30
29 // A NavigationHandle tracks information related to a single navigation. 31 // A NavigationHandle tracks information related to a single navigation.
30 // NavigationHandles are provided to several WebContentsObserver methods to 32 // NavigationHandles are provided to several WebContentsObserver methods to
31 // allow observers to track specific navigations. Observers should clear any 33 // allow observers to track specific navigations. Observers should clear any
32 // references to a NavigationHandle at the time of 34 // references to a NavigationHandle at the time of
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // browser-initiated navigations. 120 // browser-initiated navigations.
119 virtual bool HasUserGesture() = 0; 121 virtual bool HasUserGesture() = 0;
120 122
121 // Returns the page transition type. 123 // Returns the page transition type.
122 virtual ui::PageTransition GetPageTransition() = 0; 124 virtual ui::PageTransition GetPageTransition() = 0;
123 125
124 // Whether the target URL cannot be handled by the browser's internal protocol 126 // Whether the target URL cannot be handled by the browser's internal protocol
125 // handlers. 127 // handlers.
126 virtual bool IsExternalProtocol() = 0; 128 virtual bool IsExternalProtocol() = 0;
127 129
130 // Whether the network response has started.
131 virtual bool HasNetworkResponseStarted() = 0;
132
128 // Navigation control flow -------------------------------------------------- 133 // Navigation control flow --------------------------------------------------
129 134
130 // The net error code if an error happened prior to commit. Otherwise it will 135 // The net error code if an error happened prior to commit. Otherwise it will
131 // be net::OK. 136 // be net::OK.
132 virtual net::Error GetNetErrorCode() = 0; 137 virtual net::Error GetNetErrorCode() = 0;
133 138
134 // Returns the RenderFrameHost this navigation is taking place in. This can 139 // Returns the RenderFrameHost this navigation is taking place in. This can
135 // only be accessed after a response has been delivered for processing. 140 // only be accessed after a response has been delivered for processing.
136 // 141 //
137 // If PlzNavigate is active, the RenderFrameHost returned will be the final 142 // If PlzNavigate is active, the RenderFrameHost returned will be the final
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 174
170 // Resumes a navigation that was previously deferred by a NavigationThrottle. 175 // Resumes a navigation that was previously deferred by a NavigationThrottle.
171 virtual void Resume() = 0; 176 virtual void Resume() = 0;
172 177
173 // Cancels a navigation that was previously deferred by a NavigationThrottle. 178 // Cancels a navigation that was previously deferred by a NavigationThrottle.
174 // |result| should be equal to NavigationThrottle::CANCEL or 179 // |result| should be equal to NavigationThrottle::CANCEL or
175 // NavigationThrottle::CANCEL_AND_IGNORE. 180 // NavigationThrottle::CANCEL_AND_IGNORE.
176 virtual void CancelDeferredNavigation( 181 virtual void CancelDeferredNavigation(
177 NavigationThrottle::ThrottleCheckResult result) = 0; 182 NavigationThrottle::ThrottleCheckResult result) = 0;
178 183
184 // This is valid after the network response has started. Returns the ID of the
185 // MAIN_FRAME URLRequest associated with this navigation.
clamy 2016/11/04 14:44:17 Actually, considering the case of transfer navigat
Not at Google. Contact bengr 2016/11/07 22:17:18 Done. I'm guessing you mean ReadyToCommitNavigati
186 virtual const GlobalRequestID& GetGlobalRequestID() = 0;
187
179 // Testing methods ---------------------------------------------------------- 188 // Testing methods ----------------------------------------------------------
180 // 189 //
181 // The following methods should be used exclusively for writing unit tests. 190 // The following methods should be used exclusively for writing unit tests.
182 191
183 static std::unique_ptr<NavigationHandle> CreateNavigationHandleForTesting( 192 static std::unique_ptr<NavigationHandle> CreateNavigationHandleForTesting(
184 const GURL& url, 193 const GURL& url,
185 RenderFrameHost* render_frame_host, 194 RenderFrameHost* render_frame_host,
186 bool committed = false, 195 bool committed = false,
187 net::Error error = net::OK); 196 net::Error error = net::OK);
188 197
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 231
223 // The NavigationData that the embedder returned from 232 // The NavigationData that the embedder returned from
224 // ResourceDispatcherHostDelegate::GetNavigationData during commit. This will 233 // ResourceDispatcherHostDelegate::GetNavigationData during commit. This will
225 // be a clone of the NavigationData. 234 // be a clone of the NavigationData.
226 virtual NavigationData* GetNavigationData() = 0; 235 virtual NavigationData* GetNavigationData() = 0;
227 }; 236 };
228 237
229 } // namespace content 238 } // namespace content
230 239
231 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ 240 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698