From d2948719805f9d2f49956ee93c16cdff06dd8d4d Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 12 Aug 2024 10:32:35 +0200 Subject: [PATCH] chore: deprecate `textured` BrowserWindow `type` option on macOS (#43133) --- docs/api/structures/base-window-options.md | 3 +-- docs/breaking-changes.md | 4 ++++ shell/browser/native_window_mac.mm | 21 ++++++++++++--------- shell/common/options_switches.cc | 3 --- shell/common/options_switches.h | 1 - 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 57ca4ed70589..d211ab7cda7c 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -139,8 +139,7 @@ Possible values are: -webkit-app-region: drag. This type is commonly used for splash screens. * The `notification` type creates a window that behaves like a system notification. * On macOS, possible types are `desktop`, `textured`, `panel`. - * The `textured` type adds metal gradient appearance - (`NSWindowStyleMaskTexturedBackground`). + * The `textured` type adds metal gradient appearance. This option is **deprecated**. * The `desktop` type places the window at the desktop background window level (`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive focus, keyboard or mouse events, but you can use `globalShortcut` to receive diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index e5bfab625d0d..7a6e0df45f76 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -14,6 +14,10 @@ This document uses the following convention to categorize breaking changes: ## Planned Breaking API Changes (33.0) +### Deprecated: `textured` option in `BrowserWindowConstructorOption.type` + +The `textured` option of `type` in `BrowserWindowConstructorOptions` has been deprecated with no replacement. This option relied on the [`NSWindowStyleMaskTexturedBackground`](https://developer.apple.com/documentation/appkit/nswindowstylemask/nswindowstylemasktexturedbackground) style mask on macOS, which has been deprecated with no alternative. + ### Removed: macOS 10.15 support macOS 10.15 (Catalina) is no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/5734361). diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 1975fa9c67ba..625ffcf61271 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -38,6 +38,7 @@ #include "shell/common/gin_helper/dictionary.h" #include "shell/common/node_includes.h" #include "shell/common/options_switches.h" +#include "shell/common/process_util.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/webrtc/modules/desktop_capture/mac/window_list_utils.h" #include "ui/base/hit_test.h" @@ -154,14 +155,6 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options, bool hiddenInMissionControl = false; options.Get(options::kHiddenInMissionControl, &hiddenInMissionControl); - bool useStandardWindow = true; - // eventually deprecate separate "standardWindow" option in favor of - // standard / textured window types - options.Get(options::kStandardWindow, &useStandardWindow); - if (windowType == "textured") { - useStandardWindow = false; - } - // The window without titlebar is treated the same with frameless window. if (title_bar_style_ != TitleBarStyle::kNormal) set_has_frame(false); @@ -186,8 +179,18 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options, styleMask |= NSWindowStyleMaskClosable; if (resizable) styleMask |= NSWindowStyleMaskResizable; - if (!useStandardWindow || transparent() || !has_frame()) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (windowType == "textured" || transparent() || !has_frame()) { + node::Environment* env = + node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate()); + EmitWarning(env, + "The 'textured' window type is deprecated and will be removed", + "DeprecationWarning"); styleMask |= NSWindowStyleMaskTexturedBackground; + } +#pragma clang diagnostic pop // -Wdeprecated-declarations #pragma clang diagnostic pop diff --git a/shell/common/options_switches.cc b/shell/common/options_switches.cc index aea8e847a841..a0ecacd7d73d 100644 --- a/shell/common/options_switches.cc +++ b/shell/common/options_switches.cc @@ -86,9 +86,6 @@ const char kType[] = "type"; // Disable auto-hiding cursor. const char kDisableAutoHideCursor[] = "disableAutoHideCursor"; -// Use the macOS' standard window instead of the textured window. -const char kStandardWindow[] = "standardWindow"; - // Default browser window background color. const char kBackgroundColor[] = "backgroundColor"; diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index 2d89d4e43c97..5903291a4cce 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -47,7 +47,6 @@ extern const char kDarkTheme[]; extern const char kTransparent[]; extern const char kType[]; extern const char kDisableAutoHideCursor[]; -extern const char kStandardWindow[]; extern const char kBackgroundColor[]; extern const char kHasShadow[]; extern const char kOpacity[];