Repository navigation
Extensions: Arc's install sheet with Dia's "It can:" box replaces Chromium's extension install dialog, through a new engine hook - #1101
Conversation
…a made-up prompt until the engine hands Swift the real one (VictorKildahl#998) Victor's pick on VictorKildahl#998: Arc 1.176.0's dialog ("Add the “Snake” extension to Arc?", "This extension requires no special permissions.", Cancel ESC and a blue Add Extension ↩, under Cra's icon with an arrow from the extension's) with Dia's "It can:" box listing the permissions in place of Arc's line. This is the sheet alone: Chromium's own prompt still shows, since the engine doesn't hand Swift the prompt yet. The engine's hook and the switch to this sheet come after. ExtensionInstallAsk (CraCore) is the prompt: Chromium's prompt type by what it asks, the name, the permission lines with the lines under them, and the parts this sheet doesn't draw. init?(bridge:) reads the dictionary the engine is to send, its keys in ExtensionInstallAsk.Key; a key of the wrong shape reads as no prompt, so that a line can't drop out of what the user agrees to. ExtensionInstallDialogText has the words and takes(_:): only a plain install with nothing past its permissions is Cra's to ask; turning an extension back on, a request for more permissions, an install from outside or another device, a repair, a request to an administrator and any prompt with an extra part stay Chromium's. Add Extension stays off for Chromium's 0.5 s (g_install_delay_in_ms on Chromium's main; Arc's own delay isn't measured). ExtensionInstallPrompts.offer shows it on AppDialog: the .extensionInstall icon row, DialogListBox for the box, and holdsDefault for the delay, on the app's Scheduler. Escape, Return, answerDialog= and the parent window are AppDialog's as before. It returns nil, leaving the prompt to Chromium, for a prompt it doesn't take or a window with a sheet up. cra://debug?extensionInstallAsk=<name>[&lines=a|b] offers a made-up prompt through it, and extensionInstall=<label> reads the sheet (docs/development.md). Measured on 2x screenshots of Arc's and Dia's sheets (30 Nov 2026, docs/arc-reverse-engineering.md): Cra's sheet is Arc's 450 × 243 pt, its title, line and buttons within half a point and its icon row within a point; the box is Dia's within half a point. Add Extension is 2.5 pt wider than Arc's, from the shared DialogButton, unchanged here. Tests: ExtensionInstallAskTests, DialogActionsTests.aHeldDefaultIsOffAndNothingElseIs and DialogPaletteTests.theInstallSheetsArrowAndBoxAreMixesOfTheInk; the Dialogs harness's checkExtensionInstallSheet (Return does nothing for 0.5 s on a manual clock, one answer each for Add Extension, Cancel, Escape and a window closed under the sheet, the box drawn only with lines); scenario extension-install-dialog-drawn, which fails on main (none of its nine log lines). Locked under VictorKildahl#998.
… first, so Cra's own sheet can ask it (VictorKildahl#998) The second half of VictorKildahl#998, the engine's: until now Chromium showed its own install dialog for every prompt and Cra's sheet only drew made-up ones. cra-extension-install-prompt.patch has ShowExtensionInstallDialogImpl ask cra::g_extension_install_prompt (hooks/cra_extension_install_hook.h) before it makes its dialog, with the dialog's own delay before Add takes a click (g_install_delay_in_ms). False, or no hook set, and Chromium's dialog shows as before. It applies to the 159.0.8154.45 file unchanged (git apply --check, no offset), and to no file another patch touches. The bridge sets the hook (AskExtensionInstall, as MakeCraPrompt for permission prompts): for a page of Cra's whose delegate answers the new optional browser:asksExtensionInstall:icon:acceptDelay:completion: (CraCEF.h), cra/extension_install_prompt.mm hands over the prompt as CraCore's ExtensionInstallAsk dictionary (Chromium's type, the name as its title shows it, each permission line with the lines under it, and siteAccess, storeData and parentApproval for the parts Cra's sheet doesn't draw) and the extension's icon. The app returns a block that takes its sheet down, or nil to leave the prompt to Chromium. Taken, the layer holds what the dialog would have held and runs done once, as the dialog does: Add Extension accepts (OnDialogAccepted, ACCEPTED); Cancel, Escape and the window closing cancel (OnDialogCanceled, USER_CANCELED); and the extension being uninstalled or its profile shutting down cancel too, taking the sheet down on the next turn, as the dialog's widget closes then. An answer after that finds nothing to answer. The app calls nothing new in the engine: the engine asks the page's delegate, which the app already registers, and only after respondsToSelector:. An app without the method gets Chromium's dialog; an engine without the patch never asks. Needs an engine build, which this commit doesn't change the pin for.
…engine hands it over, in browser and Little Windows (VictorKildahl#998) The sheet from the first half of VictorKildahl#998 (Arc's dialog with Dia's "It can:" box) now takes Chromium's own prompt from an engine with cra-extension-install-prompt.patch. BrowserManager answers browser:asksExtensionInstall:… for its pages and passes it to its window (BrowserManagerDelegate, nil by default), and LittleWindowController for its page; both go to AppDelegate.askExtensionInstall, which reads the dictionary (ExtensionInstallAsk), offers it over that window through ExtensionInstallPrompts.offer, logs as cra://debug?extensionInstallAsk= did, and returns how to take the sheet down. Nil, and Chromium's dialog shows, for a prompt the sheet doesn't take (anything but a plain install), a dictionary Cra can't read, or a window with a sheet up. The debug hook now goes through the same function, so its scenario covers that path. Add Extension stays off for the engine's own delay (offer's acceptDelay, Chromium's 0.5 s by default, as before for the made-up prompt). Chromium puts "• " before each line under a permission (InstallPromptPermissions); ExtensionInstallAsk drops it, since the box draws those lines under the permission's own bullet. On today's engine nothing changes: it never asks, and the app calls nothing new in it (the only new engine-facing name is the optional delegate method the engine calls). The app's engine imports are the same six Objective-C classes, all exported by engine-159.0.8154.45-24. Tests: ExtensionInstallAskTests.theEngineHooksDictionaryReads (the dictionary as the engine builds it, empty arrays and Chromium's bullets included), locked under VictorKildahl#998. The harness's checkExtensionInstallSheet and the scenario extension-install-dialog-drawn are unchanged and keep their locks.
VictorKildahl#998) docs/chromium-engine.md has the hook under Status, for the next engine release; docs/development.md says the debug hook goes the engine's way; docs/arc-reverse-engineering.md's VictorKildahl#998 notes get their second half. The comment at the top of extension-install-dialog-drawn no longer says the engine doesn't hand the prompt over (comments only, its lock holds). On an engine with cra-extension-install-prompt.patch, extension-crx-drop (VictorKildahl#593) and extension-dialogs (VictorKildahl#349) meet Cra's sheet instead of the Chromium dialog they expect, and stop passing; docs/chromium-engine.md says so. They are left as they are here: rewriting a locked test is the maintainer's call. A scenario that asks the engine's real prompt waits for that engine too, since on the pinned one none of its lines comes.
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge with the engine pin unchanged. SummaryAdds Cra’s extension install sheet, using Arc’s layout and Dia’s permission box.
No new actionable issues were found. Builds, scenarios and visual checks were not run in this Linux environment.
|
# Conflicts: # docs/chromium-engine.md # engine/chromium/patches/series
|
While you look at this, I am covering more of the list under "What this PR does not cover". Each item comes as a new commit on this branch, and I update the text when it is in:
Two items stay out of my reach: the engine's own cancel when the extension is uninstalled while the sheet is up, and an x64 engine, because I build for arm64 only. |
|
Thanks, @tonibiocic! This is on main as c268d34: the sheet, the layer and the patch. Engine -4 builds with it (in progress now), and once -4 is pinned I'll switch On today's engine (.74-3), |
…crashes Cra (crash-page-enable-no-host); WebRTC as in Chrome and Arc (#1046); Cra's extension install sheet (#998) When Chrome shows a prerendered page in a tab, it moves that page's DevTools host onto the tab and disconnects the one already there, whose sessions stay attached to no page. Page.enable through such a session read the missing page (PageHandler::Enable, the one Page method without the check). The engine now skips that read, and Cra's own page session follows the page to its new host (its page scripts go on again after a prerendered page is shown). Scenario page-session-host-disconnected disconnects the host as Chrome does (cra://debug?pageSession= disconnect) and enables Page from a new client there: signal 11 on the engine without the fix, passes on -4. -4 also carries #1046's two layer edits (mDNS-masked local address, Chrome's default WebRTC IP policy; its scenario follows) and #1101's install-sheet patch, already on main. web-features on -4: everything passes except library-swipe-out-still-pointer, which fails the same way with engine -3 on today's main (an app-side change, not the engine). Co-Authored-By: Claude <noreply@anthropic.com>
…, not Chromium's dialog (#998), in the #593, #349 and #1065 scenarios Engine .74-4 hands Chromium's install prompt to the app (#1101), so a .crx dropped on chrome://extensions and a store page's install meet Arc's install sheet over the window: it asks with Add Extension off for a moment, then Add Extension installs (#593, #1065); the store's prompt is on the page's window and on screen (#349). Changed with Victor's OK (2 Dec). Checked on -4's own build: all three and extension-install-dialog-drawn pass. Co-Authored-By: Claude <noreply@anthropic.com>
|
Shipped in Cra 0.1.62: https://github.com/VictorKildahl/cra/releases/tag/v0.1.62. Thank you @tonibiocic! |
When you add an extension, Cra asks in its own sheet, not in Chromium's dialog. The sheet is Arc's install dialog with Dia's "It can:" box, which lists each permission that the extension asks for. So an install in Cra looks as in Arc, and no longer as in Chrome. A new engine hook hands the install prompt to Cra, so users get the sheet with the first engine release that has the hook.
What and why
You asked for this sheet on #998: "Please do a match of both". Part of #998. Users see Cra's sheet only after an engine release with this patch, so this PR does not close the issue.
Today a plain install, from a store page or from a .crx dropped on chrome://extensions, shows Chromium's dialog as a sheet over Cra's window. Swift gets only the window of that dialog and never the prompt's data. So the change needs a hook in the engine, and #998 described that hook before I wrote it. This PR has both parts: the sheet in the app, and the patch and the layer code for the engine.
On engine -28, which main pins since c64d064, nothing changes for users. That engine has no part of this patch and never hands the prompt to the app, so Chromium's own dialog still shows. Cra's sheet comes with the next engine release built with this patch, -29 if the next release follows -28. The app calls nothing new in the engine. The engine asks the page's delegate through one optional method, and only after
respondsToSelector:. So this PR is safe to merge before you rebuild the engine, and it does not change the engine pin. The section "After the next engine release" says what changes in the tests with that release.With this PR:
Add the “<name>” extension to Cra?. Cancel has ESC, and a blue Add Extension has ↩.This extension requires no special permissions.. With permissions, Dia's "It can:" box takes the place of that line, with a bullet for each permission. The lines that Chromium puts under a permission, such as its sites, follow it in the box.g_install_delay_in_ms, which is 500 ms in 159.0.8154.45. Cancel and Escape work at once.ExtensionInstallDialogText.takes). Every other prompt type stays in Chromium's dialog, such as a prompt to turn an extension back on or a request for more permissions. External and remote installs, repairs and requests to an administrator also stay there. A prompt with a part that the sheet does not draw also stays there: the site access choice, Web Store data or a parent's approval. So does a prompt that Cra cannot read, and a prompt for a window that already has a sheet.BrowserManagerpasses the prompt to its window, andLittleWindowControlleranswers for its own page. Both go toAppDelegate.askExtensionInstall.cra-extension-install-prompt.patchmakesShowExtensionInstallDialogImplaskcra::g_extension_install_promptbefore it makes its dialog. When the hook returns false, or no hook is set, Chromium's dialog shows as before. The bridge sets the hook (AskExtensionInstallinbridge.mm), as it setsg_permission_promptfor permission prompts.cra/extension_install_prompt.mmhands the prompt to the app as a dictionary, with the extension's icon. When the app takes the prompt, the layer holds what the dialog holds and runsdoneonce, as the dialog does. Add Extension accepts. Cancel, Escape and a closed window cancel. When the extension is uninstalled or its profile shuts down, the layer cancels. It takes the sheet down on the next turn, as Chromium closes its dialog then.CraCEF.hgets one@optionaldelegate method,browser:asksExtensionInstall:icon:acceptDelay:completion:. An app without it gets Chromium's dialog.ExtensionInstallAskreads the dictionary, andExtensionInstallDialogTextholds the words. A key of the wrong shape reads as no prompt, and Chromium's dialog then shows. So a permission line that Cra cannot read is never left out of what the user agrees to.AppDialoggets the icon row (.extensionInstall), the box (DialogListBox) andholdsDefaultfor the delay.DialogPalettegets the arrow's colour and the box's fill. The new parameters default to the old values, so the other dialogs keep their layout.cra://debug?extensionInstallAsk=<name>offers a made-up prompt the same way as the engine does, andcra://debug?extensionInstall=<label>reads the sheet. docs/development.md lists them.No data-folder file changes its format, and no setting is added.
How it follows "a match of both"
Arc 1.176.0's sheet gives the layout: the icon row, the title, Arc's line, Cancel with ESC and a blue Add Extension with ↩. Dia gives the "It can:" box, which takes the place of Arc's line when the extension asks for permissions. Arc's title names Arc, so Cra's title names Cra. Dia's shorter title and its Add to Dia button are not used.
I measured Arc's and Dia's sheets on 2x screenshots, so to about half a point. docs/arc-reverse-engineering.md has the figures. Without permissions, Cra's sheet is Arc's 450 × 243 pt. The title, the line and the buttons are within half a point of Arc's, and the icon row is within one point. The box is within half a point of Dia's. Add Extension is 2.5 pt wider than Arc's, because of the shared
DialogButton, which this PR does not change.Arc 1.176.0 and Dia:
Cra's sheet from this change, drawn from a made-up prompt through
cra://debug?extensionInstallAsk=with Snake's icon. Snake asks for no permissions, so the three lines in the second picture are made up. I took both pictures before I added the engine part.Cra today, and with this PR on an engine without the patch, such as -28: Chromium's own dialog over the window, for the made-up store page of
extension-dialogs.The engine patch
cra-extension-install-prompt.patchadds 11 lines to one file,chrome/browser/ui/views/extensions/extension_install_dialog_view.cc. It adds the include of the hook header, and oneifinShowExtensionInstallDialogImplbefore the dialog is made. It applies to the 159.0.8154.45 file with no offset.apply-patches.pyapplies it, and a second run writes nothing. When a Chrome update changes the lines around thatif, the patch needs work, as every patch inseriesdoes.The patch is the last line of
series, afterblink-detached-realm-serialization.patch. No other patch inseriestouches that file, so its place does not change what any other patch applies to. I put it last because it is the newest patch.The hook header,
hooks/cra_extension_install_hook.h, goes into the tree the same way ascra_permission_hook.h.apply.shcopies it tochrome/browser/withcp.apply-patches.pydoes not manage the hook headers, so this header has its owncpline inapply.sh, next to the line forcra_permission_hook.h.The layer code is
cra/extension_install_prompt.handcra/extension_install_prompt.mm, added tocra/BUILD.gn.After the next engine release
On an engine with this patch, three locked scenarios meet Cra's sheet instead of Chromium's dialog.
extension-crx-drop(#593),extension-dialogs(#349) andextension-crx-drop-mv2(#1065) each wait forexpect-log Chromium dialog [0-9]+ shown over window. On my engine build, which "How I tested it" describes, #593 and #349 each failed 2 of 2 runs at that line, on f4b9c26b. The logs showed Cra's sheet in place of Chromium's dialog: for #593 with Arc's line, and for #349 with "It can:" and five lines. #1065 came to main after that build, so it did not run there, but it will probably fail in the same way. On engine -28, as on -26, #593 and #349 still meet Chromium's dialog.This PR leaves these scenarios as they are, because it must not change a locked test (docs/reviewing.md, testing.md rule 8).
A second PR is ready, and it goes in together with the engine release and the pin bump. It changes
extension-crx-drop,extension-crx-drop-mv2andextension-dialogsso that each issue's promise holds on Cra's sheet.extension-crx-dropandextension-crx-drop-mv2answer the sheet withcra://debug?answerDialog=Add Extensionand still expect the extension installed and on.extension-dialogsreads the sheet withcra://debug?extensionInstall=and expects it on screen.extension-remove(#484) andchromium-dialog-movedthen still test the placement of Chromium's dialogs, because they ask the remove dialog. The patch does not touch that dialog. The changed scenarios fail on an engine without the patch, so they cannot go in before the engine release.The second PR also brings the scenario
extension-install-engine-prompt, locked under #998. It dropsDropped.crxon chrome://extensions with developer mode on, asextension-crx-dropdoes. The engine's prompt comes up in Cra's sheet with Arc's line and Add Extension off. Cancel installs nothing. Dropped again, Add Extension installs the extension, and it is on. Areject-logline checks that Chromium's dialog never shows. On my engine build, its first version waited 1 s after the drop and then expected Add Extension on. But Chromium's delay starts when the sheet shows, after Chromium unpacks the .crx. In one of two runs on f4b9c26b, the sheet came 516 ms after the drop, so the readout still saidadd=off. The fix, 109947c0, reads the sheet every 0.5 s, up to 10 times, until Add Extension is on. With it, the scenario passed 3 of 3 runs on 109947c0, and the second PR has the same scenario file. On engine -26, which has no part of the patch, it failed 2 of 2 runs on 25811976, and Chromium's own dialog showed instead.Chromium writes the permission lines in the Mac's language, and Cra's title and buttons are English, so on a German Mac the sheet shows German lines under English buttons until Cra is localized (#240).
I built and tested the engine part in full so that you can judge it on results, while the first commit works without the engine.
How I tested it
ExtensionInstallAskTests, 10 tests, read the engine's dictionary. They drop Chromium's "• " before each site, give each prompt type its kind, and read a key of the wrong shape as no prompt. They also check the words with and without permissions, that only a plain install is taken, and the 0.5 s delay.DialogActionsTests.aHeldDefaultIsOffAndNothingElseIs: while the delay runs, only Add Extension is off.DialogPaletteTests.theInstallSheetsArrowAndBoxAreMixesOfTheInk: the arrow is Arc's #575B6B, and the box's fill is 5 % of the ink over the card.checkExtensionInstallSheetinTests/DialogTests.swift, on aManualScheduler. Return does nothing at 0.49 s and adds the extension at 0.5 s. Cancel, Escape and a window closed under the sheet each answer no, once. A prompt that stays Chromium's shows no sheet, and a second prompt while a sheet is up shows none either. The box is drawn only with permissions, and the arrow is drawn in #575B6B.extension-install-dialog-drawn. It asks made-up prompts through the readout. First, Arc's line shows with Add Extension off and then on, and Cancel answers. Then the "It can:" box shows two lines, and Add Extension answers. Last, a prompt to turn an extension back on stays Chromium's. Without this change it fails all 9 of its log lines.The engine part needs an engine build, so I built one. On my Mac,
scripts/build-chromium.sh allbuilt Chromium 159.0.8154.45 with this patch for arm64, and it ended with exit 0. So the layer code and the patch compile. Thenscripts/build.shbuilt the app on that engine withCRA_ENGINE_OUT. That build is of this branch on main at 8a2939b, before its rebase onto b828c7b on 2026-12-01. So its engine has this patch, but notcra-shown-pages-tabs-discard.patch,cra-service-worker-bfcache-evict.patchandblink-detached-realm-serialization.patch, which main added since, and not the change that -28 made toauto-pip-tab-hidden.patch. The rebase onto b828c7b changed only context lines inseries,Tests/promises.lockanddocs/chromium-engine.md. I ran the scenarios that meet the engine's prompt in that app, and the section "After the next engine release" has their results.The branch is 4 commits on main at 1d93d47, and its head is d69314a. 27f1ff4 adds the sheet, d01f2ab adds the engine part, and 4131239 connects the app to the hook. d69314a adds the docs. I rebased the branch onto 1d93d47 and split it on 2026-12-02. The split moved the scenario
extension-install-engine-promptand its timing fix to the second PR. Before that, the branch had five commits on main at b828c7b, with 25811976 as the head, and that head also held the scenario. The first four checks below open no window, and they ran on d69314a. The other checks below ran on 25811976, on engine -26.scripts/lint.py:lint: clean (29 grandfathered findings)scripts/test.sh core:✘ Test run with 3311 tests in 567 suites failed after 6.107 seconds with 2 issues.Both issues are in one test,AppIconGridTests.theTilesAreTheIconsAsMacOSDrawsThem(feat: new native designs for all icons #935), so 3310 tests pass. AtAppIconGridTests.swift:87,scripts/render-icon-as-macos.shexits 1 on my Mac, so the test has no picture to compare. This change does not touch the app icon.scripts/promises.py:promises: 2439 tests pinned for 584 issues and 33 crash fixes and 22 web features, unchanged. The lock has 14 new lines under Add an extension: replace Chromium's install dialog with Arc's (or Dia's) dialog, which needs an engine hook #998.scripts/build.sh: exit 0, onengine-159.0.8154.45-28.scripts/test.sh: fails in 2 of 2 runs, only onAppIconGridTests.theTilesAreTheIconsAsMacOSDrawsThem(feat: new native designs for all icons #935). Each run has 3201 tests in 549 suites and 2 issues, both in that one test. Main at b828c7b fails the same test and no other.scripts/test-dialogs.sh:Dialogs: 105 checks passedandPage dialog sheets passed.extension-install-dialog-drawn: passed.extension-crx-drop(Cra donot support .crx #593) andextension-dialogs(Extension icons are blurry and installation dialogs are clipped or stuck offscreen #349), which meet Chromium's dialog on -26: both passed.scripts/coverage.py: not run. CI posts the coverage on this PR.Before that, on 292af6e6, which held only the first commit, on engine -24: the dialog harness passed 105 checks, and
extension-install-dialog-drawn,extension-crx-dropandextension-dialogspassed.What this PR does not cover
extension-dialogsand a dropped .crx.LittleWindowControllerpasses it on as a browser window does, but no test asks one there.