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

Unified Diff: content/browser/loader/navigation_resource_throttle.cc

Issue 2496193002: Implement transfer navigation with mojo (Closed)
Patch Set: fix 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/navigation_resource_throttle.cc
diff --git a/content/browser/loader/navigation_resource_throttle.cc b/content/browser/loader/navigation_resource_throttle.cc
index e8f9e6ed25b47782c18c8d174c31ec3cc3f92e7e..41476b9e8af3b6394633005a8fff78dd396f5318 100644
--- a/content/browser/loader/navigation_resource_throttle.cc
+++ b/content/browser/loader/navigation_resource_throttle.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
@@ -179,12 +180,14 @@ void WillProcessResponseOnUIThread(
NavigationResourceThrottle::NavigationResourceThrottle(
net::URLRequest* request,
ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate,
- RequestContextType request_context_type)
+ RequestContextType request_context_type,
+ const TransferCallback& on_transfer)
: request_(request),
resource_dispatcher_host_delegate_(resource_dispatcher_host_delegate),
request_context_type_(request_context_type),
in_cross_site_transition_(false),
on_transfer_done_result_(NavigationThrottle::DEFER),
+ on_transfer_(on_transfer),
weak_ptr_factory_(this) {}
NavigationResourceThrottle::~NavigationResourceThrottle() {}
@@ -362,11 +365,18 @@ void NavigationResourceThrottle::InitiateTransfer() {
weak_ptr_factory_.GetWeakPtr()));
}
-void NavigationResourceThrottle::OnTransferComplete() {
+void NavigationResourceThrottle::OnTransferComplete(
+ mojom::URLLoaderAssociatedRequest mojo_request,
+ mojom::URLLoaderClientAssociatedPtr url_loader_client) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(in_cross_site_transition_);
in_cross_site_transition_ = false;
+ if (on_transfer_) {
clamy 2016/11/21 17:55:54 Could you dcheck this only happens when loading wi
+ base::ResetAndReturn(&on_transfer_)
+ .Run(std::move(mojo_request), std::move(url_loader_client));
+ }
+
// If the results of the checks on the UI thread are known, unblock the
// navigation. Otherwise, wait until the callback has executed.
if (on_transfer_done_result_ != NavigationThrottle::DEFER) {

Powered by Google App Engine
This is Rietveld 408576698