Convert NavigationClient to new Mojo types

This CL converts NavigationClientAssociatedPtrInfo,
NavigationClientAssociatedPtr, NavigationClientPtr,
and NavigationClientAssociatedRequest to new
Mojo types.

It also updates BeginNavigation from frame.mojom
and methods and members which implements it with
new Mojo types.

Bug: 955171
Change-Id: I2ed4aa7cdf57361c982e3adc696cc9ead797630b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797823
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#695984}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index f0c3d20..8235e05 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -2128,7 +2128,7 @@
 
 bool NavigationControllerImpl::StartHistoryNavigationInNewSubframe(
     RenderFrameHostImpl* render_frame_host,
-    mojom::NavigationClientAssociatedPtrInfo* navigation_client) {
+    mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client) {
   NavigationEntryImpl* entry =
       GetEntryWithUniqueID(render_frame_host->nav_entry_id());
   if (!entry)
diff --git a/content/browser/frame_host/navigation_controller_impl.h b/content/browser/frame_host/navigation_controller_impl.h
index f01c4c5..48075d6 100644
--- a/content/browser/frame_host/navigation_controller_impl.h
+++ b/content/browser/frame_host/navigation_controller_impl.h
@@ -24,6 +24,7 @@
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_type.h"
 #include "content/public/browser/reload_type.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 
 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
 
@@ -103,7 +104,8 @@
   // navigation to the default src URL for the frame instead.
   bool StartHistoryNavigationInNewSubframe(
       RenderFrameHostImpl* render_frame_host,
-      mojom::NavigationClientAssociatedPtrInfo* navigation_client);
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>*
+          navigation_client);
 
   // Navigates to a specified offset from the "current entry". Currently records
   // a histogram indicating whether the session history navigation would only
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 52f857a5..76310ca 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -603,8 +603,8 @@
       frame_tree_node, std::move(common_params), std::move(navigation_params),
       std::move(commit_params), browser_initiated,
       false /* from_begin_navigation */, false /* is_for_commit */, frame_entry,
-      entry, std::move(navigation_ui_data), nullptr, mojo::NullRemote(),
-      rfh_restored_from_back_forward_cache));
+      entry, std::move(navigation_ui_data), mojo::NullAssociatedRemote(),
+      mojo::NullRemote(), rfh_restored_from_back_forward_cache));
 
   if (frame_entry) {
     navigation_request->blob_url_loader_factory_ =
@@ -637,7 +637,7 @@
     int current_history_list_length,
     bool override_user_agent,
     scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator> navigation_initiator,
     scoped_refptr<PrefetchedSignedExchangeCache>
         prefetched_signed_exchange_cache) {
@@ -763,9 +763,8 @@
       std::move(commit_params), !is_renderer_initiated,
       false /* from_begin_navigation */, true /* is_for_commit */,
       entry ? entry->GetFrameEntry(frame_tree_node) : nullptr, entry,
-      nullptr /* navigation_ui_data */,
-      mojom::NavigationClientAssociatedPtrInfo(), mojo::NullRemote(),
-      nullptr /* rfh_restored_from_back_forward_cache */));
+      nullptr /* navigation_ui_data */, mojo::NullAssociatedRemote(),
+      mojo::NullRemote(), nullptr /* rfh_restored_from_back_forward_cache */));
 
   // Update the state of the NavigationRequest to match the fact that the
   // navigation just committed.
@@ -787,7 +786,7 @@
     const FrameNavigationEntry* frame_entry,
     NavigationEntryImpl* entry,
     std::unique_ptr<NavigationUIData> navigation_ui_data,
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator> navigation_initiator,
     RenderFrameHostImpl* rfh_restored_from_back_forward_cache)
     : frame_tree_node_(frame_tree_node),
@@ -807,8 +806,8 @@
       net_error_(net::OK),
       expected_render_process_host_id_(ChildProcessHost::kInvalidUniqueID),
       devtools_navigation_token_(base::UnguessableToken::Create()),
-      request_navigation_client_(nullptr),
-      commit_navigation_client_(nullptr),
+      request_navigation_client_(mojo::NullAssociatedRemote()),
+      commit_navigation_client_(mojo::NullAssociatedRemote()),
       rfh_restored_from_back_forward_cache_(
           rfh_restored_from_back_forward_cache) {
   DCHECK(browser_initiated || common_params_->initiator_origin.has_value());
@@ -2199,7 +2198,7 @@
   // consistent with the URL being requested.
   commit_params_->origin_to_commit =
       url::Origin::Create(common_params_->url).DeriveNewOpaqueOrigin();
-  if (IsPerNavigationMojoInterfaceEnabled() && request_navigation_client_ &&
+  if (IsPerNavigationMojoInterfaceEnabled() &&
       request_navigation_client_.is_bound()) {
     if (associated_site_instance_id_ ==
         render_frame_host_->GetSiteInstance()->GetId()) {
@@ -2267,7 +2266,7 @@
 
   frame_tree_node_->TransferNavigationRequestOwnership(render_frame_host_);
 
-  if (IsPerNavigationMojoInterfaceEnabled() && request_navigation_client_ &&
+  if (IsPerNavigationMojoInterfaceEnabled() &&
       request_navigation_client_.is_bound()) {
     if (associated_site_instance_id_ ==
         render_frame_host_->GetSiteInstance()->GetId()) {
@@ -2622,19 +2621,17 @@
 }
 
 void NavigationRequest::HandleInterfaceDisconnection(
-    mojom::NavigationClientAssociatedPtr* navigation_client,
+    mojo::AssociatedRemote<mojom::NavigationClient>* navigation_client,
     base::OnceClosure error_handler) {
-  navigation_client->set_connection_error_handler(std::move(error_handler));
+  navigation_client->set_disconnect_handler(std::move(error_handler));
 }
 
 void NavigationRequest::IgnoreInterfaceDisconnection() {
-  return request_navigation_client_.set_connection_error_handler(
-      base::DoNothing());
+  return request_navigation_client_.set_disconnect_handler(base::DoNothing());
 }
 
 void NavigationRequest::IgnoreCommitInterfaceDisconnection() {
-  return commit_navigation_client_.set_connection_error_handler(
-      base::DoNothing());
+  return commit_navigation_client_.set_disconnect_handler(base::DoNothing());
 }
 
 bool NavigationRequest::IsSameDocument() const {
@@ -3082,7 +3079,7 @@
 }
 
 void NavigationRequest::SetNavigationClient(
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     int32_t associated_site_instance_id) {
   DCHECK(from_begin_navigation_ ||
          common_params_->is_history_navigation_in_new_child_frame);
@@ -3090,7 +3087,7 @@
   if (!navigation_client.is_valid())
     return;
 
-  request_navigation_client_ = mojom::NavigationClientAssociatedPtr();
+  request_navigation_client_.reset();
   request_navigation_client_.Bind(std::move(navigation_client));
 
   // Binds the OnAbort callback
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h
index b806051..89655bd 100644
--- a/content/browser/frame_host/navigation_request.h
+++ b/content/browser/frame_host/navigation_request.h
@@ -30,6 +30,8 @@
 #include "content/public/browser/navigation_type.h"
 #include "content/public/browser/render_process_host_observer.h"
 #include "content/public/common/previews_state.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "net/base/proxy_server.h"
@@ -156,7 +158,7 @@
       int current_history_list_length,
       bool override_user_agent,
       scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>
           navigation_initiator,
       scoped_refptr<PrefetchedSignedExchangeCache>
@@ -449,7 +451,7 @@
   // navigation in a subframe. This allows a browser-initiated NavigationRequest
   // to be canceled by the renderer.
   void SetNavigationClient(
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       int32_t associated_site_instance_id);
 
   // Whether the new document created by this navigation will be loaded from a
@@ -538,20 +540,21 @@
  private:
   friend class NavigationRequestTest;
 
-  NavigationRequest(FrameTreeNode* frame_tree_node,
-                    mojom::CommonNavigationParamsPtr common_params,
-                    mojom::BeginNavigationParamsPtr begin_params,
-                    mojom::CommitNavigationParamsPtr commit_params,
-                    bool browser_initiated,
-                    bool from_begin_navigation,
-                    bool is_for_commit,
-                    const FrameNavigationEntry* frame_navigation_entry,
-                    NavigationEntryImpl* navitation_entry,
-                    std::unique_ptr<NavigationUIData> navigation_ui_data,
-                    mojom::NavigationClientAssociatedPtrInfo navigation_client,
-                    mojo::PendingRemote<blink::mojom::NavigationInitiator>
-                        navigation_initiator,
-                    RenderFrameHostImpl* rfh_restored_from_back_forward_cache);
+  NavigationRequest(
+      FrameTreeNode* frame_tree_node,
+      mojom::CommonNavigationParamsPtr common_params,
+      mojom::BeginNavigationParamsPtr begin_params,
+      mojom::CommitNavigationParamsPtr commit_params,
+      bool browser_initiated,
+      bool from_begin_navigation,
+      bool is_for_commit,
+      const FrameNavigationEntry* frame_navigation_entry,
+      NavigationEntryImpl* navitation_entry,
+      std::unique_ptr<NavigationUIData> navigation_ui_data,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
+      mojo::PendingRemote<blink::mojom::NavigationInitiator>
+          navigation_initiator,
+      RenderFrameHostImpl* rfh_restored_from_back_forward_cache);
 
   // NavigationURLLoaderDelegate implementation.
   void OnRequestRedirected(
@@ -682,8 +685,9 @@
   // Binds the given error_handler to be called when an interface disconnection
   // happens on the renderer side.
   // Only used with PerNavigationMojoInterface enabled.
-  void HandleInterfaceDisconnection(mojom::NavigationClientAssociatedPtr*,
-                                    base::OnceClosure error_handler);
+  void HandleInterfaceDisconnection(
+      mojo::AssociatedRemote<mojom::NavigationClient>*,
+      base::OnceClosure error_handler);
 
   // When called, this NavigationRequest will no longer interpret the interface
   // disconnection on the renderer side as an AbortNavigation.
@@ -962,14 +966,14 @@
   // case of a renderer initiated navigation. It is expected to be bound until
   // this navigation commits or is canceled.
   // Only valid when PerNavigationMojoInterface is enabled.
-  mojom::NavigationClientAssociatedPtr request_navigation_client_;
+  mojo::AssociatedRemote<mojom::NavigationClient> request_navigation_client_;
   base::Optional<int32_t> associated_site_instance_id_;
 
   // The NavigationClient interface used to commit the navigation. For now, this
   // is only used for same-site renderer-initiated navigation.
   // TODO(clamy, ahemery): Extend to all types of navigation.
   // Only valid when PerNavigationMojoInterface is enabled.
-  mojom::NavigationClientAssociatedPtr commit_navigation_client_;
+  mojo::AssociatedRemote<mojom::NavigationClient> commit_navigation_client_;
 
   // If set, any redirects to HTTP for this navigation will be upgraded to
   // HTTPS. This is used only on subframe navigations, when
diff --git a/content/browser/frame_host/navigator.cc b/content/browser/frame_host/navigator.cc
index b100664..d16c21b 100644
--- a/content/browser/frame_host/navigator.cc
+++ b/content/browser/frame_host/navigator.cc
@@ -19,7 +19,7 @@
 
 bool Navigator::StartHistoryNavigationInNewSubframe(
     RenderFrameHostImpl* render_frame_host,
-    mojom::NavigationClientAssociatedPtrInfo* navigation_client) {
+    mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client) {
   return false;
 }
 
@@ -32,7 +32,7 @@
     mojom::CommonNavigationParamsPtr common_params,
     mojom::BeginNavigationParamsPtr begin_params,
     scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator> navigation_initiator,
     scoped_refptr<PrefetchedSignedExchangeCache>
         prefetched_signed_exchange_cache) {}
diff --git a/content/browser/frame_host/navigator.h b/content/browser/frame_host/navigator.h
index cea80e7..73c75d2 100644
--- a/content/browser/frame_host/navigator.h
+++ b/content/browser/frame_host/navigator.h
@@ -13,6 +13,7 @@
 #include "content/common/content_export.h"
 #include "content/common/navigation_params.mojom.h"
 #include "content/public/browser/navigation_controller.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "third_party/blink/public/web/web_triggering_event_info.h"
 #include "ui/base/window_open_disposition.h"
@@ -86,7 +87,8 @@
   // FrameNavigationEntry can't be found or the navigation fails.
   virtual bool StartHistoryNavigationInNewSubframe(
       RenderFrameHostImpl* render_frame_host,
-      mojom::NavigationClientAssociatedPtrInfo* navigation_client);
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>*
+          navigation_client);
 
   // Navigation requests -------------------------------------------------------
 
@@ -150,7 +152,7 @@
       mojom::CommonNavigationParamsPtr common_params,
       mojom::BeginNavigationParamsPtr begin_params,
       scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>
           navigation_initiator,
       scoped_refptr<PrefetchedSignedExchangeCache>
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index a781313e..6a17a0e8 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -196,7 +196,7 @@
 
 bool NavigatorImpl::StartHistoryNavigationInNewSubframe(
     RenderFrameHostImpl* render_frame_host,
-    mojom::NavigationClientAssociatedPtrInfo* navigation_client) {
+    mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client) {
   return controller_->StartHistoryNavigationInNewSubframe(render_frame_host,
                                                           navigation_client);
 }
@@ -618,7 +618,7 @@
     mojom::CommonNavigationParamsPtr common_params,
     mojom::BeginNavigationParamsPtr begin_params,
     scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator> navigation_initiator,
     scoped_refptr<PrefetchedSignedExchangeCache>
         prefetched_signed_exchange_cache) {
diff --git a/content/browser/frame_host/navigator_impl.h b/content/browser/frame_host/navigator_impl.h
index b941c0c..fce48a9 100644
--- a/content/browser/frame_host/navigator_impl.h
+++ b/content/browser/frame_host/navigator_impl.h
@@ -57,7 +57,8 @@
                    bool was_within_same_document) override;
   bool StartHistoryNavigationInNewSubframe(
       RenderFrameHostImpl* render_frame_host,
-      mojom::NavigationClientAssociatedPtrInfo* navigation_client) override;
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client)
+      override;
   void Navigate(std::unique_ptr<NavigationRequest> request,
                 ReloadType reload_type,
                 RestoreType restore_type) override;
@@ -97,7 +98,7 @@
       mojom::CommonNavigationParamsPtr common_params,
       mojom::BeginNavigationParamsPtr begin_params,
       scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>
           navigation_initiator,
       scoped_refptr<PrefetchedSignedExchangeCache>
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index fe21a77..d830756 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -542,14 +542,14 @@
   mojom::CommonNavigationParamsPtr common_params;
   mojom::BeginNavigationParamsPtr begin_navigation_params;
   scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory;
-  mojom::NavigationClientAssociatedPtrInfo navigation_client;
+  mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client;
   mojo::PendingRemote<blink::mojom::NavigationInitiator> navigation_initiator;
 
   PendingNavigation(
       mojom::CommonNavigationParamsPtr common_params,
       mojom::BeginNavigationParamsPtr begin_navigation_params,
       scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>
           navigation_initiator);
 };
@@ -558,7 +558,7 @@
     mojom::CommonNavigationParamsPtr common_params,
     mojom::BeginNavigationParamsPtr begin_navigation_params,
     scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator> navigation_initiator)
     : common_params(std::move(common_params)),
       begin_navigation_params(std::move(begin_navigation_params)),
@@ -4180,7 +4180,7 @@
     mojom::CommonNavigationParamsPtr common_params,
     mojom::BeginNavigationParamsPtr begin_params,
     mojo::PendingRemote<blink::mojom::BlobURLToken> blob_url_token,
-    mojom::NavigationClientAssociatedPtrInfo navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator>
         navigation_initiator) {
   if (frame_tree_node_->render_manager()->is_attaching_inner_delegate()) {
@@ -5943,11 +5943,11 @@
   return result;
 }
 
-mojom::NavigationClientAssociatedPtr
+mojo::AssociatedRemote<mojom::NavigationClient>
 RenderFrameHostImpl::GetNavigationClientFromInterfaceProvider() {
-  mojom::NavigationClientAssociatedPtr navigation_client_ptr;
-  GetRemoteAssociatedInterfaces()->GetInterface(&navigation_client_ptr);
-  return navigation_client_ptr;
+  mojo::AssociatedRemote<mojom::NavigationClient> navigation_client_remote;
+  GetRemoteAssociatedInterfaces()->GetInterface(&navigation_client_remote);
+  return navigation_client_remote;
 }
 
 void RenderFrameHostImpl::NavigationRequestCancelled(
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index 2ddbd6d..988fcb4 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -58,6 +58,7 @@
 #include "content/public/common/transferrable_url_loader.mojom.h"
 #include "media/mojo/mojom/interface_factory.mojom.h"
 #include "mojo/public/cpp/bindings/associated_remote.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/remote.h"
@@ -921,9 +922,9 @@
   bool was_granted_media_access() { return was_granted_media_access_; }
 
   // Request a new NavigationClient interface from the renderer and returns the
-  // ownership of the AssociatedPtr. This is intended for use by the
+  // ownership of the mojo::AssociatedRemote. This is intended for use by the
   // NavigationRequest. Only used with PerNavigationMojoInterface enabled.
-  mojom::NavigationClientAssociatedPtr
+  mojo::AssociatedRemote<mojom::NavigationClient>
   GetNavigationClientFromInterfaceProvider();
 
   // Called to signify the RenderFrameHostImpl that one of its ongoing
@@ -1344,7 +1345,7 @@
       mojom::CommonNavigationParamsPtr common_params,
       mojom::BeginNavigationParamsPtr begin_params,
       mojo::PendingRemote<blink::mojom::BlobURLToken> blob_url_token,
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>
           navigation_initiator) override;
   void SubresourceResponseStarted(const GURL& url,
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc
index 83e5bdc..1c45e64 100644
--- a/content/browser/navigation_browsertest.cc
+++ b/content/browser/navigation_browsertest.cc
@@ -55,8 +55,8 @@
 #include "content/test/content_browser_test_utils_internal.h"
 #include "content/test/did_commit_navigation_interceptor.h"
 #include "ipc/ipc_security_test_util.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
-#include "mojo/public/cpp/bindings/pending_remote.h"
 #include "net/base/features.h"
 #include "net/base/filename_util.h"
 #include "net/base/load_flags.h"
@@ -771,17 +771,17 @@
   // termination.
   RenderProcessHostKillWaiter process_kill_waiter(rfh->GetProcess());
 
-  mojom::NavigationClientAssociatedPtr navigation_client;
+  mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client;
   if (IsPerNavigationMojoInterfaceEnabled()) {
-    auto navigation_client_request =
-        mojo::MakeRequestAssociatedWithDedicatedPipe(&navigation_client);
+    auto navigation_client_receiver =
+        navigation_client.InitWithNewEndpointAndPassReceiver();
     rfh->frame_host_binding_for_testing().impl()->BeginNavigation(
         std::move(common_params), std::move(begin_params), mojo::NullRemote(),
-        navigation_client.PassInterface(), mojo::NullRemote());
+        std::move(navigation_client), mojo::NullRemote());
   } else {
     rfh->frame_host_binding_for_testing().impl()->BeginNavigation(
         std::move(common_params), std::move(begin_params), mojo::NullRemote(),
-        nullptr, mojo::NullRemote());
+        mojo::NullAssociatedRemote(), mojo::NullRemote());
   }
   EXPECT_EQ(bad_message::RFH_BASE_URL_FOR_DATA_URL_SPECIFIED,
             process_kill_waiter.Wait());
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index f1dd6cd..d34b62f 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -52,6 +52,7 @@
 #include "content/test/test_content_browser_client.h"
 #include "ipc/ipc_security_test_util.h"
 #include "mojo/core/embedder/embedder.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/strong_associated_binding.h"
 #include "mojo/public/cpp/test_support/test_utils.h"
@@ -1295,7 +1296,7 @@
       mojom::CommonNavigationParamsPtr* common_params,
       mojom::BeginNavigationParamsPtr* begin_params,
       mojo::PendingRemote<blink::mojom::BlobURLToken>* blob_url_token,
-      mojom::NavigationClientAssociatedPtrInfo* navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>*
           navigation_initiator) override {
     if (is_activated_) {
@@ -1439,7 +1440,7 @@
       mojom::CommonNavigationParamsPtr* common_params,
       mojom::BeginNavigationParamsPtr* begin_params,
       mojo::PendingRemote<blink::mojom::BlobURLToken>* blob_url_token,
-      mojom::NavigationClientAssociatedPtrInfo* navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>*
           navigation_initiator) override {
     if (is_activated_) {
diff --git a/content/browser/service_worker/service_worker_test_utils.cc b/content/browser/service_worker/service_worker_test_utils.cc
index f688f98..08952c1 100644
--- a/content/browser/service_worker/service_worker_test_utils.cc
+++ b/content/browser/service_worker/service_worker_test_utils.cc
@@ -26,7 +26,7 @@
 #include "content/public/common/child_process_host.h"
 #include "content/public/common/transferrable_url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/pending_associated_remote.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/bindings/self_owned_receiver.h"
 #include "net/base/io_buffer.h"
 #include "net/base/test_completion_callback.h"
 #include "net/http/http_response_info.h"
@@ -99,7 +99,7 @@
   ~FakeNavigationClient() override = default;
 
  private:
-  // mojom::NavigationClientPtr implementation:
+  // mojom::NavigationClient implementation:
   void CommitNavigation(
       mojom::CommonNavigationParamsPtr common_params,
       mojom::CommitNavigationParamsPtr commit_params,
@@ -209,7 +209,7 @@
   // crash.
   blink::mojom::ServiceWorkerProviderInfoForClientPtr received_info;
   base::RunLoop loop(base::RunLoop::Type::kNestableTasksAllowed);
-  mojo::MakeStrongBinding(
+  mojo::MakeSelfOwnedReceiver(
       std::make_unique<FakeNavigationClient>(base::BindOnce(
           [](base::OnceClosure quit_closure,
              blink::mojom::ServiceWorkerProviderInfoForClientPtr* out_info,
@@ -218,7 +218,7 @@
             std::move(quit_closure).Run();
           },
           loop.QuitClosure(), &received_info)),
-      mojo::MakeRequest(&navigation_client_));
+      navigation_client_.BindNewPipeAndPassReceiver());
   navigation_client_->CommitNavigation(
       CreateCommonNavigationParams(), CreateCommitNavigationParams(),
       network::ResourceResponseHead(), mojo::ScopedDataPipeConsumerHandle(),
diff --git a/content/browser/service_worker/service_worker_test_utils.h b/content/browser/service_worker/service_worker_test_utils.h
index a35d1f6..1ef3df8 100644
--- a/content/browser/service_worker/service_worker_test_utils.h
+++ b/content/browser/service_worker/service_worker_test_utils.h
@@ -23,6 +23,7 @@
 #include "content/public/common/content_switches.h"
 #include "mojo/public/cpp/bindings/associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_associated_receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom.h"
 #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h"
@@ -93,7 +94,7 @@
   // do the same thing by establishing a
   // blink::mojom::EmbeddedWorkerInstanceClient connection if in the future we
   // really need to make |host_remote_| and |client_receiver_| usable for it.
-  mojom::NavigationClientPtr navigation_client_;
+  mojo::Remote<mojom::NavigationClient> navigation_client_;
   // Bound with content::ServiceWorkerProviderHost. The provider host will be
   // removed asynchronously when this remote is closed.
   mojo::AssociatedRemote<blink::mojom::ServiceWorkerContainerHost> host_remote_;
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index a99a8f3d..94b48f4 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -424,7 +424,7 @@
       CommonNavigationParams common_params,
       BeginNavigationParams begin_params,
       pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
-      associated NavigationClient? navigation_client,
+      pending_associated_remote<NavigationClient>? navigation_client,
       pending_remote<blink.mojom.NavigationInitiator>? navigation_initiator);
 
   // Sent when a subresource response has started.
diff --git a/content/renderer/navigation_client.cc b/content/renderer/navigation_client.cc
index f8b7c83..4f5cba3 100644
--- a/content/renderer/navigation_client.cc
+++ b/content/renderer/navigation_client.cc
@@ -11,7 +11,7 @@
 namespace content {
 
 NavigationClient::NavigationClient(RenderFrameImpl* render_frame)
-    : navigation_client_binding_(this), render_frame_(render_frame) {}
+    : render_frame_(render_frame) {}
 
 NavigationClient::~NavigationClient() {}
 
@@ -59,10 +59,11 @@
       std::move(subresource_loaders), std::move(callback));
 }
 
-void NavigationClient::Bind(mojom::NavigationClientAssociatedRequest request) {
-  navigation_client_binding_.Bind(
-      std::move(request), render_frame_->GetTaskRunner(
-                              blink::TaskType::kInternalNavigationAssociated));
+void NavigationClient::Bind(
+    mojo::PendingAssociatedReceiver<mojom::NavigationClient> receiver) {
+  navigation_client_receiver_.Bind(
+      std::move(receiver), render_frame_->GetTaskRunner(
+                               blink::TaskType::kInternalNavigationAssociated));
   SetDisconnectionHandler();
 }
 
@@ -72,12 +73,12 @@
 }
 
 void NavigationClient::SetDisconnectionHandler() {
-  navigation_client_binding_.set_connection_error_handler(base::BindOnce(
+  navigation_client_receiver_.set_disconnect_handler(base::BindOnce(
       &NavigationClient::OnDroppedNavigation, base::Unretained(this)));
 }
 
 void NavigationClient::ResetDisconnectionHandler() {
-  navigation_client_binding_.set_connection_error_handler(base::DoNothing());
+  navigation_client_receiver_.set_disconnect_handler(base::DoNothing());
 }
 
 void NavigationClient::OnDroppedNavigation() {
diff --git a/content/renderer/navigation_client.h b/content/renderer/navigation_client.h
index 927e5f2..614a1c8 100644
--- a/content/renderer/navigation_client.h
+++ b/content/renderer/navigation_client.h
@@ -6,7 +6,8 @@
 #define CONTENT_RENDERER_NAVIGATION_CLIENT_H_
 
 #include "content/common/navigation_client.mojom.h"
-#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/bindings/associated_receiver.h"
+#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
 
 namespace content {
 
@@ -43,7 +44,7 @@
       std::unique_ptr<blink::URLLoaderFactoryBundleInfo> subresource_loaders,
       CommitFailedNavigationCallback callback) override;
 
-  void Bind(mojom::NavigationClientAssociatedRequest request);
+  void Bind(mojo::PendingAssociatedReceiver<mojom::NavigationClient> receiver);
 
   // See NavigationState::was_initiated_in_this_frame for details.
   void MarkWasInitiatedInThisFrame();
@@ -59,7 +60,8 @@
   void SetDisconnectionHandler();
   void ResetDisconnectionHandler();
 
-  mojo::AssociatedBinding<mojom::NavigationClient> navigation_client_binding_;
+  mojo::AssociatedReceiver<mojom::NavigationClient> navigation_client_receiver_{
+      this};
   RenderFrameImpl* render_frame_;
   bool was_initiated_in_this_frame_ = false;
 };
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index eac9682..45c0bf7 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2393,9 +2393,9 @@
 }
 
 void RenderFrameImpl::BindNavigationClient(
-    mojom::NavigationClientAssociatedRequest request) {
+    mojo::PendingAssociatedReceiver<mojom::NavigationClient> receiver) {
   navigation_client_impl_ = std::make_unique<NavigationClient>(this);
-  navigation_client_impl_->Bind(std::move(request));
+  navigation_client_impl_->Bind(std::move(receiver));
 }
 
 void RenderFrameImpl::OnBeforeUnload(bool is_reload) {
@@ -7270,9 +7270,11 @@
           initiator ? base::make_optional<base::Value>(std::move(*initiator))
                     : base::nullopt);
 
-  mojom::NavigationClientAssociatedPtrInfo navigation_client_info;
+  mojo::PendingAssociatedRemote<mojom::NavigationClient>
+      navigation_client_remote;
   if (IsPerNavigationMojoInterfaceEnabled()) {
-    BindNavigationClient(mojo::MakeRequest(&navigation_client_info));
+    BindNavigationClient(
+        navigation_client_remote.InitWithNewEndpointAndPassReceiver());
     navigation_client_impl_->MarkWasInitiatedInThisFrame();
   }
 
@@ -7291,7 +7293,7 @@
                                  load_flags, has_download_sandbox_flag, from_ad,
                                  is_history_navigation_in_new_child_frame),
       std::move(begin_navigation_params), std::move(blob_url_token),
-      std::move(navigation_client_info), std::move(navigation_initiator));
+      std::move(navigation_client_remote), std::move(navigation_initiator));
 }
 
 void RenderFrameImpl::DecodeDataURL(
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 7c64101..09752d4 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -65,6 +65,7 @@
 #include "mojo/public/cpp/bindings/associated_receiver.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/remote.h"
@@ -909,7 +910,8 @@
   void BindFrameNavigationControl(
       mojo::PendingAssociatedReceiver<mojom::FrameNavigationControl> receiver);
   // Only used when PerNavigationMojoInterface is enabled.
-  void BindNavigationClient(mojom::NavigationClientAssociatedRequest request);
+  void BindNavigationClient(
+      mojo::PendingAssociatedReceiver<mojom::NavigationClient> receiver);
 
   media::MediaPermission* GetMediaPermission();
 
diff --git a/content/test/frame_host_interceptor.cc b/content/test/frame_host_interceptor.cc
index f355e5c..155890a 100644
--- a/content/test/frame_host_interceptor.cc
+++ b/content/test/frame_host_interceptor.cc
@@ -43,7 +43,7 @@
       mojom::CommonNavigationParamsPtr common_params,
       mojom::BeginNavigationParamsPtr begin_params,
       mojo::PendingRemote<blink::mojom::BlobURLToken> blob_url_token,
-      mojom::NavigationClientAssociatedPtrInfo navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>
           navigation_initiator) override {
     if (interceptor_->WillDispatchBeginNavigation(
@@ -80,7 +80,7 @@
     mojom::CommonNavigationParamsPtr* common_params,
     mojom::BeginNavigationParamsPtr* begin_params,
     mojo::PendingRemote<blink::mojom::BlobURLToken>* blob_url_token,
-    mojom::NavigationClientAssociatedPtrInfo* navigation_client,
+    mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client,
     mojo::PendingRemote<blink::mojom::NavigationInitiator>*
         navigation_initiator) {
   return true;
diff --git a/content/test/frame_host_interceptor.h b/content/test/frame_host_interceptor.h
index 3aec1e1..016b764 100644
--- a/content/test/frame_host_interceptor.h
+++ b/content/test/frame_host_interceptor.h
@@ -11,6 +11,7 @@
 #include "base/macros.h"
 #include "content/common/frame.mojom.h"
 #include "content/public/browser/web_contents_observer.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 
 namespace content {
@@ -46,7 +47,7 @@
       mojom::CommonNavigationParamsPtr* common_params,
       mojom::BeginNavigationParamsPtr* begin_params,
       mojo::PendingRemote<blink::mojom::BlobURLToken>* blob_url_token,
-      mojom::NavigationClientAssociatedPtrInfo* navigation_client,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>* navigation_client,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>*
           navigation_initiator);
 
diff --git a/content/test/navigation_simulator_impl.cc b/content/test/navigation_simulator_impl.cc
index 7fab994..4c07b19 100644
--- a/content/test/navigation_simulator_impl.cc
+++ b/content/test/navigation_simulator_impl.cc
@@ -24,6 +24,7 @@
 #include "content/test/test_navigation_url_loader.h"
 #include "content/test/test_render_frame_host.h"
 #include "content/test/test_web_contents.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "net/base/load_flags.h"
 #include "net/url_request/redirect_info.h"
@@ -1128,20 +1129,22 @@
                        std::vector<ContentSecurityPolicy>(), base::nullopt);
 
   if (IsPerNavigationMojoInterfaceEnabled()) {
-    mojom::NavigationClientAssociatedPtr navigation_client_ptr;
-    navigation_client_request_ =
-        mojo::MakeRequestAssociatedWithDedicatedPipe(&navigation_client_ptr);
+    mojo::PendingAssociatedRemote<mojom::NavigationClient>
+        navigation_client_remote;
+    navigation_client_receiver_ =
+        navigation_client_remote.InitWithNewEndpointAndPassReceiver();
     render_frame_host_->frame_host_binding_for_testing()
         .impl()
         ->BeginNavigation(std::move(common_params), std::move(begin_params),
                           mojo::NullRemote(),
-                          navigation_client_ptr.PassInterface(),
+                          std::move(navigation_client_remote),
                           mojo::NullRemote());
   } else {
     render_frame_host_->frame_host_binding_for_testing()
         .impl()
         ->BeginNavigation(std::move(common_params), std::move(begin_params),
-                          mojo::NullRemote(), nullptr, mojo::NullRemote());
+                          mojo::NullRemote(), mojo::NullAssociatedRemote(),
+                          mojo::NullRemote());
   }
 
   NavigationRequest* request =
diff --git a/content/test/navigation_simulator_impl.h b/content/test/navigation_simulator_impl.h
index d37b057..2bc1074 100644
--- a/content/test/navigation_simulator_impl.h
+++ b/content/test/navigation_simulator_impl.h
@@ -16,7 +16,7 @@
 #include "content/public/browser/navigation_throttle.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/test/navigation_simulator.h"
-#include "mojo/public/cpp/bindings/associated_interface_request.h"
+#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "net/base/host_port_pair.h"
 #include "net/base/ip_endpoint.h"
@@ -344,8 +344,8 @@
   // cancellation coming from the renderer process side. This member interface
   // will never be bound.
   // Only used when PerNavigationMojoInterface is enabled.
-  mojo::AssociatedInterfaceRequest<mojom::NavigationClient>
-      navigation_client_request_;
+  mojo::PendingAssociatedReceiver<mojom::NavigationClient>
+      navigation_client_receiver_;
 
   base::WeakPtrFactory<NavigationSimulatorImpl> weak_factory_{this};
 };
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc
index 3519af6..ba05a1a 100644
--- a/content/test/test_render_frame.cc
+++ b/content/test/test_render_frame.cc
@@ -19,6 +19,7 @@
 #include "content/public/test/mock_render_thread.h"
 #include "content/renderer/input/frame_input_handler_impl.h"
 #include "content/renderer/loader/web_url_loader_impl.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "net/base/data_url.h"
 #include "services/network/public/cpp/resource_response.h"
@@ -159,7 +160,7 @@
       mojom::CommonNavigationParamsPtr common_params,
       mojom::BeginNavigationParamsPtr begin_params,
       mojo::PendingRemote<blink::mojom::BlobURLToken> blob_url_token,
-      mojom::NavigationClientAssociatedPtrInfo,
+      mojo::PendingAssociatedRemote<mojom::NavigationClient>,
       mojo::PendingRemote<blink::mojom::NavigationInitiator>) override {}
 
   void SubresourceResponseStarted(const GURL& url,
@@ -281,8 +282,10 @@
                      mojo::NullRemote() /* prefetch_loader_factory */,
                      base::UnguessableToken::Create(), base::DoNothing());
   } else {
+    mock_navigation_client_.reset();
     BindNavigationClient(
-        mojo::MakeRequestAssociatedWithDedicatedPipe(&mock_navigation_client_));
+        mock_navigation_client_
+            .BindNewEndpointAndPassDedicatedReceiverForTesting());
     CommitPerNavigationMojoInterfaceNavigation(
         std::move(common_params), std::move(commit_params), head,
         mojo::ScopedDataPipeConsumerHandle(),
@@ -313,8 +316,10 @@
                            false /* has_stale_copy_in_cache */, error_code,
                            error_page_content, nullptr, base::DoNothing());
   } else {
+    mock_navigation_client_.reset();
     BindNavigationClient(
-        mojo::MakeRequestAssociatedWithDedicatedPipe(&mock_navigation_client_));
+        mock_navigation_client_
+            .BindNewEndpointAndPassDedicatedReceiverForTesting());
     mock_navigation_client_->CommitFailedNavigation(
         std::move(common_params), std::move(commit_params),
         false /* has_stale_copy_in_cache */, error_code, error_page_content,
diff --git a/content/test/test_render_frame.h b/content/test/test_render_frame.h
index 0880cc7c..40f54da 100644
--- a/content/test/test_render_frame.h
+++ b/content/test/test_render_frame.h
@@ -13,6 +13,7 @@
 #include "content/common/input/input_handler.mojom.h"
 #include "content/common/navigation_params.mojom.h"
 #include "content/renderer/render_frame_impl.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
 
@@ -93,7 +94,7 @@
   base::Optional<std::string> next_navigation_html_override_;
   mojom::FrameInputHandlerPtr frame_input_handler_;
 
-  mojom::NavigationClientAssociatedPtr mock_navigation_client_;
+  mojo::AssociatedRemote<mojom::NavigationClient> mock_navigation_client_;
 
   DISALLOW_COPY_AND_ASSIGN(TestRenderFrame);
 };
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc
index 6251bd5..bd02bab 100644
--- a/content/test/test_render_frame_host.cc
+++ b/content/test/test_render_frame_host.cc
@@ -29,6 +29,7 @@
 #include "content/test/test_render_view_host.h"
 #include "content/test/test_render_widget_host.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "net/base/ip_endpoint.h"
 #include "net/base/load_flags.h"
@@ -360,15 +361,18 @@
   common_params->navigation_type = mojom::NavigationType::DIFFERENT_DOCUMENT;
   common_params->has_user_gesture = has_user_gesture;
 
-  mojom::NavigationClientAssociatedPtr navigation_client_ptr;
+  mojo::PendingAssociatedRemote<mojom::NavigationClient>
+      navigation_client_remote;
   if (IsPerNavigationMojoInterfaceEnabled()) {
-    GetRemoteAssociatedInterfaces()->GetInterface(&navigation_client_ptr);
+    GetRemoteAssociatedInterfaces()->GetInterface(
+        navigation_client_remote.InitWithNewEndpointAndPassReceiver());
     BeginNavigation(std::move(common_params), std::move(begin_params),
-                    mojo::NullRemote(), navigation_client_ptr.PassInterface(),
+                    mojo::NullRemote(), std::move(navigation_client_remote),
                     mojo::NullRemote());
   } else {
     BeginNavigation(std::move(common_params), std::move(begin_params),
-                    mojo::NullRemote(), nullptr, mojo::NullRemote());
+                    mojo::NullRemote(), mojo::NullAssociatedRemote(),
+                    mojo::NullRemote());
   }
 }