chore: bump chromium to 122.0.6194.0 (29-x-y) (#40872)

* chore: bump chromium in DEPS to 122.0.6180.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update render_widget_host_view_base.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5079532

minor manual changes to match upstream changes

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update printing.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5094777

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5054299

Update patch to upstream changes in print_view_manager_base.cc.
CC @codebytere for 👀

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update feat_add_onclose_to_messageport.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5083156

no manual changes; patch applied with fuzz 1

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update build_do_not_depend_on_packed_resource_integrity.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5087072

minor manual changes to match upstream changes

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update port_autofill_colors_to_the_color_pipeline.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4960481

no manual changes; patch applied with fuzz 2

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update revert_api_dcheck-fail_when_we_reenter_v8_while_terminating.patch

Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5076902
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5096253

The `bailout_value` variable, which allowed us to fail gracefully in
these macros, has been removed upstream. This raises the temperature
on https://github.com/electron/electron/issues/40741 ...

Since we don't have a bailout value, return a default-constructed
instance of whatever the return type is of the function that invokes
the macro.

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* Remove performActionOnRemotePage

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5068017

It appears it is not used by anything within Chromium or outside.

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* perf: in SubmenuButton ctor, move() the PressedCallback

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5066872

The copy construtor is more expensive and has been removed upstream

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update constructor call for ElectronExtensionsRendererClient::dispatcher_

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5055146

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: handle CAPTURED_SURFACE_CONTROL in Converter<blink::PermissionType>::ToV8()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5096614

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: e patches all

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: bump chromium to 122.0.6181.0

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: e patches all

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: Add lookup for per-RenderFrame SpellCheckProvider

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5075094

Previously we could pass a routing ID into the spellcheck methods.
This ID arg has been replaced with a SpellCheckHost& arg.

We can get the SpellCheckHost from an accessor in SpellCheckProvider,
which was already being created on a per-render-frame basis in
RenderClientBase.

This commit adds a RenderFrame-to-SpellCheckProvider accessor
in RenderClientBase so that it can be used to get that needed
SpellCheckHost.

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: make lint happy

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: restore the will_cause_resize arg to WebContents::ExitFullscreen

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5074445

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5031312

upstream reverted this change

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: bump chromium in DEPS to 122.0.6182.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>

* chore: fix virtual function names that were renamed upstream

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5115241

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: handle new blink::PermissionType::SMART_CARD in PermissionType converter

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5049989

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: node script/gen-libc++-filenames.js

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! chore: update build_do_not_depend_on_packed_resource_integrity.patch

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: remove revert_api_dcheck-fail_when_we_reenter_v8_while_terminating.patch

The previous experiment of removing the DCHECK in 35093783 was a huge
failure. We either need to either:

A) use upstream as-is and fix the DCHECK failure, or
B) revert https://chromium-review.googlesource.com/c/v8/v8/+/5076902 too
C) find some other workaround

This commit is the first half of option A, removing the patch to use
upstream as-is.

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: bump chromium in DEPS to 122.0.6184.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 122.0.6186.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore; update mas_avoid_private_macos_api_usage.patch.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5085619

minor manual changes to match upstream changes

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update build_do_not_depend_on_packed_resource_integrity.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5120922

minor manual changes to match upstream changes

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update fix_move_autopipsettingshelper_behind_branding_buildflag.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5041595

no manual changes; patch applied with fuzz 1

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: e patches all

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: add refactor_update_node-platform_to_match_v8-platform_api_changes.patch

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: bump chromium in DEPS to 122.0.6188.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 122.0.6190.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 122.0.6192.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 122.0.6194.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* Remove an unnecessary DCHECK which causes Lacros to crash.

https://chromium-review.googlesource.com/c/chromium/src/+/5124880

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Add shared regular profile function that includes ash

https://chromium-review.googlesource.com/c/chromium/src/+/5100709

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Simplify the PrintManagerHost::ScriptedPrint() call

https://chromium-review.googlesource.com/c/chromium/src/+/5019703

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Add tests

https://chromium-review.googlesource.com/c/chromium/src/+/5024173

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fixup! chore: add refactor_update_node-platform_to_match_v8-platform_api_changes.patch

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: node script/gen-libc++-filenames.js

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Remove //ui/ozone/buildflags.h

https://chromium-review.googlesource.com/c/chromium/src/+/5119048

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fixup! Remove //ui/ozone/buildflags.h

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fixup! Remove //ui/ozone/buildflags.h

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fixup! refactor: Add lookup for per-RenderFrame SpellCheckProvider

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fixup! Remove //ui/ozone/buildflags.h

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Add permission policy verification in PermissionControllerImpl

https://chromium-review.googlesource.com/c/chromium/src/+/5059112

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fix: ensure spellcheck interface is registered for frame

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Unify pending and scheduled exceptions

https://chromium-review.googlesource.com/c/v8/v8/+/5050065

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fix: dchecks in node.js tests

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fix: try adding termination check

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: document breaking iframe change

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: update patches after trop

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
trop[bot]
2024-01-04 16:17:50 -05:00
committed by GitHub
parent ce7e0afd0a
commit e1ec17d641
104 changed files with 977 additions and 871 deletions

View File

@@ -246,7 +246,7 @@ void BrowserWindow::OnWindowIsKeyChanged(bool is_key) {
void BrowserWindow::OnWindowLeaveFullScreen() {
#if BUILDFLAG(IS_MAC)
if (web_contents()->IsFullscreen())
web_contents()->ExitFullscreen();
web_contents()->ExitFullscreen(true);
#endif
BaseWindow::OnWindowLeaveFullScreen();
}

View File

@@ -25,28 +25,20 @@
#include "shell/common/node_includes.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#if defined(USE_OZONE)
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#define USE_OZONE_PLATFORM_X11
#endif
#endif
#include "ui/base/ozone_buildflags.h"
#if BUILDFLAG(IS_WIN)
#include "third_party/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h"
#include "third_party/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h"
#include "ui/display/win/display_info.h"
#elif BUILDFLAG(IS_LINUX)
#if defined(USE_OZONE_PLATFORM_X11)
#elif BUILDFLAG(IS_OZONE_X11)
#include "base/logging.h"
#include "ui/base/x/x11_display_util.h"
#include "ui/base/x/x11_util.h"
#include "ui/display/util/edid_parser.h" // nogncheck
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/randr.h"
#endif // defined(USE_OZONE_PLATFORM_X11)
#endif // BUILDFLAG(IS_WIN)
#endif
#if BUILDFLAG(IS_LINUX)
// Private function in ui/base/x/x11_display_util.cc
@@ -388,8 +380,7 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
for (auto& source : screen_sources) {
source.display_id = base::NumberToString(source.media_list_source.id.id);
}
#elif BUILDFLAG(IS_LINUX)
#if defined(USE_OZONE_PLATFORM_X11)
#elif BUILDFLAG(IS_OZONE_X11)
// On Linux, with X11, the source id is the numeric value of the
// display name atom and the display id is either the EDID or the
// loop index when that display was found (see
@@ -402,8 +393,7 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
if (display_id_iter != monitor_atom_to_display_id.end())
source.display_id = base::NumberToString(display_id_iter->second);
}
#endif // defined(USE_OZONE_PLATFORM_X11)
#endif // BUILDFLAG(IS_WIN)
#endif
std::move(screen_sources.begin(), screen_sources.end(),
std::back_inserter(captured_sources_));
}

View File

@@ -76,8 +76,18 @@ gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
}
#endif
auto handle = gin::CreateHandle(args->isolate(),
new Tray(args->isolate(), image, guid));
// Error thrown by us will be dropped when entering V8.
// Make sure to abort early and propagate the error to JS.
// Refs https://chromium-review.googlesource.com/c/v8/v8/+/5050065
v8::TryCatch try_catch(args->isolate());
auto* tray = new Tray(args->isolate(), image, guid);
if (try_catch.HasCaught()) {
delete tray;
try_catch.ReThrow();
return gin::Handle<Tray>();
}
auto handle = gin::CreateHandle(args->isolate(), tray);
handle->Pin(args->isolate());
return handle;
}

View File

@@ -137,6 +137,7 @@
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" // nogncheck
#include "chrome/browser/spellchecker/spell_check_initialization_host_impl.h" // nogncheck
#include "components/spellcheck/common/spellcheck.mojom.h" // nogncheck
#endif
@@ -1530,9 +1531,10 @@ void ElectronBrowserClient::BindHostReceiverForRenderer(
content::RenderProcessHost* render_process_host,
mojo::GenericPendingReceiver receiver) {
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
if (auto host_receiver = receiver.As<spellcheck::mojom::SpellCheckHost>()) {
SpellCheckHostChromeImpl::Create(render_process_host->GetID(),
std::move(host_receiver));
if (auto host_receiver =
receiver.As<spellcheck::mojom::SpellCheckInitializationHost>()) {
SpellCheckInitializationHostImpl::Create(render_process_host->GetID(),
std::move(host_receiver));
return;
}
#endif
@@ -1589,6 +1591,14 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame(
base::BindRepeating(&badging::BadgeManager::BindFrameReceiver));
map->Add<blink::mojom::KeyboardLockService>(base::BindRepeating(
&content::KeyboardLockServiceImpl::CreateMojoService));
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
map->Add<spellcheck::mojom::SpellCheckHost>(base::BindRepeating(
[](content::RenderFrameHost* frame_host,
mojo::PendingReceiver<spellcheck::mojom::SpellCheckHost> receiver) {
SpellCheckHostChromeImpl::Create(frame_host->GetProcess()->GetID(),
std::move(receiver));
}));
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
map->Add<extensions::mime_handler::MimeHandlerService>(
base::BindRepeating(&BindMimeHandlerService));

View File

@@ -6,9 +6,10 @@
#include "base/command_line.h"
#include "base/environment.h"
#include "ui/base/ozone_buildflags.h"
#include "ui/ozone/public/ozone_switches.h"
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#if BUILDFLAG(IS_OZONE_WAYLAND)
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/nix/xdg_util.h"
@@ -18,7 +19,7 @@
constexpr base::StringPiece kElectronOzonePlatformHint(
"ELECTRON_OZONE_PLATFORM_HINT");
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#if BUILDFLAG(IS_OZONE_WAYLAND)
constexpr char kPlatformWayland[] = "wayland";
@@ -46,9 +47,9 @@ bool HasWaylandDisplay(base::Environment* env) {
return false;
}
#endif // BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#endif // BUILDFLAG(IS_OZONE_WAYLAND)
#if BUILDFLAG(OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_OZONE_X11)
constexpr char kPlatformX11[] = "x11";
#endif
@@ -64,7 +65,7 @@ namespace {
// returns "x11" if it is not.
// See https://crbug.com/1246928.
std::string MaybeFixPlatformName(const std::string& ozone_platform_hint) {
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#if BUILDFLAG(IS_OZONE_WAYLAND)
// Wayland is selected if both conditions below are true:
// 1. The user selected either 'wayland' or 'auto'.
// 2. The XDG session type is 'wayland', OR the user has selected 'wayland'
@@ -85,13 +86,13 @@ std::string MaybeFixPlatformName(const std::string& ozone_platform_hint) {
return kPlatformWayland;
}
}
#endif // BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#endif // BUILDFLAG(IS_OZONE_WAYLAND)
#if BUILDFLAG(OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_OZONE_X11)
if (ozone_platform_hint == kPlatformX11) {
return kPlatformX11;
}
#if BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#if BUILDFLAG(IS_OZONE_WAYLAND)
if (ozone_platform_hint == kPlatformWayland ||
ozone_platform_hint == "auto") {
// We are here if:
@@ -109,7 +110,7 @@ std::string MaybeFixPlatformName(const std::string& ozone_platform_hint) {
}
return kPlatformX11;
}
#endif // BUILDFLAG(OZONE_PLATFORM_WAYLAND)
#endif // BUILDFLAG(IS_OZONE_WAYLAND)
#endif // BUILDFLAG(OZONE_PLATFORM_X11)
return ozone_platform_hint;

View File

@@ -415,7 +415,7 @@ ElectronPermissionManager::GetPermissionStatusForEmbeddedRequester(
}
ElectronPermissionManager::SubscriptionId
ElectronPermissionManager::SubscribePermissionStatusChange(
ElectronPermissionManager::SubscribeToPermissionStatusChange(
blink::PermissionType permission,
content::RenderProcessHost* render_process_host,
content::RenderFrameHost* render_frame_host,
@@ -424,7 +424,7 @@ ElectronPermissionManager::SubscribePermissionStatusChange(
return SubscriptionId();
}
void ElectronPermissionManager::UnsubscribePermissionStatusChange(
void ElectronPermissionManager::UnsubscribeFromPermissionStatusChange(
SubscriptionId id) {}
} // namespace electron

View File

@@ -139,14 +139,14 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
blink::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const url::Origin& requesting_origin) override;
SubscriptionId SubscribePermissionStatusChange(
SubscriptionId SubscribeToPermissionStatusChange(
blink::PermissionType permission,
content::RenderProcessHost* render_process_host,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback)
override;
void UnsubscribePermissionStatusChange(SubscriptionId id) override;
void UnsubscribeFromPermissionStatusChange(SubscriptionId id) override;
private:
class PendingRequest;

View File

@@ -2,16 +2,10 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#if defined(USE_OZONE)
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#define USE_OZONE_PLATFORM_X11
#endif
#endif
// FIXME(ckerr) this incorrect #include order is a temporary
// fix to unblock the roll. Will fix in an upgrade followup.
#ifdef USE_OZONE_PLATFORM_X11
#include "ui/base/ozone_buildflags.h"
#if BUILDFLAG(IS_OZONE_X11)
#include "ui/base/x/x11_util.h"
#endif
@@ -48,6 +42,7 @@
#include "ui/base/hit_test.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/views/background.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/widget/native_widget_private.h"
@@ -68,19 +63,15 @@
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#include "ui/views/window/native_frame_view.h"
#if defined(USE_OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_OZONE_X11)
#include "shell/browser/ui/views/global_menu_bar_x11.h"
#include "shell/browser/ui/x/event_disabler.h"
#include "shell/browser/ui/x/x_window_utils.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/shape.h"
#include "ui/gfx/x/xproto.h"
#endif
#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
#elif BUILDFLAG(IS_WIN)
#include "base/win/win_util.h"
@@ -175,26 +166,12 @@ gfx::Size WindowSizeToContentSizeBuggy(HWND hwnd, const gfx::Size& size) {
#endif
#if defined(USE_OZONE)
bool CreateGlobalMenuBar() {
return ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.supports_global_application_menus;
}
#endif
#if defined(USE_OZONE_PLATFORM_X11)
bool IsX11() {
[[maybe_unused]] bool IsX11() {
return ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.electron_can_call_x11;
}
#endif
class NativeWindowClientView : public views::ClientView {
public:
NativeWindowClientView(views::Widget* widget,
@@ -350,9 +327,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
if (parent)
SetParentWindow(parent);
#endif
#if defined(USE_OZONE_PLATFORM_X11)
if (IsX11()) {
// Before the window is mapped the SetWMSpecState can not work, so we have
// to manually set the _NET_WM_STATE.
@@ -481,7 +456,7 @@ NativeWindowViews::~NativeWindowViews() {
}
void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
#if defined(USE_OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_LINUX)
if (IsX11()) {
const std::string color = use_dark_theme ? "dark" : "light";
auto* connection = x11::Connection::Get();
@@ -543,12 +518,10 @@ void NativeWindowViews::Show() {
NotifyWindowShow();
#if defined(USE_OZONE)
#if BUILDFLAG(IS_LINUX)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
#endif
#if defined(USE_OZONE_PLATFORM_X11)
// On X11, setting Z order before showing the window doesn't take effect,
// so we have to call it again.
if (IsX11())
@@ -561,7 +534,7 @@ void NativeWindowViews::ShowInactive() {
NotifyWindowShow();
#if defined(USE_OZONE)
#if BUILDFLAG(IS_LINUX)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
#endif
@@ -575,7 +548,7 @@ void NativeWindowViews::Hide() {
NotifyWindowHide();
#if defined(USE_OZONE)
#if BUILDFLAG(IS_LINUX)
if (global_menu_bar_)
global_menu_bar_->OnWindowUnmapped();
#endif
@@ -607,10 +580,8 @@ bool NativeWindowViews::IsEnabled() {
#if BUILDFLAG(IS_WIN)
return ::IsWindowEnabled(GetAcceleratedWidget());
#elif BUILDFLAG(IS_LINUX)
#if defined(USE_OZONE_PLATFORM_X11)
if (IsX11())
return !event_disabler_.get();
#endif
NOTIMPLEMENTED();
return true;
#endif
@@ -648,7 +619,7 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
#if BUILDFLAG(IS_WIN)
::EnableWindow(GetAcceleratedWidget(), enable);
#elif defined(USE_OZONE_PLATFORM_X11)
#else
if (IsX11()) {
views::DesktopWindowTreeHostPlatform* tree_host =
views::DesktopWindowTreeHostLinux::GetHostForWidget(
@@ -923,7 +894,7 @@ bool NativeWindowViews::MoveAbove(const std::string& sourceId) {
::SetWindowPos(GetAcceleratedWidget(), GetWindow(otherWindow, GW_HWNDPREV), 0,
0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#elif defined(USE_OZONE_PLATFORM_X11)
#else
if (IsX11()) {
if (!IsWindowValid(static_cast<x11::Window>(id.id)))
return false;
@@ -945,7 +916,7 @@ void NativeWindowViews::MoveTop() {
::SetWindowPos(GetAcceleratedWidget(), HWND_TOP, pos.x(), pos.y(),
size.width(), size.height(),
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#elif defined(USE_OZONE_PLATFORM_X11)
#else
if (IsX11())
electron::MoveWindowToForeground(
static_cast<x11::Window>(GetAcceleratedWidget()));
@@ -1244,7 +1215,7 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
} else {
SetForwardMouseMessages(forward);
}
#elif defined(USE_OZONE_PLATFORM_X11)
#else
if (IsX11()) {
auto* connection = x11::Connection::Get();
if (ignore) {
@@ -1312,7 +1283,7 @@ bool NativeWindowViews::IsFocusable() {
}
void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) {
#if defined(USE_OZONE)
#if BUILDFLAG(IS_LINUX)
// Remove global menu bar.
if (global_menu_bar_ && menu_model == nullptr) {
global_menu_bar_.reset();
@@ -1321,7 +1292,10 @@ void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) {
}
// Use global application menu bar when possible.
if (CreateGlobalMenuBar() && ShouldUseGlobalMenuBar()) {
bool can_use_global_menus = ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.supports_global_application_menus;
if (can_use_global_menus && ShouldUseGlobalMenuBar()) {
if (!global_menu_bar_)
global_menu_bar_ = std::make_unique<GlobalMenuBarX11>(this);
if (global_menu_bar_->IsServerStarted()) {
@@ -1408,7 +1382,7 @@ void NativeWindowViews::SetTopBrowserView(NativeBrowserView* view) {
void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
NativeWindow::SetParentWindow(parent);
#if defined(USE_OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_LINUX)
if (IsX11()) {
auto* connection = x11::Connection::Get();
connection->SetProperty(
@@ -1525,7 +1499,7 @@ void NativeWindowViews::SetVisibleOnAllWorkspaces(
}
bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
#if defined(USE_OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_LINUX)
if (IsX11()) {
// Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
// determine whether the current window is visible on all workspaces.

View File

@@ -13,28 +13,22 @@
#include "base/memory/raw_ptr.h"
#include "shell/browser/ui/views/root_view.h"
#include "ui/base/ozone_buildflags.h"
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
#include "ui/views/widget/widget_observer.h"
#if defined(USE_OZONE)
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#define USE_OZONE_PLATFORM_X11
#endif
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/scoped_gdi_object.h"
#include "shell/browser/ui/win/taskbar_host.h"
#endif
namespace electron {
#if BUILDFLAG(IS_LINUX)
class GlobalMenuBarX11;
class WindowStateWatcher;
#endif
#if defined(USE_OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_OZONE_X11)
class EventDisabler;
#endif
@@ -263,12 +257,11 @@ class NativeWindowViews : public NativeWindow,
// events from resizing the window.
extensions::SizeConstraints old_size_constraints_;
#if defined(USE_OZONE)
#if BUILDFLAG(IS_LINUX)
std::unique_ptr<GlobalMenuBarX11> global_menu_bar_;
#endif
#if defined(USE_OZONE_PLATFORM_X11)
#if BUILDFLAG(IS_OZONE_X11)
// To disable the mouse events.
std::unique_ptr<EventDisabler> event_disabler_;
#endif

View File

@@ -107,7 +107,7 @@ void PrintViewManagerElectron::ScriptedPrint(
auto default_param = printing::mojom::PrintPagesParams::New();
default_param->params = printing::mojom::PrintParams::New();
LOG(ERROR) << "Scripted print is not supported";
std::move(callback).Run(std::move(default_param), /*cancelled*/ false);
std::move(callback).Run(std::move(default_param));
}
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)

View File

@@ -17,19 +17,12 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/linux/linux_ui.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/platform_window/platform_window.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
#include "ui/views/window/non_client_view.h"
#if defined(USE_OZONE)
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#define USE_OZONE_PLATFORM_X11
#endif
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace electron {
ElectronDesktopWindowTreeHostLinux::ElectronDesktopWindowTreeHostLinux(
@@ -57,7 +50,6 @@ void ElectronDesktopWindowTreeHostLinux::OnBoundsChanged(
views::DesktopWindowTreeHostLinux::OnBoundsChanged(change);
UpdateFrameHints();
#if defined(USE_OZONE_PLATFORM_X11)
if (ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.electron_can_call_x11) {
@@ -67,7 +59,6 @@ void ElectronDesktopWindowTreeHostLinux::OnBoundsChanged(
// X11Window::ToggleFullscreen in ui/ozone/platform/x11/x11_window.cc.
UpdateWindowState(platform_window()->GetPlatformWindowState());
}
#endif
}
void ElectronDesktopWindowTreeHostLinux::OnWindowStateChanged(

View File

@@ -21,14 +21,7 @@
#include "ui/base/models/menu_model.h"
#include "ui/events/event_constants.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#if defined(USE_OZONE)
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#define USE_OZONE_PLATFORM_X11
#endif
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace electron::gtkui {
@@ -47,8 +40,6 @@ int EventFlagsFromGdkState(guint state) {
return flags;
}
#if defined(USE_OZONE_PLATFORM_X11)
guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator) {
// The second parameter is false because accelerator keys are expressed in
// terms of the non-shift-modified key.
@@ -68,8 +59,6 @@ GdkModifierType GetGdkModifierForAccelerator(
return static_cast<GdkModifierType>(modifier);
}
#endif
} // namespace
GtkWidget* BuildMenuItemWithImage(const std::string& label, GtkWidget* image) {
@@ -231,7 +220,6 @@ void BuildSubmenuFromModel(ui::MenuModel* model,
connect_to_activate = false;
}
#if defined(USE_OZONE_PLATFORM_X11)
if (ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.electron_can_call_x11) {
@@ -243,7 +231,6 @@ void BuildSubmenuFromModel(ui::MenuModel* model,
GTK_ACCEL_VISIBLE);
}
}
#endif
g_object_set_data(G_OBJECT(menu_item), "model", model);
AppendMenuItemToMenu(i, model, menu_item, menu, connect_to_activate,

View File

@@ -853,10 +853,6 @@ void InspectableWebContents::SetDevicesDiscoveryConfig(
void InspectableWebContents::SetDevicesUpdatesEnabled(bool enabled) {}
void InspectableWebContents::PerformActionOnRemotePage(
const std::string& page_id,
const std::string& action) {}
void InspectableWebContents::OpenRemotePage(const std::string& browser_id,
const std::string& url) {}

View File

@@ -128,8 +128,6 @@ class InspectableWebContents
bool network_discovery_enabled,
const std::string& network_discovery_config) override;
void SetDevicesUpdatesEnabled(bool enabled) override;
void PerformActionOnRemotePage(const std::string& page_id,
const std::string& action) override;
void OpenRemotePage(const std::string& browser_id,
const std::string& url) override;
void OpenNodeFrontend() override;

View File

@@ -20,7 +20,7 @@ namespace electron {
SubmenuButton::SubmenuButton(PressedCallback callback,
const std::u16string& title,
const SkColor& background_color)
: views::MenuButton(callback, gfx::RemoveAccelerator(title)),
: views::MenuButton(std::move(callback), gfx::RemoveAccelerator(title)),
background_color_(background_color) {
#if BUILDFLAG(IS_LINUX)
// Dont' use native style border.

View File

@@ -252,6 +252,10 @@ v8::Local<v8::Value> Converter<blink::PermissionType>::ToV8(
return StringToV8(isolate, "display-capture");
case blink::PermissionType::TOP_LEVEL_STORAGE_ACCESS:
return StringToV8(isolate, "top-level-storage-access");
case blink::PermissionType::CAPTURED_SURFACE_CONTROL:
return StringToV8(isolate, "captured-surface-control");
case blink::PermissionType::SMART_CARD:
return StringToV8(isolate, "smart-card");
case blink::PermissionType::NUM:
break;
}

View File

@@ -55,6 +55,11 @@
#include "ui/base/ime/ime_text_span.h"
#include "url/url_util.h"
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
#include "components/spellcheck/renderer/spellcheck.h"
#include "components/spellcheck/renderer/spellcheck_provider.h"
#endif
namespace gin {
template <>
@@ -104,10 +109,16 @@ bool SpellCheckWord(content::RenderFrame* render_frame,
RendererClientBase* client = RendererClientBase::Get();
mojo::Remote<spellcheck::mojom::SpellCheckHost> spellcheck_host;
render_frame->GetBrowserInterfaceBroker()->GetInterface(
spellcheck_host.BindNewPipeAndPassReceiver());
if (!spellcheck_host.is_bound())
return false;
std::u16string w = base::UTF8ToUTF16(word);
int id = render_frame->GetRoutingID();
return client->GetSpellCheck()->SpellCheckWord(
w.c_str(), 0, word.size(), id, &start, &length, optional_suggestions);
return client->GetSpellCheck()->SpellCheckWord(w.c_str(), 0, word.size(),
*spellcheck_host.get(), &start,
&length, optional_suggestions);
}
#endif

View File

@@ -16,8 +16,10 @@
namespace electron {
ElectronExtensionsRendererClient::ElectronExtensionsRendererClient()
: dispatcher_(std::make_unique<extensions::Dispatcher>(
std::make_unique<ElectronExtensionsDispatcherDelegate>())) {
: dispatcher_{std::make_unique<extensions::Dispatcher>(
std::make_unique<ElectronExtensionsDispatcherDelegate>(),
std::vector<
std::unique_ptr<extensions::ExtensionsRendererAPIProvider>>{})} {
dispatcher_->OnRenderThreadStarted(content::RenderThread::Get());
}

View File

@@ -342,8 +342,9 @@ void RendererClientBase::RenderFrameCreated(
#endif
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
if (render_frame->GetBlinkPreferences().enable_spellcheck)
new SpellCheckProvider(render_frame, spellcheck_.get(), this);
if (render_frame->GetBlinkPreferences().enable_spellcheck) {
new SpellCheckProvider(render_frame, spellcheck_.get());
}
#endif
}