1 From 5a8d9996ee7b3ce77f7b3fd3c7839806a034ea16 Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Tue, 4 Jul 2023 12:10:41 +0200
4 Subject: [PATCH 08/10] Allow passing the app_id on widget creation
7 include/views/cef_window.h | 6 ++++++
8 libcef/browser/views/window_impl.cc | 13 +++++++++----
9 libcef/browser/views/window_impl.h | 6 ++++--
10 libcef/browser/views/window_view.cc | 3 ++-
11 libcef/browser/views/window_view.h | 2 +-
12 5 files changed, 22 insertions(+), 8 deletions(-)
14 diff --git a/include/views/cef_window.h b/include/views/cef_window.h
15 index 9f196a1e7..16c854b09 100644
16 --- a/include/views/cef_window.h
17 +++ b/include/views/cef_window.h
18 @@ -65,6 +65,12 @@ class CefWindow : public CefPanel {
19 CefRefPtr<CefWindowDelegate> delegate);
22 + /// Create a new Window with the provided ID
25 + static CefRefPtr<CefWindow> CreateTopLevelWindowWithId(
26 + CefRefPtr<CefWindowDelegate> delegate, const CefString& app_id);
31 diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc
32 index 12858364e..f0fe9dfb2 100644
33 --- a/libcef/browser/views/window_impl.cc
34 +++ b/libcef/browser/views/window_impl.cc
35 @@ -110,14 +110,19 @@ CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindow(
36 return CefWindowImpl::Create(delegate, gfx::kNullAcceleratedWidget);
39 +CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindowWithId(
40 + CefRefPtr<CefWindowDelegate> delegate, const CefString& app_id) {
41 + return CefWindowImpl::Create(delegate, gfx::kNullAcceleratedWidget, app_id);
45 CefRefPtr<CefWindowImpl> CefWindowImpl::Create(
46 CefRefPtr<CefWindowDelegate> delegate,
47 - gfx::AcceleratedWidget parent_widget) {
48 + gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
49 CEF_REQUIRE_UIT_RETURN(nullptr);
50 CefRefPtr<CefWindowImpl> window = new CefWindowImpl(delegate);
52 - window->CreateWidget(parent_widget);
53 + window->CreateWidget(parent_widget, app_id);
57 @@ -745,10 +750,10 @@ void CefWindowImpl::InitializeRootView() {
58 static_cast<CefWindowView*>(root_view())->Initialize();
61 -void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
62 +void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
65 - root_view()->CreateWidget(parent_widget);
66 + root_view()->CreateWidget(parent_widget, app_id);
67 widget_ = root_view()->GetWidget();
70 diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
71 index aaca3c281..1c5be736f 100644
72 --- a/libcef/browser/views/window_impl.h
73 +++ b/libcef/browser/views/window_impl.h
74 @@ -36,7 +36,8 @@ class CefWindowImpl
75 // Create a new CefWindow instance. |delegate| may be nullptr. |parent_widget|
76 // will be used when creating a Chrome child window.
77 static CefRefPtr<CefWindowImpl> Create(CefRefPtr<CefWindowDelegate> delegate,
78 - gfx::AcceleratedWidget parent_widget);
79 + gfx::AcceleratedWidget parent_widget,
80 + const CefString& app_id = "");
84 @@ -157,7 +158,8 @@ class CefWindowImpl
85 void InitializeRootView() override;
87 // Initialize the Widget.
88 - void CreateWidget(gfx::AcceleratedWidget parent_widget);
89 + void CreateWidget(gfx::AcceleratedWidget parent_widget,
90 + const CefString& app_id = "");
92 views::Widget* widget_ = nullptr;
94 diff --git a/libcef/browser/views/window_view.cc b/libcef/browser/views/window_view.cc
95 index 2331caaea..5e4cb6b53 100644
96 --- a/libcef/browser/views/window_view.cc
97 +++ b/libcef/browser/views/window_view.cc
98 @@ -371,7 +371,7 @@ CefWindowView::CefWindowView(CefWindowDelegate* cef_delegate,
99 DCHECK(window_delegate_);
102 -void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
103 +void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
104 DCHECK(!GetWidget());
106 // |widget| is owned by the NativeWidget and will be destroyed in response to
107 @@ -381,6 +381,7 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
109 views::Widget::InitParams params;
110 params.delegate = this;
111 + params.wayland_app_id = app_id;
113 views::Widget* host_widget = nullptr;
115 diff --git a/libcef/browser/views/window_view.h b/libcef/browser/views/window_view.h
116 index b065f3700..c15e75d65 100644
117 --- a/libcef/browser/views/window_view.h
118 +++ b/libcef/browser/views/window_view.h
119 @@ -52,7 +52,7 @@ class CefWindowView
120 CefWindowView& operator=(const CefWindowView&) = delete;
122 // Create the Widget.
123 - void CreateWidget(gfx::AcceleratedWidget parent_widget);
124 + void CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id);
126 // Returns the CefWindow associated with this view. See comments on
127 // CefViewView::GetCefView.