diff --git content/public/browser/frame_service_base.h content/public/browser/frame_service_base.h index af3218d8f6462..da6880cc57e90 100644 --- content/public/browser/frame_service_base.h +++ content/public/browser/frame_service_base.h @@ -83,6 +83,8 @@ class FrameServiceBase : public Interface, public WebContentsObserver { void DidFinishNavigation(NavigationHandle* navigation_handle) final { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (!ShouldCloseOnFinishNavigation()) + return; if (!navigation_handle->HasCommitted() || navigation_handle->IsSameDocument() || @@ -96,6 +98,9 @@ class FrameServiceBase : public Interface, public WebContentsObserver { } } + // Used for CEF bindings that outlive navigation. + virtual bool ShouldCloseOnFinishNavigation() const { return true; } + // Stops observing WebContents and delete |this|. void Close() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);