#include "content/browser/renderer_host/navigation_transitions/navigation_transition_utils.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/navigation_transitions/navigation_entry_screenshot.h"
#include "content/browser/renderer_host/navigation_transitions/navigation_entry_screenshot_cache.h"
#include "content/browser/renderer_host/navigation_transitions/navigation_transition_config.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "ui/gfx/animation/animation.h"
#if BUILDFLAG(IS_ANDROID)
#include "content/browser/renderer_host/compositor_impl_android.h"
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
#endif
namespace content {
namespace {
CacheHitOrMissReason;
static gfx::Size g_output_size_for_test = …;
static int g_num_copy_requests_issued_for_testing = …;
NavigationTransitionUtils::ScreenshotCallback& GetTestScreenshotCallback() { … }
void InvokeTestCallbackForNoScreenshot(
const NavigationRequest& navigation_request) { … }
void InvokeTestCallback(int index,
const SkBitmap bitmap,
bool requested,
SkBitmap& override_bitmap) { … }
bool SupportsETC1NonPowerOfTwo(const NavigationRequest& navigation_request) { … }
NavigationEntryImpl* GetEntryForToken(
NavigationControllerImpl* controller,
const blink::SameDocNavigationScreenshotDestinationToken&
destination_token) { … }
void CacheScreenshotImpl(base::WeakPtr<NavigationControllerImpl> controller,
base::WeakPtr<NavigationRequest> navigation_request,
int navigation_entry_id,
bool is_copied_from_embedder,
int copy_output_request_sequence,
bool supports_etc_non_power_of_two,
const SkBitmap& bitmap) { … }
bool CanTraverseToPreviousEntryAfterNavigation(
const NavigationRequest& navigation_request) { … }
bool CanInitiateCaptureForNavigationStage(
const NavigationRequest& navigation_request,
bool did_receive_commit_ack) { … }
void RemoveScreenshotFromDestination(
NavigationControllerImpl& navigation_controller,
NavigationEntry* destination_entry) { … }
}
void NavigationTransitionUtils::SetCapturedScreenshotSizeForTesting(
const gfx::Size& size) { … }
int NavigationTransitionUtils::GetNumCopyOutputRequestIssuedForTesting() { … }
void NavigationTransitionUtils::ResetNumCopyOutputRequestIssuedForTesting() { … }
void NavigationTransitionUtils::SetNavScreenshotCallbackForTesting(
ScreenshotCallback screenshot_callback) { … }
bool NavigationTransitionUtils::
CaptureNavigationEntryScreenshotForCrossDocumentNavigations(
NavigationRequest& navigation_request,
bool did_receive_commit_ack) { … }
void NavigationTransitionUtils::SetSameDocumentNavigationEntryScreenshotToken(
NavigationRequest& navigation_request,
std::optional<blink::SameDocNavigationScreenshotDestinationToken>
destination_token) { … }
}