public sealed class RunicHostedWindowDecision A host policy's decision about a window a guest asked for.
Remarks
Experimental; see docs/experimental.md.
Properties
HostWindow
public IRunicWindow? HostWindow { get; } The host's Window whose page shows the region, or null for the one that declares it.
IsAllowed
public bool IsAllowed { get; } Whether the window opens, in a window of its own or in a region.
IsComponent
public bool IsComponent { get; } Whether the region shows the window as a component in the host page's own document (RunicHostedWindowDecision.EmbedComponent) instead of in a frame.
Message
public string? Message { get; } For a refusal, why, as the guest's failure message; it must not carry a secret.
Region
public string? Region { get; } The name of the region of a host page that shows the window (RunicHostedWindowDecision.Embed), or null for a window of its own.
RegionOptions
public RunicHostedRegionOptions? RegionOptions { get; } How the region shows the window, or null for the defaults.
WindowOptions
public DesktopWindowOptions? WindowOptions { get; } The options the window opens with, or null for the request's. Not used in a region.
Methods
Allow
public static RunicHostedWindowDecision Allow(DesktopWindowOptions? windowOptions = null) Opens the window.
Parameters
windowOptionsThe options to open it with, typically
RunicHostedWindowRequest.WindowOptionschanged with awithexpression, such as a saved placement;nullfor the request's.
Returns
The decision.
Embed
public static RunicHostedWindowDecision Embed(string region) Shows the window in the region region of a host page (region/1), such as an installer's content area between its header and footer, instead of in a window of its own: the page's <runic-hosted-region name="…"> shows the guest's page in a frame. Exactly one of the host's windows must declare the region, now or later; when two declare it now, the guest's open fails with region-ambiguous.
Parameters
regionThe region's name: 1 to 64 ASCII letters, digits, dots, underscores or hyphens.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
Remarks
Only for a request whose RunicHostedWindowRequest.CanEmbed is true and that is not modal; otherwise the guest's open fails with hosted-window-failed. The window is open when the decision applies, whether or not a region shows it yet (RunicHostedWindow.Region).
Embed
public static RunicHostedWindowDecision Embed(string region, RunicHostedRegionOptions options) Shows the window in the region region of a host page, as RunicHostedWindowDecision.Embed does, with options.
Parameters
regionThe region's name.
optionsHow the region shows the window.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
Embed
public static RunicHostedWindowDecision Embed(IRunicWindow hostWindow, string region) Shows the window in the region region of the page of hostWindow, one of this application's Windows, as RunicHostedWindowDecision.Embed does.
Parameters
hostWindowThe host's Window whose page declares the region, now or later.
regionThe region's name.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
Embed
public static RunicHostedWindowDecision Embed(IRunicWindow hostWindow, string region, RunicHostedRegionOptions options) Shows the window in the region region of the page of hostWindow, with options.
Parameters
hostWindowThe host's Window whose page declares the region, now or later.
regionThe region's name.
optionsHow the region shows the window.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
EmbedComponent
public static RunicHostedWindowDecision EmbedComponent(string region) Shows the window in the region region of a host page as a component in the page's own document (trusted component mode, region-component/1) instead of in a frame: the page loads the guest's component build, an ES module from the guest's loopback origin, and the guest's Views render in the page with its theme and layout. Otherwise as RunicHostedWindowDecision.Embed.
Parameters
regionThe region's name: 1 to 64 ASCII letters, digits, dots, underscores or hyphens.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
Remarks
The host page and the guest's component share one JavaScript realm. The guest's code can read the page and use its Bridge, and the page holds the guest's component token and can act as the guest's page. Embed components only of applications of your own vendor, whose code you trust as your own page's. The guest must allow it too (RunicHostedWindowRequest.CanEmbedComponent); for a request where it is false, or a modal one, the guest's open fails with hosted-window-failed, so decide RunicHostedWindowDecision.Embed instead.
A host page with a Content-Security-Policy must allow the guest's origin for its scripts and its connection. Runic serves an embedded host's components from 127.0.0.1 on a port that changes with each run, so such a policy names http://127.0.0.1:* in script-src and ws://127.0.0.1:* in connect-src. The component also has every permission of the host page.
EmbedComponent
public static RunicHostedWindowDecision EmbedComponent(string region, RunicHostedRegionOptions options) Shows the window as a component in the region region of a host page, as RunicHostedWindowDecision.EmbedComponent does, with options.
Parameters
regionThe region's name.
optionsHow the region shows the window; a component has no frame, so
RunicHostedRegionOptions.Permissionsdoes not apply.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
EmbedComponent
public static RunicHostedWindowDecision EmbedComponent(IRunicWindow hostWindow, string region) Shows the window as a component in the region region of the page of hostWindow, as RunicHostedWindowDecision.EmbedComponent does.
Parameters
hostWindowThe host's Window whose page declares the region, now or later.
regionThe region's name.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
EmbedComponent
public static RunicHostedWindowDecision EmbedComponent(IRunicWindow hostWindow, string region, RunicHostedRegionOptions options) Shows the window as a component in the region region of the page of hostWindow, with options.
Parameters
hostWindowThe host's Window whose page declares the region, now or later.
regionThe region's name.
optionsHow the region shows the window.
Returns
The decision.
Exceptions
ArgumentExceptionregionis not a region name.
Refuse
public static RunicHostedWindowDecision Refuse(string? message = null) Refuses the window: the guest's open fails with hosted-window-refused.
Parameters
messageWhy, for the guest's failure message; at most 1,024 characters are sent.
Returns
The decision.