[MPArch] Add CancelNavigation in RenderFrameHostOwner

This CL adds CancelNavigation method in RenderFrameHostOwner
not to reference FrameTreeNode directly in RenderFrameHostImpl.

Bug: 1350580
Change-Id: I57fe00bdaac78a86bed15c73351ab2190347d017
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4015309
Reviewed-by: Arthur Sonzogni <[email protected]>
Reviewed-by: Kevin McNee <[email protected]>
Commit-Queue: Miyoung Shin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1077913}
diff --git a/content/browser/renderer_host/frame_tree_node.cc b/content/browser/renderer_host/frame_tree_node.cc
index d326fcf..c6bafa8 100644
--- a/content/browser/renderer_host/frame_tree_node.cc
+++ b/content/browser/renderer_host/frame_tree_node.cc
@@ -1030,4 +1030,11 @@
       std::move(subresource_web_bundle_navigation_info), http_response_code);
 }
 
+void FrameTreeNode::CancelNavigation() {
+  if (navigation_request() && navigation_request()->IsNavigationStarted()) {
+    navigation_request()->set_net_error(net::ERR_ABORTED);
+  }
+  ResetNavigationRequest(NavigationDiscardReason::kCancelled);
+}
+
 }  // namespace content