Commit graph

3397 commits

Author SHA1 Message Date
Charles Kerr
2e8fc17f07
refactor: pass views::Widget* into constructors of our TreeHosts and NativeWidgets (#47177)
* refactor: remove unnecessary downcast in MenuViews::PopupAt()

* refactor: pass a views::Widget as an arg to the ElectronDesktopWindowTreeHostLinux ctor

* refactor: pass a views::Widget as an arg to the ElectronDesktopNativeWidgetAura ctor

* refactor: pass a views::Widget as an arg to the ElectronDesktopWindowTreeHostWin ctor

* refactor: create desktop_window_tree_host_ in the ElectronDesktopNativeWidgetAura constructor

* fixup! refactor: create desktop_window_tree_host_ in the ElectronDesktopNativeWidgetAura constructor

fix: tyop
2025-05-21 16:02:55 -05:00
Charles Kerr
4af0c5d762
refactor: make NativeWindow::transparent_ const (#47172)
* refactor: use in-class member initialization for NativeWindow::widget_

* refactor: make NativeWindow::transparent_ const

refactor: make NativeWindow::enable_larger_than_screen_ const

* chore: make linter happy after rebase
2025-05-21 19:42:08 +02:00
Charles Kerr
a7a3e10300
refactor: prefer base::circular_deque over std::deque (#47171)
* refactor: use base::circular_deque in ResolveProxyHelper

* refactor: use base::circular_deque in GetExtraCrashKeys()

refactor: reduce visibility of kMaxCrashKeyValueSize

This change is to match Chromium's usage advice from
base/containers/README.md: `base:circular_deque` is preferred over
`std::deque` to provide consistent performance across platforms.
2025-05-21 12:04:36 -05:00
Shelley Vohr
7b77a24211
fix: remove extra 'suspend'/'resume' handling from powerMonitor (#47162)
fix: remove extra 'suspend'/'resume' handling from powerMonitor
2025-05-21 10:00:38 -05:00
Charles Kerr
d6638f9564
refactor: make NativeWindow::pending_transitions_ a base::queue (#47157)
refactor: make NativeWindow::pending_transitions a base::queue

Follow the base/containers/README.md advice that "Chromium code should
always use `base::circular_deque` or `base::queue` in preference to
`std::deque` or `std::queue` due to memory usage and platform variation."
2025-05-20 17:35:51 -05:00
Charles Kerr
9f8bcc4d98
refactor: make NativeWindow::has_client_frame_ const (#47156) 2025-05-20 17:14:28 -05:00
Charles Kerr
21155679a0
refactor: add NativeWindowViews::GetClientFrameViewLinux() (#47130)
* refactor: add NativeWindowViews::GetClientFrameViewLinux()

* chore: clarify code comment
2025-05-20 14:15:06 -05:00
Charles Kerr
211faed848
refactor: add NativeWindow::IsActive() (#47148)
this was already present on macOS; use in NativeWindowViews too
2025-05-20 11:08:44 -04:00
Shelley Vohr
296e39456a
refactor: match upstream macOS a11y handling (#47144) 2025-05-20 11:06:57 -04:00
Charles Kerr
3660432f42
refactor: NativeWindows should prefer widget() over GetWidget() for internal use (#47133) 2025-05-19 21:43:16 +02:00
Charles Kerr
687e50b4f3
refactor: add NativeWindowViews::SetTitleBarOverlay() (#47126)
* refactor: move SetTitleBarOverlay() impl to NativeWindowViews

* refactor: make NativeWindowViews::set_overlay_button_color() private

refactor: make NativeWindowViews::set_overlay_symbol_color() private

refactor: make NativeWindow::set_titlebar_overlay_height() protected

* refactor: simplify downcasting in NativeWindowViews::SetTitleBarOverlay()
2025-05-19 08:19:03 -05:00
Charles Kerr
208bbc0504
refactor: add NativeWindow::SetShape() (#47131)
use NativeWindow::SetShape() in api::BaseWindow
2025-05-19 10:29:29 +02:00
Charles Kerr
8efd24c339
perf: don't create unused menuitem icons (#47100)
GTK >= 3.90.0 removed support for menuitem icons. When Electron is
built with GTK >= 3.90.0, our code builds these icons and then throws
them away unused. Instead, let's just not build them.

Our gtk_util::GdkPixbufFromSkBitmap utility uses BGRAToRGBA and is
expensive to call.
2025-05-16 02:43:03 -05:00
Charles Kerr
77c58658c5
refactor: decouple NativeWindowViews and GlobalMenuBarX11 (#47094)
The GlobalMenuBar used to hold a raw_ptr reference to its NativeWindow;
but since it doesn't use it & only wants the gfx::AcceleratedWidget info,
let's remove the NativeWindowViews reference.

AFAICT, GlobalMenuBarX11::window_ has never been used
2025-05-15 16:10:56 -05:00
Charles Kerr
d720aea700
refactor: make TrackableObject::weak_map_id() constexpr (#47092)
* refactor: make TrackableObject::weak_map_id() constexpr

refactor: make BaseWindow::GetID() inline and constexpr

* refactor: make NativeWindow::window_id() constexpr too
2025-05-15 16:10:33 -05:00
Robo
99a3e360ec
fix: opening package paths as directory on macOS (#47077) 2025-05-15 12:47:46 -05:00
electron-roller[bot]
883f48b9b4
chore: bump chromium to 138.0.7178.0 (main) (#47086)
* chore: bump chromium in DEPS to 138.0.7178.0

* 6351556: [source-phase-imports] Support Wasm Source Phase Imports

Refs 6351556

* chore: update patches

* 6509682: extensions: Use ChromeExtensionsBrowserClient on desktop Android, part 2

Refs 6509682

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-15 12:47:07 -05:00
Charles Kerr
9a7b73b533
refactor: use kKeyModifiers in IsAltModifier() (#47066)
We probably didn't use this before because IsAltModifier() was written
two years before the KeyModifiers mask was added upstream in 98ec378a.
2025-05-14 11:00:00 -04:00
electron-roller[bot]
d65a856bf3
chore: bump chromium to 138.0.7177.0 (main) (#47081)
* chore: bump chromium in DEPS to 138.0.7177.0

* 6530423: [WebContents] Fix IsNeverComposited() calls during initialization

Refs 6530423

* 6512551: [ios] Enable -Wobjc-property-assign-on-object-type

Refs 6512551

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-14 10:08:31 -04:00
Shelley Vohr
f2639d13cc
refactor: remove CreateViewForWidget patch (#46981)
* refactor: remove CreateViewForWidget patch

* chore: rm unintended osr change

* Trigger CI

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-14 21:43:23 +09:00
Charles Kerr
11fa915724
refactor: remove introduce_ozoneplatform_electron_can_call_x11_property.patch (#47075)
* refactor: use x11_util::IsX11() in BuildSubmenuFromModel()

* refactor: use x11_util::IsX11() in ElectronDesktopWindowTreeHostLinux::OnBoundsChanged()

* refactor: use skia_can_fall_back_to_x11 in x11_util::IsX11()

it is identical in practice to electron_can_call_x11 and does not require a Chromium patch

* chore: remove introduce_ozoneplatform_electron_can_call_x11_property.patch

* refactor: use ui::GetOzonePlatformId() to test for x11
2025-05-14 13:38:35 +09:00
electron-roller[bot]
e3e647d21e
chore: bump chromium to 138.0.7175.0 (main) (#46986)
* chore: bump chromium in DEPS to 138.0.7166.0

* chore: bump chromium in DEPS to 138.0.7166.2

* 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

6508373

* 6470924: Introduce auto-populated Search Engine icons.

6470924

* 6502977: Force same tab navigation while actor coordinator is acting on a tab

6502977

* chore: bump chromium in DEPS to 138.0.7168.0

* chore: update patches

* fix grit patch

* chore: bump Chromium to 138.0.7169.2

* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

* 6493688: NavigationThrottleRunner2: void CreateThrottlesForNavigation

6493688

* 6488755: Reland "WebSQL: Remove WebPreference"

6488755

* 6428707: FSA: Only normalize the hardcoded rules once during initialization

6428707

* chore: fixup patch indices

* chore: bump chromium in DEPS to 138.0.7170.0

* 6514121: Remove origin calculation debug info and related methods

 6514121

* chore: bump chromium in DEPS to 138.0.7172.0

* chore: bump chromium in DEPS to 138.0.7173.0

* chore: bump chromium in DEPS to 138.0.7175.0

* fixup! 6514121: Remove origin calculation debug info and related methods

Refs 6514121

* 6531585: Don't retry LayerTreeSink creation on the high priority queue

Refs 6531585

* 6512253: Modernize base::apple's base bundle ID

Refs 6512253

* fixup! 6428707: FSA: Only normalize the hardcoded rules once during initialization

Refs 6428707

* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

Refs 6508373

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-05-13 14:51:20 -04:00
Shelley Vohr
7ab032f594
fix: white window flicker on window creation (#47022) 2025-05-10 18:24:35 -05:00
Michaela Laurencin
10e4f9ad37
feat: enable secondary label for macOS menu (#46887)
* feat: enable secondary label for macOS menu

* Update shell/browser/ui/cocoa/electron_menu_controller.mm

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

* fix for lint

* update docs for sublabel

---------

Co-authored-by: Robo <hop2deep@gmail.com>
2025-05-09 12:05:26 -04:00
Michaela Laurencin
b9f0aebb2f
feat: enable innerWidth and innerHeight for window open (#46749)
* feat: enable innerWidth and innerHeight for window open

* update comment for added special innerWidth and innerHeight

* update 100 min spec requirement handling

* update testing to include getContentSize

* update macOS min requirement handling

* adjust refactored consts

* update const values from nativewindowviews
2025-05-09 12:03:45 -04:00
Shelley Vohr
75cf8ea96d
fix: restore previous Windows screenshotting (#47020)
Fixes https://github.com/electron/electron/issues/45990

We previously made a change in https://github.com/electron/electron/pull/45868
to fix content protection being lost on hide and re-show. However, this
cause a breaking change where protected windows were made opaque black
instead of being hidden as before. This overrides relevant methods in
ElectronDesktopWindowTreeHostWin to restore the previous behavior.
without regressing the original issue.
2025-05-09 09:38:27 -05:00
Robo
8e8d3a4f3e
fix: use-after-move of bus connection in xdg portal detection (#47008) 2025-05-09 18:32:08 +09:00
Charles Kerr
2cbd968da5
refactor: use gin_helper::Dictionary::ValueOrDefault() (#46982)
* refactor: use ValueOrDefault() in electron_api_web_contents.cc

* refactor: use ValueOrDefault() in electron_api_url_loader.cc

* refactor: use ValueOrDefault() in electron_download_manager_delegate.cc

* refactor: use ValueOrDefault() in electron_touch_bar.mm

* refactor: use ValueOrDefault() in electron_url_loader_factory.cc

* refactor: use ValueOrDefault() in electron_browser_context.cc

* refactor: use ValueOrDefault() in electron_touch_bar.mm

* refactor: use ValueOrDefault() in blink_converter.cc

* feat: add ValueOrDefault() to PersistentDictionary

* empty commit

* refactor: use ValueOrDefault() in blink_converter.cc

* refactor: inline the rectangle base::Value::Dict

* refactor: remove has_scroll temporary

---------

Co-authored-by: Deepak Mohan <hop2deep@gmail.com>
2025-05-08 14:17:22 -05:00
Charles Kerr
9f8a629126
refactor: reduce use of NativeWidgetPrivate (#46942)
* refactor: do not use native_widget_private() in NativeWindowViews::SetContentProtection()

refactor: do not use native_widget_private() in NativeWindowViews::IsContentProtected()

* refactor: do not use native_widget_private() in NativeWindowViews::Show()

* chore: remove native_widget_private #include from native_window_views_win

Not needed since Feb 2025: 9199d5c6
2025-05-08 09:02:19 -05:00
Charles Kerr
924a8da940
refactor: use WidgetDelegate::SetAccessibleTitle() (#46765)
* refactor: use WidgetDelegate::SetAccessibleTitle()

* test: add window.accessibleTitle tests
2025-05-07 10:44:53 -05:00
Shelley Vohr
c16ea8d54e
fix: printing when no mediaSize specified (#46937)
fix: printing when no mediaSize specified
2025-05-06 19:12:25 -05:00
Charles Kerr
b7ae162716
refactor: add gin_helper::Dictionary::ValueOrDefault() (#46939)
* feat: add gin_helper::Dictionary::ValueOrDefault()

A convenience function for using a default value if the
specified key isn't present in the dictionary.

* refactor: use ValueOrDefault() in native_window.cc

* refactor: use ValueOrDefault() in native_window_mac.mm

* refactor: use ValueOrDefault() in native_window_views.cc

* refactor: use ValueOrDefault() in electron_api_native_image.cc
2025-05-06 15:20:12 -05:00
Charles Kerr
8308ac29c8
refactor: pass gfx::ResizeEdge by value (#46935)
refactor: pass gfx::ResizeEdge by value

It is an enum class, so no reason to pass by reference
2025-05-06 11:57:53 -05:00
Shelley Vohr
206544cbc0
fix: crash on macOS dialog after window-all-closed (#46927)
fix: crash on dialog after window-all-closed
2025-05-06 07:47:50 -05:00
Shelley Vohr
a5ec3f7476
fix: allowed dialog file types with one filter (#46900) 2025-05-06 10:31:00 +02:00
electron-roller[bot]
b90de7d07e
chore: bump chromium to 138.0.7160.0 (main) (#46915)
* chore: bump chromium in DEPS to 138.0.7158.0

* chore: bump chromium in DEPS to 138.0.7160.0

* 6509206: Move Keychain UI suppression code into apple_keychain.cc

6509206

* 6489036: Fix DesktopDataControlsDialog for Glic

6489036

* chore: fixup patch indices

* 6506662: Reland "NavigationThrottleRunner2: content::NavigationThrottleRegistry"

6506662

* 6499811: [video pip] Add live caption dialog

6499811

* 6487926: Add GetMaxImageDimension function to ScreenAI service API for OCR.

6487926

* 6494942: [json] Activate stringify fast-path by default

6494942

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-05-05 13:58:40 -04:00
Charles Kerr
9460300506
refactor: devirtualize NativeWindow methods (#46904)
* refactor: devirtualize NativeWindow::SetSize()

refactor: devirtualize NativeWindow::GetSize()

refactor: devirtualize NativeWindow::SetPosition()

refactor: devirtualize NativeWindow::GetPosition()

* refactor: devirtualize NativeWinodw::SetMinimumSize()

refactor: devirtualize NativeWinodw::GetMinimumSize()

refactor: devirtualize NativeWinodw::SetMaximumSize()

refactor: devirtualize NativeWinodw::GetMaximumSize()

* refactor: devirtualize NativeWindow::SetSheetOffset()

refactor: devirtualize NativeWindow::GetSheetOffsetX()

refactor: devirtualize NativeWindow::GetSheetOffsetY()

* refactor: devirtualize NativeWindow::GetContentMinimumSize()

refactor: devirtualize NativeWindow::GetContentMaximumSize()
2025-05-05 09:29:05 -05:00
Charles Kerr
3362db0655
refactor: remove some NativeWindow public API (#46919)
* refactor: make NativeWindow::titlebar_overlay_height_ private

* refactor: make NativeWindow::set_has_frame() protected

* refactor: remove NativeWindow::background_material()

It's only used once, in NativeWindow, so use |background_material_| directly.

* refactor: remove NativeWindow::vibrancy()

It's only used once, in a NativeWindow method, so use |vibrancy_| directly.

* refactor: unfriend api::BrowserView

It was added in Oct 2022 by 23d4a25 for access to protected NativeWindow
methods add_inspectable_view() and remove_inspectable_view().

That dependency was removed in Nov 2022 by 184ac2b, so BrowserView
doesn't need access to NativeWindow's private fields & methods anymore.

* refactor: make NativeWindow::ContentBoundsToWindowBounds() protected

refactor: make NativeWindow::WindowBoundsToContentBounds() protected
2025-05-05 09:28:49 -05:00
Charles Kerr
2e2776611f
refactor: simplify NativeWindow::FullScreenTransitionState (#46918)
* refactor: make NativeWindow::fullscreen_transition_state_ private

* refactor: add NativeWindow::is_transitioning_fullscreen() helper

* refactor: remove unused NativeWindow::fullscreen_transition_state()

* refactor: replace NativeWindow::set_fullscreen_transition_state() with NativeWindow::set_is_transitioning_fullscreen()

refactor: remove unused NativeWindow::FullScreenTransitionState
2025-05-05 09:28:29 -05:00
Charles Kerr
1f4f1b4afc
refactor: add NativeWindow::FromWidget() helper (#46917)
refactor: add NativeWindow::FromWidet() helper

refactor: make kElectronNativeWindowKey a protected field
2025-05-05 09:27:41 -05:00
Robo
91626a8eac
fix: xdg portal version detection for file dialogs on linux (#46905)
* chore: use dbus thread for portal version detection

* Update shell/browser/ui/file_dialog_linux_portal.cc

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

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-05-05 16:57:20 +09:00
Charles Kerr
3faddd5ae2
refactor: move IsClosed() and IsClosable() tests into NativeWindow::Close() (#46888)
refactor: devirtualize NativeWindow::IsClosed()
2025-05-02 13:21:29 -05:00
Charles Kerr
f6b297a06a
refactor: use base::ObserverList::Notify() (#46875)
* refactor: use ObserverList::Notify() in shell/browser/window_list.cc

* refactor: use ObserverList::Notify() in shell/browser/web_contents_zoom_controller.cc

* refactor: use ObserverList::Notify() in shell/browser/usb/usb_chooser_context.cc

* refactor: use ObserverList::Notify() in shell/browser/usb/electron_usb_delegate.cc

* refactor: use ObserverList::Notify() in shell/browser/ui/views/menu_delegate.cc

* refactor: use ObserverList::Notify() in shell/browser/ui/tray_icon.cc

* refactor: use ObserverList::Notify() in shell/browser/ui/electron_menu_model.cc

* refactor: use ObserverList::Notify() in shell/browser/serial/serial_chooser_context.cc

* refactor: use ObserverList::Notify() in shell/browser/native_window.cc

* refactor: use ObserverList::Notify() in shell/browser/serial/electron_serial_delegate.cc

* refactor: use ObserverList::Notify() in shell/browser/browser.cc

* refactor: use ObserverList::Notify() in shell/browser/api/electron_api_web_contents.cc

* refactor: use ObserverList::Notify() in shell/browser/hid/electron_hid_delegate.cc

* refactor: use ObserverList::Notify() in shell/browser/hid/hid_chooser_context.cc
2025-05-02 11:10:52 +02:00
Shelley Vohr
ede84fc327
feat: support dip <-> screen conversion on Linux X11 (#46211)
feat: support dip <-> screen conversion on Linux
2025-05-02 10:31:45 +02:00
electron-roller[bot]
2b07e6450c
chore: bump chromium to 138.0.7154.0 (main) (#46872)
* chore: bump chromium in DEPS to 138.0.7152.0

* chore: update patches

* chore: bump chromium in DEPS to 138.0.7154.0

* chore: update patches

* ozone/wayland: Fix bookmark dropdown right click context menu

6488801

* Use base::cstring_view in base::Environment

6494292

* [A11yPerformance] Remove Add/Remove AXMode methods

6418444

xref: 6383275

* build: update filenames.libcxx.gni

* Use base::cstring_view in base::Environment

6494292

* Use getters to expose NativePixmapHandle from GpuMemoryBufferHandle

6374406

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-05-01 23:53:40 -05:00
Keeley Hammond
63114e2b8e
fix: revert macOS content protection logic refactor (#46886)
Revert "refactor: use upstream content protection logic on macOS (#46813)"

This reverts commit 34adb976b6.
2025-05-01 13:49:55 -07:00
Charles Kerr
df4564dc39
refactor: don't call deprecated WidgetDelegate API in NativeWindowViews (#46858)
* refactor: don't call RegisterDeleteDelegateCallback()

move NativeWindowViews' on-widget-delegate-destroyed callback logic to
the NativeWindowViews destructor.

Since NativeWindowViews subclasses from WidgetDelegate and |this| *is*
the delegate being destroyed, we can handle this more cleanly in
~NativeWindowViews() instead of in a separate callback.

* chore: remove NativeWindowViews from the grandfathered-classes-that-can-call-deprecated-views-behavior patch

* refactor: don't call RegisterDeleteDelegateCallback()

RegisterDeleteDelegateCallback() is private upstream API, so we
shouldn't be using it.

Move the on-widget-delegate-destroyed callback logic over to our methods
NativeWindowViews::OnWidgetDestroying() and
NativeWindowViews::OnWidgetDestroyed().
2025-05-01 12:07:20 -05:00
David Sanders
4f89c31956
refactor: add EmitDeprecationWarning helper (#46860)
* refactor: add EmitDeprecationWarning helper

Also switches EmitWarning to using Node's ProcessEmitWarningGeneric

* chore: use node namespace for function call
2025-04-30 13:48:35 -05:00
Charles Kerr
25d77fd1ce
refactor: use WidgetDelegate's title property (#46849)
* refactor: use WidgetDelegate::SetTitle()

* Make NativeWindow::SetTitle() and NativeWindow::GetTitle() non-virtual.
  Use WidgetDelegate for their implementation.

* Add NativeWindow::OnTitleChanged(), a new protected virtual method to update
  subclasses (e.g. NativeWindowMac needs to redraw the button proxy).

* In NativeWindowMac, replace SetTitle() and GetTitle() with OnTitleChanged().

* In NativeWindowViews, replace SetTitle() and GetTitle() with OnTitleChanged().

* test: enable BrowserWindow.title tests on Linux

* test: add a test to confirm win.title changes when document.title is set in the renderer
2025-04-30 08:22:27 -07:00
zoy
4641bc9619
fix: fullscreen fillet / recovery is incorrect (#46641)
* fix: fullscreen fillet / recovery is incorrect

Signed-off-by: ZOY\zoy-l <zoy-l@outlook.com>

* fix: maintain frameless consistency on windows 11

* fix: maintain frameless consistency on windows 11

* chore: modify the comments

---------

Signed-off-by: ZOY\zoy-l <zoy-l@outlook.com>
2025-04-28 16:54:08 -04:00