8c89137ecd
* chore: bump chromium in DEPS to 122.0.6180.0 * 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 * 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 👀 * 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 * 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 * 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 * 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. * Remove performActionOnRemotePage Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5068017 It appears it is not used by anything within Chromium or outside. * 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 * chore: update constructor call for ElectronExtensionsRendererClient::dispatcher_ Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5055146 * chore: handle CAPTURED_SURFACE_CONTROL in Converter<blink::PermissionType>::ToV8() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5096614 * chore: e patches all * chore: bump chromium to 122.0.6181.0 * chore: e patches all * 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. * chore: make lint happy * 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 * chore: bump chromium in DEPS to 122.0.6182.0 * chore: update patches * chore: fix virtual function names that were renamed upstream Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5115241 * chore: handle new blink::PermissionType::SMART_CARD in PermissionType converter Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5049989 * chore: node script/gen-libc++-filenames.js * fixup! chore: update build_do_not_depend_on_packed_resource_integrity.patch * 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. * chore: bump chromium in DEPS to 122.0.6184.0 * chore: bump chromium in DEPS to 122.0.6186.0 * 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 * 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 * 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 * chore: e patches all * chore: add refactor_update_node-platform_to_match_v8-platform_api_changes.patch * chore: bump chromium in DEPS to 122.0.6188.0 * chore: bump chromium in DEPS to 122.0.6190.0 * chore: bump chromium in DEPS to 122.0.6192.0 * chore: bump chromium in DEPS to 122.0.6194.0 * Remove an unnecessary DCHECK which causes Lacros to crash. https://chromium-review.googlesource.com/c/chromium/src/+/5124880 * [FixIt Week] Add shared regular profile function that includes ash https://chromium-review.googlesource.com/c/chromium/src/+/5100709 * Simplify the PrintManagerHost::ScriptedPrint() call https://chromium-review.googlesource.com/c/chromium/src/+/5019703 * [local compile hints] Add tests https://chromium-review.googlesource.com/c/chromium/src/+/5024173 * chore: update patches * fixup! chore: add refactor_update_node-platform_to_match_v8-platform_api_changes.patch * chore: node script/gen-libc++-filenames.js * Remove //ui/ozone/buildflags.h https://chromium-review.googlesource.com/c/chromium/src/+/5119048 * fixup! Remove //ui/ozone/buildflags.h * fixup! Remove //ui/ozone/buildflags.h * chore: update patches * fixup! refactor: Add lookup for per-RenderFrame SpellCheckProvider * fixup! Remove //ui/ozone/buildflags.h * Add permission policy verification in PermissionControllerImpl https://chromium-review.googlesource.com/c/chromium/src/+/5059112 * fix: ensure spellcheck interface is registered for frame * [exceptions] Unify pending and scheduled exceptions https://chromium-review.googlesource.com/c/v8/v8/+/5050065 * fix: dchecks in node.js tests * fix: try adding termination check * chore: document breaking iframe change --------- 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>
141 lines
4.7 KiB
C++
141 lines
4.7 KiB
C++
// Copyright (c) 2022 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/electron_browser_main_parts.h"
|
|
|
|
#include "base/command_line.h"
|
|
#include "base/environment.h"
|
|
#include "ui/base/ozone_buildflags.h"
|
|
#include "ui/ozone/public/ozone_switches.h"
|
|
|
|
#if BUILDFLAG(IS_OZONE_WAYLAND)
|
|
#include "base/files/file_path.h"
|
|
#include "base/files/file_util.h"
|
|
#include "base/nix/xdg_util.h"
|
|
#include "shell/common/thread_restrictions.h"
|
|
#endif
|
|
|
|
constexpr base::StringPiece kElectronOzonePlatformHint(
|
|
"ELECTRON_OZONE_PLATFORM_HINT");
|
|
|
|
#if BUILDFLAG(IS_OZONE_WAYLAND)
|
|
|
|
constexpr char kPlatformWayland[] = "wayland";
|
|
|
|
bool HasWaylandDisplay(base::Environment* env) {
|
|
std::string wayland_display;
|
|
const bool has_wayland_display =
|
|
env->GetVar("WAYLAND_DISPLAY", &wayland_display) &&
|
|
!wayland_display.empty();
|
|
if (has_wayland_display)
|
|
return true;
|
|
|
|
std::string xdg_runtime_dir;
|
|
const bool has_xdg_runtime_dir =
|
|
env->GetVar("XDG_RUNTIME_DIR", &xdg_runtime_dir) &&
|
|
!xdg_runtime_dir.empty();
|
|
if (has_xdg_runtime_dir) {
|
|
auto wayland_server_pipe =
|
|
base::FilePath(xdg_runtime_dir).Append("wayland-0");
|
|
// Normally, this should happen exactly once, at the startup of the main
|
|
// process.
|
|
electron::ScopedAllowBlockingForElectron allow_blocking;
|
|
return base::PathExists(wayland_server_pipe);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
#endif // BUILDFLAG(IS_OZONE_WAYLAND)
|
|
|
|
#if BUILDFLAG(IS_OZONE_X11)
|
|
constexpr char kPlatformX11[] = "x11";
|
|
#endif
|
|
|
|
namespace electron {
|
|
|
|
namespace {
|
|
|
|
// Evaluates the environment and returns the effective platform name for the
|
|
// given |ozone_platform_hint|.
|
|
// For the "auto" value, returns "wayland" if the XDG session type is "wayland",
|
|
// "x11" otherwise.
|
|
// For the "wayland" value, checks if the Wayland server is available, and
|
|
// returns "x11" if it is not.
|
|
// See https://crbug.com/1246928.
|
|
std::string MaybeFixPlatformName(const std::string& ozone_platform_hint) {
|
|
#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'
|
|
// explicitly and a Wayland server is running.
|
|
// Otherwise, fall back to X11.
|
|
if (ozone_platform_hint == kPlatformWayland ||
|
|
ozone_platform_hint == "auto") {
|
|
auto env(base::Environment::Create());
|
|
|
|
std::string xdg_session_type;
|
|
const bool has_xdg_session_type =
|
|
env->GetVar(base::nix::kXdgSessionTypeEnvVar, &xdg_session_type) &&
|
|
!xdg_session_type.empty();
|
|
|
|
if ((has_xdg_session_type && xdg_session_type == "wayland") ||
|
|
(ozone_platform_hint == kPlatformWayland &&
|
|
HasWaylandDisplay(env.get()))) {
|
|
return kPlatformWayland;
|
|
}
|
|
}
|
|
#endif // BUILDFLAG(IS_OZONE_WAYLAND)
|
|
|
|
#if BUILDFLAG(IS_OZONE_X11)
|
|
if (ozone_platform_hint == kPlatformX11) {
|
|
return kPlatformX11;
|
|
}
|
|
#if BUILDFLAG(IS_OZONE_WAYLAND)
|
|
if (ozone_platform_hint == kPlatformWayland ||
|
|
ozone_platform_hint == "auto") {
|
|
// We are here if:
|
|
// - The binary has both X11 and Wayland backends.
|
|
// - The user wanted Wayland but that did not work, otherwise it would have
|
|
// been returned above.
|
|
if (ozone_platform_hint == kPlatformWayland) {
|
|
LOG(WARNING) << "No Wayland server is available. Falling back to X11.";
|
|
} else {
|
|
LOG(WARNING) << "This is not a Wayland session. Falling back to X11. "
|
|
"If you need to run Chrome on Wayland using some "
|
|
"embedded compositor, e. g., Weston, please specify "
|
|
"Wayland as your preferred Ozone platform, or use "
|
|
"--ozone-platform=wayland.";
|
|
}
|
|
return kPlatformX11;
|
|
}
|
|
#endif // BUILDFLAG(IS_OZONE_WAYLAND)
|
|
#endif // BUILDFLAG(OZONE_PLATFORM_X11)
|
|
|
|
return ozone_platform_hint;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
void ElectronBrowserMainParts::DetectOzonePlatform() {
|
|
auto const env = base::Environment::Create();
|
|
auto* const command_line = base::CommandLine::ForCurrentProcess();
|
|
if (!command_line->HasSwitch(switches::kOzonePlatform)) {
|
|
auto ozone_platform_hint =
|
|
command_line->GetSwitchValueASCII(switches::kOzonePlatformHint);
|
|
if (ozone_platform_hint.empty()) {
|
|
env->GetVar(kElectronOzonePlatformHint, &ozone_platform_hint);
|
|
}
|
|
if (!ozone_platform_hint.empty()) {
|
|
command_line->AppendSwitchASCII(
|
|
switches::kOzonePlatform, MaybeFixPlatformName(ozone_platform_hint));
|
|
}
|
|
}
|
|
|
|
std::string desktop_startup_id;
|
|
if (env->GetVar("DESKTOP_STARTUP_ID", &desktop_startup_id))
|
|
command_line->AppendSwitchASCII("desktop-startup-id", desktop_startup_id);
|
|
}
|
|
|
|
} // namespace electron
|