electron/lib/browser/api
Samuel Attard 49aba471dc
feat: add support for associating a Menu with a WebFrameMain (#45138)
* feat: add support for associating a Menu with a WebFrameMain

This allows certain OS level features to activate such as Writing Tools, Autofill.. and Services.

There appears to be a bug in macOS where the responder chain isn't traversed if the menu is not popped up using an event, as such we spoof a fake mouse event at the write coordinates in the right window and use that to open the menu.

* build: fix build on non-mac

* build: oops missed a header

* fix: safely handle optional T* by checking nullptr too

* build: fix gn check and build errors

* docs: suggested changes

* feat: default `frame` to `window.webContents.mainFrame` when possible

* fix: avoid deref nullptr view

* Revert "feat: default `frame` to `window.webContents.mainFrame` when possible"

This reverts commit 2e888368199317d67f6ad931a7e9eff0295c4b1b.

* fix: lint

* Remove redundant scoped objects

This code, including the comments, matches almost exactly the behavior of this argument to the function.

* Add ScopedPumpMessagesInPrivateModes patch

* More null pointer safety

---------

Co-authored-by: clavin <clavin@electronjs.org>
2025-03-28 11:50:07 -07:00
..
auto-updater build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
exports build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
views build: ensure that electron/lib/browser can only use browser or common imports (#24512) 2020-07-13 09:58:49 -07:00
app.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
auto-updater.ts chore: tsify auto-updater (#24328) 2020-07-01 12:27:12 -07:00
base-window.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
browser-view.ts fix: remove resize listener when BrowserWindow closed (#43972) 2024-09-27 10:34:00 -04:00
browser-window.ts refactor: unfilter unresponsive events (#44629) 2024-11-13 17:59:13 -08:00
clipboard.ts refactor: split clipboard module implementation for browser / renderer (#38429) 2023-05-25 20:36:12 +09:00
content-tracing.ts refactor: prevent consistent early exception (#24191) 2020-06-22 20:32:45 -07:00
crash-reporter.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
desktop-capturer.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
dialog.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
global-shortcut.ts refactor: prevent consistent early exception (#24191) 2020-06-22 20:32:45 -07:00
in-app-purchase.ts feat: added username to IAP purchaseProduct method (#35902) 2022-12-12 10:11:48 -08:00
ipc-main.ts feat: add WebContents.ipc (#34959) 2022-08-03 16:55:12 -07:00
menu-item-roles.ts build: update some build dependencies (#43882) 2024-09-26 00:12:11 -07:00
menu-item.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
menu-utils.ts refactor: replace .forEach() with for-of (#39691) 2023-08-31 23:36:43 +09:00
menu.ts feat: add support for associating a Menu with a WebFrameMain (#45138) 2025-03-28 11:50:07 -07:00
message-channel.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
module-list.ts feat: ServiceWorkerMain (#45232) 2025-01-24 08:33:44 -05:00
native-theme.ts chore: move main process only accessible API bindings away from common (#34634) 2022-06-21 16:34:56 +09:00
net-fetch.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
net-log.ts build: ensure that electron/lib/browser can only use browser or common imports (#24512) 2020-07-13 09:58:49 -07:00
net.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
notification.ts chore: move main process only accessible API bindings away from common (#34634) 2022-06-21 16:34:56 +09:00
power-monitor.ts fix: make sure classes in lib correctly implement Electron interfaces (#40291) 2023-10-25 14:02:15 -04:00
power-save-blocker.ts refactor: prevent consistent early exception (#24191) 2020-06-22 20:32:45 -07:00
protocol.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
push-notifications.ts feat: Enable APNS registration + notification delivery in macOS apps (#33574) 2022-07-12 08:38:49 -07:00
safe-storage.ts feat: add electron.safeStorage encryption API (#30020) 2021-08-05 15:12:54 -07:00
screen.ts chore: move main process only accessible API bindings away from common (#34634) 2022-06-21 16:34:56 +09:00
service-worker-main.ts feat: service worker preload scripts for improved extensions support (#44411) 2025-01-31 09:32:45 -05:00
session.ts refactor: move extension APIs to session.extensions (#45597) 2025-02-21 17:36:51 -06:00
share-menu.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
system-preferences.ts chore: remove deprecated systemPreferences.isAeroGlassEnabled() (#45563) 2025-02-18 18:59:00 -06:00
touch-bar.ts build: update some build dependencies (#43882) 2024-09-26 00:12:11 -07:00
tray.ts refactor: prevent consistent early exception (#24191) 2020-06-22 20:32:45 -07:00
utility-process.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
view.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00
web-contents-view.ts build: ensure that electron/lib/browser can only use browser or common imports (#24512) 2020-07-13 09:58:49 -07:00
web-contents.ts refactor: dispatch IPC messages from Session (#45452) 2025-02-17 16:36:28 -05:00
web-frame-main.ts build: add import/order eslint rule (#44085) 2024-10-02 19:10:44 -07:00