2023-02-28 19:34:12 +01:00
|
|
|
// Copyright 2023 The Chromium Embedded Framework 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_VIEWS_NATIVE_WIDGET_MAC_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
|
|
|
|
#pragma once
|
|
|
|
|
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/internal/cef_ptr.h"
|
2023-02-28 19:34:12 +01:00
|
|
|
#include "ui/views/widget/native_widget_mac.h"
|
|
|
|
|
2023-04-18 23:20:44 +02:00
|
|
|
class BrowserView;
|
2023-03-16 18:19:50 +01:00
|
|
|
class CefWindow;
|
|
|
|
class CefWindowDelegate;
|
|
|
|
|
2023-02-28 19:34:12 +01:00
|
|
|
class CefNativeWidgetMac : public views::NativeWidgetMac {
|
|
|
|
public:
|
|
|
|
CefNativeWidgetMac(views::internal::NativeWidgetDelegate* delegate,
|
2023-03-16 18:19:50 +01:00
|
|
|
CefRefPtr<CefWindow> window,
|
|
|
|
CefWindowDelegate* window_delegate);
|
2023-02-28 19:34:12 +01:00
|
|
|
~CefNativeWidgetMac() override = default;
|
|
|
|
|
|
|
|
CefNativeWidgetMac(const CefNativeWidgetMac&) = delete;
|
|
|
|
CefNativeWidgetMac& operator=(const CefNativeWidgetMac&) = delete;
|
|
|
|
|
2023-04-18 23:20:44 +02:00
|
|
|
void SetBrowserView(BrowserView* browser_view);
|
|
|
|
|
2023-02-28 19:34:12 +01:00
|
|
|
// NativeWidgetMac:
|
2023-04-18 23:20:44 +02:00
|
|
|
void ValidateUserInterfaceItem(
|
|
|
|
int32_t command,
|
|
|
|
remote_cocoa::mojom::ValidateUserInterfaceItemResult* result) override;
|
|
|
|
bool WillExecuteCommand(int32_t command,
|
|
|
|
WindowOpenDisposition window_open_disposition,
|
|
|
|
bool is_before_first_responder) override;
|
|
|
|
bool ExecuteCommand(int32_t command,
|
|
|
|
WindowOpenDisposition window_open_disposition,
|
|
|
|
bool is_before_first_responder) override;
|
2023-02-28 19:34:12 +01:00
|
|
|
NativeWidgetMacNSWindow* CreateNSWindow(
|
|
|
|
const remote_cocoa::mojom::CreateWindowParams* params) override;
|
|
|
|
void GetWindowFrameTitlebarHeight(bool* override_titlebar_height,
|
|
|
|
float* titlebar_height) override;
|
2023-04-20 16:59:15 +02:00
|
|
|
void OnWindowFullscreenTransitionStart() override;
|
|
|
|
void OnWindowFullscreenTransitionComplete() override;
|
2023-04-18 23:20:44 +02:00
|
|
|
void OnWindowInitialized() override;
|
2023-02-28 19:34:12 +01:00
|
|
|
|
|
|
|
private:
|
2023-03-16 18:19:50 +01:00
|
|
|
const CefRefPtr<CefWindow> window_;
|
2024-05-11 17:48:38 +02:00
|
|
|
const raw_ptr<CefWindowDelegate> window_delegate_;
|
2023-04-18 23:20:44 +02:00
|
|
|
|
2023-09-25 21:40:17 +02:00
|
|
|
// Returns true if the CefWindow is fully initialized.
|
|
|
|
bool IsCefWindowInitialized() const;
|
|
|
|
|
2024-05-13 23:36:09 +02:00
|
|
|
raw_ptr<BrowserView, AcrossTasksDanglingUntriaged> browser_view_ = nullptr;
|
2024-10-15 19:58:23 +02:00
|
|
|
bool initialized_ = false;
|
2023-02-28 19:34:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
|