2015-11-17 19:20:13 +01:00
|
|
|
// Copyright (c) 2015 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2023-01-30 18:43:54 +01:00
|
|
|
#include "base/functional/callback_forward.h"
|
2024-05-11 17:48:38 +02:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/cef_client.h"
|
|
|
|
#include "cef/include/cef_drag_data.h"
|
|
|
|
#include "cef/include/internal/cef_types.h"
|
|
|
|
#include "cef/include/views/cef_browser_view.h"
|
2024-04-30 03:09:17 +02:00
|
|
|
#include "cef/libcef/features/features.h"
|
2020-10-08 21:54:42 +02:00
|
|
|
#include "third_party/blink/public/common/page/drag_operation.h"
|
2021-10-19 00:17:16 +02:00
|
|
|
#include "third_party/blink/public/mojom/drag/drag.mojom-forward.h"
|
2020-09-25 03:40:47 +02:00
|
|
|
#include "third_party/skia/include/core/SkColor.h"
|
2021-01-28 00:13:12 +01:00
|
|
|
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
|
2020-09-25 03:40:47 +02:00
|
|
|
#include "ui/base/window_open_disposition.h"
|
|
|
|
|
2024-04-30 03:09:17 +02:00
|
|
|
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
|
|
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
|
|
|
#endif
|
|
|
|
|
2020-09-25 03:40:47 +02:00
|
|
|
class GURL;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
namespace blink {
|
2020-09-25 03:40:47 +02:00
|
|
|
class WebGestureEvent;
|
2015-11-17 19:20:13 +01:00
|
|
|
class WebMouseEvent;
|
|
|
|
class WebMouseWheelEvent;
|
|
|
|
class WebInputEvent;
|
2019-02-25 22:17:28 +01:00
|
|
|
class WebTouchEvent;
|
2022-09-26 21:30:45 +02:00
|
|
|
|
|
|
|
namespace mojom {
|
|
|
|
class WindowFeatures;
|
|
|
|
}
|
2018-05-17 10:58:21 +02:00
|
|
|
} // namespace blink
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
namespace content {
|
2020-09-25 03:40:47 +02:00
|
|
|
struct DropData;
|
2015-11-17 19:20:13 +01:00
|
|
|
class RenderViewHost;
|
|
|
|
class RenderViewHostDelegateView;
|
2020-09-25 03:40:47 +02:00
|
|
|
class RenderWidgetHostImpl;
|
|
|
|
class WebContents;
|
2015-11-17 19:20:13 +01:00
|
|
|
class WebContentsView;
|
2018-05-17 10:58:21 +02:00
|
|
|
} // namespace content
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2024-04-30 03:09:17 +02:00
|
|
|
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
2020-07-03 22:13:27 +02:00
|
|
|
namespace extensions {
|
2020-09-25 03:40:47 +02:00
|
|
|
class Extension;
|
2020-07-03 22:13:27 +02:00
|
|
|
class ExtensionHost;
|
2020-09-25 03:40:47 +02:00
|
|
|
} // namespace extensions
|
2024-04-30 03:09:17 +02:00
|
|
|
#endif
|
2020-09-25 03:40:47 +02:00
|
|
|
|
|
|
|
namespace gfx {
|
|
|
|
class ImageSkia;
|
|
|
|
class Point;
|
|
|
|
class Rect;
|
|
|
|
class Size;
|
|
|
|
class Vector2d;
|
|
|
|
} // namespace gfx
|
2020-07-03 22:13:27 +02:00
|
|
|
|
2024-06-14 19:01:45 +02:00
|
|
|
namespace input {
|
|
|
|
struct NativeWebKeyboardEvent;
|
|
|
|
}
|
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
namespace ui {
|
|
|
|
struct AXLocationChanges;
|
|
|
|
struct AXUpdatesAndEvents;
|
|
|
|
} // namespace ui
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
namespace views {
|
|
|
|
class Widget;
|
|
|
|
}
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
namespace web_modal {
|
|
|
|
class WebContentsModalDialogHost;
|
|
|
|
}
|
|
|
|
|
2020-09-25 03:40:47 +02:00
|
|
|
struct CefBrowserCreateParams;
|
|
|
|
class CefBrowserHostBase;
|
2015-11-17 19:20:13 +01:00
|
|
|
class CefJavaScriptDialogRunner;
|
|
|
|
class CefMenuRunner;
|
|
|
|
|
|
|
|
// Provides platform-specific implementations of browser functionality. All
|
|
|
|
// methods are called on the browser process UI thread unless otherwise
|
|
|
|
// indicated.
|
|
|
|
class CefBrowserPlatformDelegate {
|
|
|
|
public:
|
2021-12-06 21:40:25 +01:00
|
|
|
CefBrowserPlatformDelegate(const CefBrowserPlatformDelegate&) = delete;
|
|
|
|
CefBrowserPlatformDelegate& operator=(const CefBrowserPlatformDelegate&) =
|
|
|
|
delete;
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Create a new CefBrowserPlatformDelegate instance. May be called on multiple
|
|
|
|
// threads.
|
2016-04-27 22:38:52 +02:00
|
|
|
static std::unique_ptr<CefBrowserPlatformDelegate> Create(
|
2020-09-25 03:40:47 +02:00
|
|
|
const CefBrowserCreateParams& create_params);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Called from BrowserHost::Create.
|
2020-07-03 22:13:27 +02:00
|
|
|
// Wait for the call to WebContentsCreated(owned=true) before taking ownership
|
|
|
|
// of the resulting WebContents object.
|
|
|
|
virtual content::WebContents* CreateWebContents(
|
2020-09-25 03:40:47 +02:00
|
|
|
CefBrowserCreateParams& create_params,
|
|
|
|
bool& own_web_contents);
|
2020-07-03 22:13:27 +02:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Called to create the view objects for a new WebContents. Will only be
|
|
|
|
// called a single time per instance. May be called on multiple threads. Only
|
|
|
|
// used with windowless rendering.
|
|
|
|
virtual void CreateViewForWebContents(
|
|
|
|
content::WebContentsView** view,
|
|
|
|
content::RenderViewHostDelegateView** delegate_view);
|
|
|
|
|
2020-07-03 22:13:27 +02:00
|
|
|
// Called after the WebContents for a browser has been created. |owned| will
|
|
|
|
// be true if |web_contents| was created via CreateWebContents() and we should
|
|
|
|
// take ownership. This will also be called for popup WebContents created
|
|
|
|
// indirectly by Chromium. Will only be called a single time per instance.
|
|
|
|
virtual void WebContentsCreated(content::WebContents* web_contents,
|
|
|
|
bool owned);
|
|
|
|
|
|
|
|
// Called when Chromium is ready to hand over ownership of a popup
|
|
|
|
// WebContents. WebContentsCreated(owned=false) will be called first for
|
|
|
|
// |new_contents|. Will only be called a single time per instance. See also
|
|
|
|
// the WebContentsDelegate documentation.
|
|
|
|
virtual void AddNewContents(
|
|
|
|
content::WebContents* source,
|
|
|
|
std::unique_ptr<content::WebContents> new_contents,
|
|
|
|
const GURL& target_url,
|
|
|
|
WindowOpenDisposition disposition,
|
2022-09-26 21:30:45 +02:00
|
|
|
const blink::mojom::WindowFeatures& window_features,
|
2020-07-03 22:13:27 +02:00
|
|
|
bool user_gesture,
|
|
|
|
bool* was_blocked);
|
|
|
|
|
2020-07-04 04:51:17 +02:00
|
|
|
// Called when the WebContents is destroyed. This will be called before
|
|
|
|
// BrowserDestroyed(). Will only be called a single time per instance.
|
|
|
|
virtual void WebContentsDestroyed(content::WebContents* web_contents);
|
|
|
|
|
2024-04-30 03:09:17 +02:00
|
|
|
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
2020-07-03 22:13:27 +02:00
|
|
|
// See WebContentsDelegate documentation.
|
2021-07-23 18:40:13 +02:00
|
|
|
virtual bool ShouldAllowRendererInitiatedCrossProcessNavigation(
|
|
|
|
bool is_main_frame_navigation);
|
2024-04-30 03:09:17 +02:00
|
|
|
#endif
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Called after the RenderViewHost is created.
|
2017-05-17 11:29:28 +02:00
|
|
|
virtual void RenderViewCreated(content::RenderViewHost* render_view_host);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2020-07-04 20:21:34 +02:00
|
|
|
// See WebContentsObserver documentation.
|
|
|
|
virtual void RenderViewReady();
|
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Called after the owning BrowserHost is created. Will only be
|
2020-09-22 21:54:02 +02:00
|
|
|
// called a single time per instance. Do not send any client notifications
|
|
|
|
// from this method.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual void BrowserCreated(CefBrowserHostBase* browser);
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2024-04-30 03:09:17 +02:00
|
|
|
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
2024-04-17 18:01:26 +02:00
|
|
|
// Called from BrowserHost::Create.
|
2020-07-04 20:21:34 +02:00
|
|
|
virtual void CreateExtensionHost(const extensions::Extension* extension,
|
|
|
|
const GURL& url,
|
2021-04-21 00:52:34 +02:00
|
|
|
extensions::mojom::ViewType host_type);
|
2020-07-04 20:21:34 +02:00
|
|
|
|
|
|
|
// Returns the current extension host.
|
|
|
|
virtual extensions::ExtensionHost* GetExtensionHost() const;
|
2024-04-30 03:09:17 +02:00
|
|
|
#endif
|
2020-07-03 22:13:27 +02:00
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Send any notifications related to browser creation. Called after
|
|
|
|
// BrowserCreated().
|
|
|
|
virtual void NotifyBrowserCreated();
|
|
|
|
|
|
|
|
// Send any notifications related to browser destruction. Called before
|
|
|
|
// BrowserDestroyed().
|
|
|
|
virtual void NotifyBrowserDestroyed();
|
2017-05-17 11:29:28 +02:00
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Called before the owning BrowserHost is destroyed. Will only be
|
2020-09-22 21:54:02 +02:00
|
|
|
// called a single time per instance. All references to the
|
2024-04-17 18:01:26 +02:00
|
|
|
// BrowserHost and WebContents should be cleared when this method is
|
2020-09-22 21:54:02 +02:00
|
|
|
// called. Do not send any client notifications from this method.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual void BrowserDestroyed(CefBrowserHostBase* browser);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Create the window that hosts the browser. Will only be called a single time
|
|
|
|
// per instance. Only used with windowed rendering.
|
|
|
|
virtual bool CreateHostWindow();
|
|
|
|
|
|
|
|
// Sends a message to close the window that hosts the browser. On native
|
|
|
|
// platforms this will be done via the OS. DestroyBrowser will be called after
|
|
|
|
// the native window has closed. Only used with windowed rendering.
|
|
|
|
virtual void CloseHostWindow();
|
|
|
|
|
|
|
|
// Return the OS handle for the window that hosts the browser. For windowed
|
|
|
|
// rendering this will return the most immediate parent window handle. For
|
|
|
|
// windowless rendering this will return the parent window handle specified by
|
2017-05-17 11:29:28 +02:00
|
|
|
// the client, which may be NULL. May be called on multiple threads.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual CefWindowHandle GetHostWindowHandle() const;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Returns the Widget owner for the browser window. Only used with windowed
|
|
|
|
// rendering.
|
|
|
|
virtual views::Widget* GetWindowWidget() const;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Returns the BrowserView associated with this browser. Only used with Views-
|
2016-01-19 21:09:01 +01:00
|
|
|
// based browsers.
|
|
|
|
virtual CefRefPtr<CefBrowserView> GetBrowserView() const;
|
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Sets the BrowserView associated with this browser. Only used with
|
|
|
|
// Views-based browsers.
|
|
|
|
virtual void SetBrowserView(CefRefPtr<CefBrowserView> browser_view);
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
// Returns the WebContentsModalDialogHost associated with this browser.
|
|
|
|
virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
|
|
|
|
const;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Called after the WebContents have been created for a new popup browser
|
2024-04-17 18:01:26 +02:00
|
|
|
// parented to this browser but before the BrowserHost is created for the
|
|
|
|
// popup. |is_devtools| will be true if the popup will host DevTools. This
|
2016-01-19 21:09:01 +01:00
|
|
|
// method will be called before WebContentsCreated() is called on
|
2024-04-17 18:01:26 +02:00
|
|
|
// |new_platform_delegate|. Does not make the new browser visible in this
|
2016-01-19 21:09:01 +01:00
|
|
|
// callback.
|
2024-04-17 18:01:26 +02:00
|
|
|
void PopupWebContentsCreated(
|
2016-01-19 21:09:01 +01:00
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
CefRefPtr<CefClient> client,
|
|
|
|
content::WebContents* new_web_contents,
|
|
|
|
CefBrowserPlatformDelegate* new_platform_delegate,
|
|
|
|
bool is_devtools);
|
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Called after the BrowserHost is created for a new popup browser parented to
|
|
|
|
// this browser. |is_devtools| will be true if the popup will host DevTools.
|
|
|
|
// This method will be called immediately after
|
2016-01-19 21:09:01 +01:00
|
|
|
// CefLifeSpanHandler::OnAfterCreated() for the popup browser. It is safe to
|
|
|
|
// make the new browser visible in this callback (for example, add the browser
|
|
|
|
// to a window and show it).
|
2024-04-17 18:01:26 +02:00
|
|
|
void PopupBrowserCreated(CefBrowserPlatformDelegate* new_platform_delegate,
|
|
|
|
CefBrowserHostBase* new_browser,
|
|
|
|
bool is_devtools);
|
|
|
|
|
|
|
|
// Called from PopupWebContentsCreated/PopupBrowserCreated to retrieve the
|
|
|
|
// default BrowserViewDelegate in cases where this is a new Views-based popup
|
|
|
|
// and the opener is either not Views-based or doesn't implement the
|
|
|
|
// BrowserViewDelegate. Only implemented for specific configurations where
|
|
|
|
// special handling of new popups is required for proper functioning.
|
|
|
|
virtual CefRefPtr<CefBrowserViewDelegate>
|
|
|
|
GetDefaultBrowserViewDelegateForPopupOpener();
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
// Returns the background color for the browser. The alpha component will be
|
|
|
|
// either SK_AlphaTRANSPARENT or SK_AlphaOPAQUE (e.g. fully transparent or
|
|
|
|
// fully opaque). SK_AlphaOPAQUE will always be returned for windowed
|
|
|
|
// browsers. SK_ColorTRANSPARENT may be returned for windowless browsers to
|
|
|
|
// enable transparency.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual SkColor GetBackgroundColor() const;
|
2017-04-20 21:28:17 +02:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Notify the window that it was resized.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual void WasResized();
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Send input events.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual void SendKeyEvent(const CefKeyEvent& event);
|
2020-01-23 22:58:01 +01:00
|
|
|
virtual void SendMouseClickEvent(const CefMouseEvent& event,
|
|
|
|
CefBrowserHost::MouseButtonType type,
|
|
|
|
bool mouseUp,
|
2020-09-25 03:40:47 +02:00
|
|
|
int clickCount);
|
|
|
|
virtual void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave);
|
2020-01-23 22:58:01 +01:00
|
|
|
virtual void SendMouseWheelEvent(const CefMouseEvent& event,
|
|
|
|
int deltaX,
|
2020-09-25 03:40:47 +02:00
|
|
|
int deltaY);
|
|
|
|
virtual void SendTouchEvent(const CefTouchEvent& event);
|
2019-02-25 22:17:28 +01:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Send focus event. The browser's WebContents may be NULL when this method is
|
|
|
|
// called.
|
2021-09-27 09:50:07 +02:00
|
|
|
virtual void SetFocus(bool setFocus);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Send capture lost event.
|
|
|
|
virtual void SendCaptureLostEvent();
|
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
|
2015-11-17 19:20:13 +01:00
|
|
|
// The window hosting the browser is about to be moved or resized. Only used
|
|
|
|
// on Windows and Linux.
|
|
|
|
virtual void NotifyMoveOrResizeStarted();
|
|
|
|
|
|
|
|
// Resize the host window to the given dimensions. Only used with windowed
|
|
|
|
// rendering on Windows and Linux.
|
|
|
|
virtual void SizeTo(int width, int height);
|
|
|
|
#endif
|
|
|
|
|
2022-05-13 13:38:41 +02:00
|
|
|
// Convert from view DIP coordinates to screen coordinates. If
|
|
|
|
// |want_dip_coords| is true return DIP instead of device (pixel) coordinates
|
|
|
|
// on Windows/Linux.
|
|
|
|
virtual gfx::Point GetScreenPoint(const gfx::Point& view,
|
|
|
|
bool want_dip_coords) const;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Open the specified text in the default text editor.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual void ViewText(const std::string& text);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Forward the keyboard event to the application or frame window to allow
|
|
|
|
// processing of shortcut keys.
|
2024-06-14 19:01:45 +02:00
|
|
|
virtual bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2024-04-30 03:09:17 +02:00
|
|
|
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
2020-07-03 22:13:27 +02:00
|
|
|
// See WebContentsDelegate documentation.
|
|
|
|
virtual bool PreHandleGestureEvent(content::WebContents* source,
|
|
|
|
const blink::WebGestureEvent& event);
|
|
|
|
|
|
|
|
// See WebContentsDelegate documentation.
|
|
|
|
virtual bool IsNeverComposited(content::WebContents* web_contents);
|
2024-04-30 03:09:17 +02:00
|
|
|
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
2020-07-03 22:13:27 +02:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Invoke platform specific handling for the external protocol.
|
2019-04-24 04:50:25 +02:00
|
|
|
static void HandleExternalProtocol(const GURL& url);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Returns the OS event handle, if any, associated with |event|.
|
|
|
|
virtual CefEventHandle GetEventHandle(
|
2024-06-14 19:01:45 +02:00
|
|
|
const input::NativeWebKeyboardEvent& event) const;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Create the platform-specific JavaScript dialog runner.
|
2017-05-17 11:29:28 +02:00
|
|
|
virtual std::unique_ptr<CefJavaScriptDialogRunner>
|
|
|
|
CreateJavaScriptDialogRunner();
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Create the platform-specific menu runner.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual std::unique_ptr<CefMenuRunner> CreateMenuRunner();
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Returns true if this delegate implements windowless rendering. May be
|
|
|
|
// called on multiple threads.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual bool IsWindowless() const;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Returns true if this delegate implements views-hosted browser handling. May
|
|
|
|
// be called on multiple threads.
|
2020-09-25 03:40:47 +02:00
|
|
|
virtual bool IsViewsHosted() const;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Returns the runtime style implemented by this delegate. May be called on
|
|
|
|
// multiple threads.
|
|
|
|
virtual bool IsAlloyStyle() const = 0;
|
|
|
|
bool IsChromeStyle() const { return !IsAlloyStyle(); }
|
|
|
|
|
2022-04-11 23:29:53 +02:00
|
|
|
// Returns true if this delegate implements a browser with external
|
|
|
|
// (client-provided) parent window. May be called on multiple threads.
|
|
|
|
virtual bool HasExternalParent() const;
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Notify the browser that it was hidden. Only used with windowless rendering.
|
|
|
|
virtual void WasHidden(bool hidden);
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
// Returns true if the browser is currently hidden. Only used with windowless
|
|
|
|
// rendering.
|
|
|
|
virtual bool IsHidden() const;
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Notify the browser that screen information has changed. Only used with
|
|
|
|
// windowless rendering.
|
|
|
|
virtual void NotifyScreenInfoChanged();
|
|
|
|
|
|
|
|
// Invalidate the view. Only used with windowless rendering.
|
|
|
|
virtual void Invalidate(cef_paint_element_type_t type);
|
|
|
|
|
2020-07-04 20:21:34 +02:00
|
|
|
// Send the external begin frame message. Only used with windowless rendering.
|
2018-07-03 02:46:03 +02:00
|
|
|
virtual void SendExternalBeginFrame();
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Set the windowless frame rate. Only used with windowless rendering.
|
|
|
|
virtual void SetWindowlessFrameRate(int frame_rate);
|
|
|
|
|
2016-10-28 18:11:24 +02:00
|
|
|
// IME-related callbacks. See documentation in CefBrowser and
|
|
|
|
// CefRenderHandler. Only used with windowless rendering.
|
|
|
|
virtual void ImeSetComposition(
|
|
|
|
const CefString& text,
|
|
|
|
const std::vector<CefCompositionUnderline>& underlines,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
const CefRange& selection_range);
|
|
|
|
virtual void ImeCommitText(const CefString& text,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
int relative_cursor_pos);
|
|
|
|
virtual void ImeFinishComposingText(bool keep_selection);
|
|
|
|
virtual void ImeCancelComposition();
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Drag/drop-related callbacks. See documentation in CefRenderHandler. Only
|
|
|
|
// used with windowless rendering.
|
|
|
|
virtual void DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
2017-05-17 11:29:28 +02:00
|
|
|
const CefMouseEvent& event,
|
|
|
|
cef_drag_operations_mask_t allowed_ops);
|
2015-11-17 19:20:13 +01:00
|
|
|
virtual void DragTargetDragOver(const CefMouseEvent& event,
|
|
|
|
cef_drag_operations_mask_t allowed_ops);
|
|
|
|
virtual void DragTargetDragLeave();
|
|
|
|
virtual void DragTargetDrop(const CefMouseEvent& event);
|
2020-10-08 21:54:42 +02:00
|
|
|
virtual void StartDragging(
|
|
|
|
const content::DropData& drop_data,
|
|
|
|
blink::DragOperationsMask allowed_ops,
|
|
|
|
const gfx::ImageSkia& image,
|
|
|
|
const gfx::Vector2d& image_offset,
|
|
|
|
const blink::mojom::DragEventSourceInfo& event_info,
|
|
|
|
content::RenderWidgetHostImpl* source_rwh);
|
2023-10-19 20:08:48 +02:00
|
|
|
virtual void UpdateDragOperation(ui::mojom::DragOperation operation,
|
|
|
|
bool document_is_handling_drag);
|
2017-05-17 11:29:28 +02:00
|
|
|
virtual void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op);
|
2015-11-17 19:20:13 +01:00
|
|
|
virtual void DragSourceSystemDragEnded();
|
2017-05-12 20:28:25 +02:00
|
|
|
virtual void AccessibilityEventReceived(
|
2024-05-23 03:52:35 +02:00
|
|
|
const ui::AXUpdatesAndEvents& details);
|
2017-05-12 20:28:25 +02:00
|
|
|
virtual void AccessibilityLocationChangesReceived(
|
2024-05-23 03:52:35 +02:00
|
|
|
const std::vector<ui::AXLocationChanges>& details);
|
2019-07-17 20:47:27 +02:00
|
|
|
virtual gfx::Point GetDialogPosition(const gfx::Size& size);
|
|
|
|
virtual gfx::Size GetMaximumDialogSize();
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2020-07-03 22:13:27 +02:00
|
|
|
// See CefBrowserHost documentation.
|
2020-07-04 20:21:34 +02:00
|
|
|
virtual void SetAutoResizeEnabled(bool enabled,
|
|
|
|
const CefSize& min_size,
|
|
|
|
const CefSize& max_size);
|
2020-07-03 22:13:27 +02:00
|
|
|
virtual void SetAccessibilityState(cef_state_t accessibility_state);
|
|
|
|
virtual bool IsPrintPreviewSupported() const;
|
2022-02-17 19:17:29 +01:00
|
|
|
virtual void Find(const CefString& searchText,
|
2020-07-03 22:13:27 +02:00
|
|
|
bool forward,
|
|
|
|
bool matchCase,
|
|
|
|
bool findNext);
|
|
|
|
virtual void StopFinding(bool clearSelection);
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
protected:
|
2021-06-17 22:08:01 +02:00
|
|
|
// Allow deletion via std::unique_ptr only.
|
2015-12-09 17:10:16 +01:00
|
|
|
friend std::default_delete<CefBrowserPlatformDelegate>;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
CefBrowserPlatformDelegate();
|
|
|
|
virtual ~CefBrowserPlatformDelegate();
|
|
|
|
|
2023-06-01 16:06:15 +02:00
|
|
|
static int TranslateWebEventModifiers(uint32_t cef_modifiers);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2020-07-03 22:13:27 +02:00
|
|
|
// Not owned by this object.
|
2024-05-11 17:48:38 +02:00
|
|
|
raw_ptr<content::WebContents> web_contents_ = nullptr;
|
|
|
|
raw_ptr<CefBrowserHostBase> browser_ = nullptr;
|
2015-11-17 19:20:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_
|