Trait WKWebExtensionWindow

Source
pub unsafe trait WKWebExtensionWindow: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    unsafe fn tabsForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> Retained<NSArray<ProtocolObject<dyn WKWebExtensionTab>>>
       where Self: Sized + Message { ... }
    unsafe fn activeTabForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> Option<Retained<ProtocolObject<dyn WKWebExtensionTab>>>
       where Self: Sized + Message { ... }
    unsafe fn windowTypeForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> WKWebExtensionWindowType
       where Self: Sized + Message { ... }
    unsafe fn windowStateForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> WKWebExtensionWindowState
       where Self: Sized + Message { ... }
    unsafe fn setWindowState_forWebExtensionContext_completionHandler(
        &self,
        state: WKWebExtensionWindowState,
        context: &WKWebExtensionContext,
        completion_handler: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn isPrivateForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn screenFrameForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> CGRect
       where Self: Sized + Message { ... }
    unsafe fn frameForWebExtensionContext(
        &self,
        context: &WKWebExtensionContext,
    ) -> CGRect
       where Self: Sized + Message { ... }
    unsafe fn setFrame_forWebExtensionContext_completionHandler(
        &self,
        frame: CGRect,
        context: &WKWebExtensionContext,
        completion_handler: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn focusForWebExtensionContext_completionHandler(
        &self,
        context: &WKWebExtensionContext,
        completion_handler: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn closeForWebExtensionContext_completionHandler(
        &self,
        context: &WKWebExtensionContext,
        completion_handler: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature WKWebExtensionWindow only.
Expand description

A class conforming to the WKWebExtensionWindow protocol represents a window to web extensions.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn tabsForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> Retained<NSArray<ProtocolObject<dyn WKWebExtensionTab>>>
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and WKWebExtensionTab only.

Called when the tabs are needed for the window.

Parameter context: The context in which the web extension is running.

Returns: An array of tabs in the window.

Defaults to an empty array if not implemented.

Source

unsafe fn activeTabForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> Option<Retained<ProtocolObject<dyn WKWebExtensionTab>>>
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and WKWebExtensionTab only.

Called when the active tab is needed for the window.

Parameter context: The context in which the web extension is running.

Returns: The active tab in the window, which represents the frontmost tab currently in view.

Defaults to nil if not implemented.

Source

unsafe fn windowTypeForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> WKWebExtensionWindowType
where Self: Sized + Message,

Available on crate feature WKWebExtensionContext only.

Called when the type of the window is needed.

Parameter context: The context in which the web extension is running.

Returns: The type of the window.

Defaults toWKWebExtensionWindowTypeNormal if not implemented.

Source

unsafe fn windowStateForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> WKWebExtensionWindowState
where Self: Sized + Message,

Available on crate feature WKWebExtensionContext only.

Called when the state of the window is needed.

Parameter context: The context in which the web extension is running.

Returns: The state of the window.

Defaults toWKWebExtensionWindowStateNormal if not implemented.

Source

unsafe fn setWindowState_forWebExtensionContext_completionHandler( &self, state: WKWebExtensionWindowState, context: &WKWebExtensionContext, completion_handler: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and block2 only.

Called to set the state of the window.

Parameter context: The context in which the web extension is running.

Parameter state: The new state of the window.

Parameter completionHandler: A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.

The implementation of windowStateForWebExtensionContext: is a prerequisite. Without it, this method will not be called.

See also: windowStateForWebExtensionContext:

Source

unsafe fn isPrivateForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> bool
where Self: Sized + Message,

Available on crate feature WKWebExtensionContext only.

Called when the private state of the window is needed.

Parameter context: The context in which the web extension is running.

Returns: YES if the window is private, NO otherwise.

Defaults to NO if not implemented. This value is cached and will not change for the duration of the window or its contained tabs.

Note: To ensure proper isolation between private and non-private data, web views associated with private data must use a different WKUserContentController. Likewise, to be identified as a private web view and to ensure that cookies and other website data is not shared, private web views must be configured to use a non-persistent WKWebsiteDataStore.

Source

unsafe fn screenFrameForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> CGRect
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and objc2-core-foundation only.

Called when the screen frame containing the window is needed.

Parameter context: The context associated with the running web extension.

Returns: The frame for the screen containing the window.

Defaults to CGRectNull if not implemented.

Source

unsafe fn frameForWebExtensionContext( &self, context: &WKWebExtensionContext, ) -> CGRect
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and objc2-core-foundation only.

Called when the frame of the window is needed.

Parameter context: The context in which the web extension is running.

Returns: The frame of the window, in screen coordinates

Defaults to CGRectNull if not implemented.

Source

unsafe fn setFrame_forWebExtensionContext_completionHandler( &self, frame: CGRect, context: &WKWebExtensionContext, completion_handler: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and block2 and objc2-core-foundation only.

Called to set the frame of the window.

Parameter context: The context in which the web extension is running.

Parameter frame: The new frame of the window, in screen coordinates.

Parameter completionHandler: A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.

On macOS, the implementation of both frameForWebExtensionContext: and screenFrameForWebExtensionContext: are prerequisites. On iOS, iPadOS, and visionOS, only frameForWebExtensionContext: is a prerequisite. Without the respective method(s), this method will not be called.

See also: frameForWebExtensionContext:

See also: screenFrameForWebExtensionContext:

Source

unsafe fn focusForWebExtensionContext_completionHandler( &self, context: &WKWebExtensionContext, completion_handler: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and block2 only.

Called to focus the window.

Parameter context: The context in which the web extension is running.

Parameter completionHandler: A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.

No action is performed if not implemented.

Source

unsafe fn closeForWebExtensionContext_completionHandler( &self, context: &WKWebExtensionContext, completion_handler: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate features WKWebExtensionContext and block2 only.

Called to close the window.

Parameter context: The context in which the web extension is running.

Parameter completionHandler: A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.

No action is performed if not implemented.

Trait Implementations§

Source§

impl ProtocolType for dyn WKWebExtensionWindow

Source§

const NAME: &'static str = "WKWebExtensionWindow"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn WKWebExtensionWindow

Implementations on Foreign Types§

Source§

impl<T> WKWebExtensionWindow for ProtocolObject<T>

Implementors§