// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_PRELOADING_PRERENDER_PRERENDER_NEW_TAB_HANDLE_H_ #define CONTENT_BROWSER_PRELOADING_PRERENDER_PRERENDER_NEW_TAB_HANDLE_H_ #include <memory> #include "content/browser/preloading/preloading_confidence.h" #include "content/browser/preloading/prerender/prerender_attributes.h" #include "content/common/frame.mojom-forward.h" #include "content/public/browser/prerender_web_contents_delegate.h" #include "content/public/browser/render_frame_host.h" namespace content { class BrowserContext; class PrerenderCancellationReason; class PrerenderHost; class PrerenderHostRegistry; class WebContentsImpl; // PrerenderNewTabHandle creates a new WebContentsImpl instance, starts // prerendering on that, and keeps the instance until the prerendered page is // activated for navigation or cancelled for some reason. By starting // prerendering in a new WebContentsImpl instance, this can serve a prerendered // page to navigation in a new tab different from a tab of the page that // triggered prerendering. // // PrerenderHostRegistry instantiates and owns PrerenderNewTabHandle in response // to prerendering requests via Speculation Rules API. When navigation is about // to start for a new tab, the navigation asks PrerenderHostRegistry if there is // a PrerenderNewTabHandle instance that has a pre-created WebContentsImpl // suitable for this navigation. If it's found, the navigation takes over the // ownership of the pre-created WebContentsImpl instance and destroys the // handle. class PrerenderNewTabHandle { … }; } // namespace content #endif // CONTENT_BROWSER_PRELOADING_PRERENDER_PRERENDER_NEW_TAB_HANDLE_H_