chromium/chrome/renderer/web_link_preview_triggerer_impl.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_RENDERER_WEB_LINK_PREVIEW_TRIGGERER_IMPL_H_
#define CHROME_RENDERER_WEB_LINK_PREVIEW_TRIGGERER_IMPL_H_

#include "base/timer/timer.h"
#include "third_party/blink/public/web/web_link_preview_triggerer.h"

// Creates appropriate WebLinkPreviewTriggerer depending on feature flag and
// params.
std::unique_ptr<blink::WebLinkPreviewTriggerer> CreateWebLinkPreviewTriggerer();

// Observes events in frame and triggers Link Preview: Alt+hover trigger.
//
// This class tracks the state "is Alt key pressed" and mouse hovered anchor
// element. Alt key tracking is done by observing modifiers for each keyboard
// events and mouse leave event. See the comment of `last_key_event_modifiers_`
// for more details and limitations.
class WebLinkPreviewTriggererAltHover final
    : public blink::WebLinkPreviewTriggerer {};

// Observes events in frame and triggers Link Preview: Long press trigger.
class WebLinkPreviewTriggererLongPress final
    : public blink::WebLinkPreviewTriggerer {};

#endif  // CHROME_RENDERER_WEB_LINK_PREVIEW_TRIGGERER_IMPL_H_