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

Unified Diff: content/browser/frame_host/navigation_handle_impl.h

Issue 2321543002: Merge CrossSiteResourceHandler and NavigationResourceThrottle (Closed)
Patch Set: Fixed test compilation error Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_handle_impl.h
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h
index f7190873db4855ec58ae6f8068e1d655533a8926..fe46e5a1be514b9b50ace70542372ead1c390b12 100644
--- a/content/browser/frame_host/navigation_handle_impl.h
+++ b/content/browser/frame_host/navigation_handle_impl.h
@@ -16,6 +16,7 @@
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/common/content_export.h"
+#include "content/public/browser/global_request_id.h"
#include "content/public/browser/navigation_data.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/common/request_context_type.h"
@@ -151,12 +152,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
is_transferring_ = is_transferring;
}
- // Updates the RenderFrameHost that is about to commit the navigation. This
- // is used during transfer navigations.
- void set_render_frame_host(RenderFrameHostImpl* render_frame_host) {
- render_frame_host_ = render_frame_host;
- }
-
// Returns the POST body associated with this navigation. This will be
// null for GET and/or other non-POST requests (or if a response to a POST
// request was a redirect that changed the method to GET - for example 302).
@@ -199,10 +194,18 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// If the result is PROCEED, then 'ReadyToCommitNavigation' will be called
// with |render_frame_host| and |response_headers| just before calling
// |callback|.
+ // Should a transfer navigation happen, |transfer_callback| will be run on
nasko 2016/09/08 00:35:36 nit: Move to previous line.
clamy 2016/09/09 15:06:41 Done.
+ // the IO thread.
+ // PlzNavigate: transfer navigations are not possible.
void WillProcessResponse(
RenderFrameHostImpl* render_frame_host,
scoped_refptr<net::HttpResponseHeaders> response_headers,
const SSLStatus& ssl_status,
+ const GlobalRequestID& request_id,
+ bool should_replace_current_entry,
+ bool is_download,
+ bool is_stream,
+ const base::Closure& transfer_callback,
const ThrottleChecksFinishedCallback& callback);
// Returns the FrameTreeNode this navigation is happening in.
@@ -234,6 +237,11 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
SSLStatus ssl_status() { return ssl_status_; }
+ const GlobalRequestID& request_id() const { return request_id_; }
+
+ // Called when the navigation is transferred to a RenderFrameHost.
+ void TransferredToRenderFrameHost(RenderFrameHostImpl* render_frame_host);
nasko 2016/09/08 23:45:39 The name and the comment implies that the transfer
clamy 2016/09/09 15:06:41 Done.
+
private:
friend class NavigationHandleImplTest;
@@ -264,6 +272,15 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
+ // Called when WillProcessResponse checks are done, to find the final
+ // RenderFrameHost for the navigation. Returns true if the navigation should
+ // proceed.
+ bool GetFinalRenderFrameHost();
nasko 2016/09/08 23:45:39 A GetType method should return Type, not bool. Let
clamy 2016/09/09 15:06:41 How about FindFinaleFrameHost?
nasko 2016/09/09 23:30:27 sgtm
+
+ // Check whether the navigation should be transferred. Returns false if the
+ // transfer attempt results in the destruction of this NavigationHandle.
+ bool CheckForTransfer();
nasko 2016/09/08 23:45:39 A bool return value from CheckForTransfer reads to
clamy 2016/09/09 15:06:41 How about MaybeTransferAndProceed? It's not great
nasko 2016/09/09 23:30:27 I think it is definitely better. If I think of any
+
// Helper function to run and reset the |complete_callback_|. This marks the
// end of a round of NavigationThrottleChecks.
void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result);
@@ -289,6 +306,10 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
bool was_redirected_;
scoped_refptr<net::HttpResponseHeaders> response_headers_;
+ // The original url of the navigation. This may differ from |url_| if the
+ // navigation encounters redirects.
+ const GURL original_url_;
+
// The HTTP method used for the navigation.
std::string method_;
@@ -330,6 +351,24 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
SSLStatus ssl_status_;
+ // The id of the URLRequest tied to this navigation.
+ GlobalRequestID request_id_;
+
+ // Whether the current NavigationEntry should be replaced upon commit.
+ bool should_replace_current_entry_;
+
+ // The chain of redirects.
+ std::vector<GURL> redirect_chain_;
+
+ // A callback to run on the IO thread if the navigation transfers.
+ base::Closure transfer_callback_;
+
+ // Whether the navigation ended up being a download or a stream.
+ bool is_download_;
+ bool is_stream_;
+
+ base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
};

Powered by Google App Engine
This is Rietveld 408576698