LinkPreview: Implement preview activation baseline
This patch introduces a content public interface to activate
a preview page. The API tells the RenderViewHost to send an
IPC to relevant renderers, and each render runs the prerendering
activation algorithm and results in document.prerendering state
update, and running queued tasks, such as resolving promises,
releasing AudioContext, etc.
Bug: 305000959
Change-Id: I608a7f1beeda084fc5c4b77937534eeb009fa64b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4951222
Commit-Queue: Takashi Toyoshima <[email protected]>
Reviewed-by: Ken Okada <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Kouhei Ueno <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1213896}
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index b4c66b7..7e7455ce 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -1413,6 +1413,13 @@
virtual void SetTabSwitchStartTime(base::TimeTicks start_time,
bool destination_is_loaded) = 0;
+ // Activates the primary page that is shown in preview mode. This will relax
+ // capability restriction in the browser process, and notify the renderer to
+ // process the prerendering activation algorithm.
+ // Should be called while WebContentsDelegate::IsInPreviewMode returns true.
+ virtual void ActivatePreviewPage(base::TimeTicks activation_start,
+ base::OnceClosure completion_callback) = 0;
+
// Starts an embedder triggered (browser-initiated) prerendering page and
// returns the unique_ptr<PrerenderHandle>, which cancels prerendering on its
// destruction. If the prerendering failed to start (e.g. if prerendering is