objc2_web_kit/generated/
WKWebExtensionContext.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern "C" {
14    /// Indicates a ``WKWebExtensionContext`` error.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontexterrordomain?language=objc)
17    pub static WKWebExtensionContextErrorDomain: &'static NSErrorDomain;
18}
19
20/// Constants used by ``NSError`` to indicate errors in the ``WKWebExtensionContext`` domain.
21///
22/// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontexterror?language=objc)
23// NS_ERROR_ENUM
24#[repr(transparent)]
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
26pub struct WKWebExtensionContextError(pub NSInteger);
27impl WKWebExtensionContextError {
28    #[doc(alias = "WKWebExtensionContextErrorUnknown")]
29    pub const Unknown: Self = Self(1);
30    #[doc(alias = "WKWebExtensionContextErrorAlreadyLoaded")]
31    pub const AlreadyLoaded: Self = Self(2);
32    #[doc(alias = "WKWebExtensionContextErrorNotLoaded")]
33    pub const NotLoaded: Self = Self(3);
34    #[doc(alias = "WKWebExtensionContextErrorBaseURLAlreadyInUse")]
35    pub const BaseURLAlreadyInUse: Self = Self(4);
36    #[doc(alias = "WKWebExtensionContextErrorNoBackgroundContent")]
37    pub const NoBackgroundContent: Self = Self(5);
38    #[doc(alias = "WKWebExtensionContextErrorBackgroundContentFailedToLoad")]
39    pub const BackgroundContentFailedToLoad: Self = Self(6);
40}
41
42unsafe impl Encode for WKWebExtensionContextError {
43    const ENCODING: Encoding = NSInteger::ENCODING;
44}
45
46unsafe impl RefEncode for WKWebExtensionContextError {
47    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50extern "C" {
51    /// This notification is sent whenever a ``WKWebExtensionContext`` has new errors or errors were cleared.
52    ///
53    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontexterrorsdidupdatenotification?language=objc)
54    pub static WKWebExtensionContextErrorsDidUpdateNotification: &'static NSNotificationName;
55}
56
57/// Constants used to indicate permission status in ``WKWebExtensionContext``.
58///
59/// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextpermissionstatus?language=objc)
60// NS_ENUM
61#[repr(transparent)]
62#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
63pub struct WKWebExtensionContextPermissionStatus(pub NSInteger);
64impl WKWebExtensionContextPermissionStatus {
65    #[doc(alias = "WKWebExtensionContextPermissionStatusDeniedExplicitly")]
66    pub const DeniedExplicitly: Self = Self(-3);
67    #[doc(alias = "WKWebExtensionContextPermissionStatusDeniedImplicitly")]
68    pub const DeniedImplicitly: Self = Self(-2);
69    #[doc(alias = "WKWebExtensionContextPermissionStatusRequestedImplicitly")]
70    pub const RequestedImplicitly: Self = Self(-1);
71    #[doc(alias = "WKWebExtensionContextPermissionStatusUnknown")]
72    pub const Unknown: Self = Self(0);
73    #[doc(alias = "WKWebExtensionContextPermissionStatusRequestedExplicitly")]
74    pub const RequestedExplicitly: Self = Self(1);
75    #[doc(alias = "WKWebExtensionContextPermissionStatusGrantedImplicitly")]
76    pub const GrantedImplicitly: Self = Self(2);
77    #[doc(alias = "WKWebExtensionContextPermissionStatusGrantedExplicitly")]
78    pub const GrantedExplicitly: Self = Self(3);
79}
80
81unsafe impl Encode for WKWebExtensionContextPermissionStatus {
82    const ENCODING: Encoding = NSInteger::ENCODING;
83}
84
85unsafe impl RefEncode for WKWebExtensionContextPermissionStatus {
86    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
87}
88
89extern "C" {
90    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly granted permissions.
91    ///
92    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextpermissionsweregrantednotification?language=objc)
93    pub static WKWebExtensionContextPermissionsWereGrantedNotification: &'static NSNotificationName;
94}
95
96extern "C" {
97    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly denied permissions.
98    ///
99    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextpermissionsweredeniednotification?language=objc)
100    pub static WKWebExtensionContextPermissionsWereDeniedNotification: &'static NSNotificationName;
101}
102
103extern "C" {
104    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly removed granted permissions.
105    ///
106    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextgrantedpermissionswereremovednotification?language=objc)
107    pub static WKWebExtensionContextGrantedPermissionsWereRemovedNotification:
108        &'static NSNotificationName;
109}
110
111extern "C" {
112    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly removed denied permissions.
113    ///
114    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextdeniedpermissionswereremovednotification?language=objc)
115    pub static WKWebExtensionContextDeniedPermissionsWereRemovedNotification:
116        &'static NSNotificationName;
117}
118
119extern "C" {
120    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly granted permission match patterns.
121    ///
122    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextpermissionmatchpatternsweregrantednotification?language=objc)
123    pub static WKWebExtensionContextPermissionMatchPatternsWereGrantedNotification:
124        &'static NSNotificationName;
125}
126
127extern "C" {
128    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly denied permission match patterns.
129    ///
130    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextpermissionmatchpatternsweredeniednotification?language=objc)
131    pub static WKWebExtensionContextPermissionMatchPatternsWereDeniedNotification:
132        &'static NSNotificationName;
133}
134
135extern "C" {
136    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly removed granted permission match patterns.
137    ///
138    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextgrantedpermissionmatchpatternswereremovednotification?language=objc)
139    pub static WKWebExtensionContextGrantedPermissionMatchPatternsWereRemovedNotification:
140        &'static NSNotificationName;
141}
142
143extern "C" {
144    /// This notification is sent whenever a ``WKWebExtensionContext`` has newly removed denied permission match patterns.
145    ///
146    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextdeniedpermissionmatchpatternswereremovednotification?language=objc)
147    pub static WKWebExtensionContextDeniedPermissionMatchPatternsWereRemovedNotification:
148        &'static NSNotificationName;
149}
150
151/// Constants for specifying ``WKWebExtensionContext`` information in notifications.
152///
153/// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextnotificationuserinfokey?language=objc)
154// NS_TYPED_EXTENSIBLE_ENUM
155pub type WKWebExtensionContextNotificationUserInfoKey = NSString;
156
157extern "C" {
158    /// The corresponding value represents the affected permissions in ``WKWebExtensionContext`` notifications.
159    ///
160    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextnotificationuserinfokeypermissions?language=objc)
161    pub static WKWebExtensionContextNotificationUserInfoKeyPermissions:
162        &'static WKWebExtensionContextNotificationUserInfoKey;
163}
164
165extern "C" {
166    /// The corresponding value represents the affected permission match patterns in ``WKWebExtensionContext`` notifications.
167    ///
168    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontextnotificationuserinfokeymatchpatterns?language=objc)
169    pub static WKWebExtensionContextNotificationUserInfoKeyMatchPatterns:
170        &'static WKWebExtensionContextNotificationUserInfoKey;
171}
172
173extern_class!(
174    /// A ``WKWebExtensionContext`` object represents the runtime environment for a web extension.
175    ///
176    /// This class provides methods for managing the extension's permissions, allowing it to inject content, run
177    /// background logic, show popovers, and display other web-based UI to the user.
178    ///
179    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontext?language=objc)
180    #[unsafe(super(NSObject))]
181    #[thread_kind = MainThreadOnly]
182    #[derive(Debug, PartialEq, Eq, Hash)]
183    pub struct WKWebExtensionContext;
184);
185
186extern_conformance!(
187    unsafe impl NSObjectProtocol for WKWebExtensionContext {}
188);
189
190impl WKWebExtensionContext {
191    extern_methods!(
192        #[unsafe(method(new))]
193        #[unsafe(method_family = new)]
194        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
195
196        #[unsafe(method(init))]
197        #[unsafe(method_family = init)]
198        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
199
200        #[cfg(feature = "WKWebExtension")]
201        /// Returns a web extension context initialized with the specified extension.
202        ///
203        /// Parameter `extension`: The extension to use for the new web extension context.
204        ///
205        /// Returns: An initialized web extension context.
206        #[unsafe(method(contextForExtension:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn contextForExtension(extension: &WKWebExtension) -> Retained<Self>;
209
210        #[cfg(feature = "WKWebExtension")]
211        /// Returns a web extension context initialized with a specified extension.
212        ///
213        /// Parameter `extension`: The extension to use for the new web extension context.
214        ///
215        /// Returns: An initialized web extension context.
216        ///
217        /// This is a designated initializer.
218        #[unsafe(method(initForExtension:))]
219        #[unsafe(method_family = init)]
220        pub unsafe fn initForExtension(
221            this: Allocated<Self>,
222            extension: &WKWebExtension,
223        ) -> Retained<Self>;
224
225        #[cfg(feature = "WKWebExtension")]
226        /// The extension this context represents.
227        #[unsafe(method(webExtension))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn webExtension(&self) -> Retained<WKWebExtension>;
230
231        #[cfg(feature = "WKWebExtensionController")]
232        /// The extension controller this context is loaded in, otherwise `nil` if it isn't loaded.
233        #[unsafe(method(webExtensionController))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn webExtensionController(&self) -> Option<Retained<WKWebExtensionController>>;
236
237        /// A Boolean value indicating if this context is loaded in an extension controller.
238        #[unsafe(method(isLoaded))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn isLoaded(&self) -> bool;
241
242        /// All errors that occurred in the extension context.
243        ///
244        /// Provides an array of all parse-time and runtime errors for the extension and extension context, with repeat errors
245        /// consolidated into a single entry for the original occurrence. If no errors occurred, an empty array is returned.
246        #[unsafe(method(errors))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn errors(&self) -> Retained<NSArray<NSError>>;
249
250        /// The base URL the context uses for loading extension resources or injecting content into webpages.
251        ///
252        /// The default value is a unique URL using the `webkit-extension` scheme.
253        /// The base URL can be set to any URL, but only the scheme and host will be used. The scheme cannot be a scheme that is
254        /// already supported by ``WKWebView`` (e.g. http, https, etc.) Setting is only allowed when the context is not loaded.
255        #[unsafe(method(baseURL))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn baseURL(&self) -> Retained<NSURL>;
258
259        /// Setter for [`baseURL`][Self::baseURL].
260        ///
261        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
262        #[unsafe(method(setBaseURL:))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn setBaseURL(&self, base_url: &NSURL);
265
266        /// A unique identifier used to distinguish the extension from other extensions and target it for messages.
267        ///
268        /// The default value is a unique value that matches the host in the default base URL. The identifier can be any
269        /// value that is unique. Setting is only allowed when the context is not loaded. This value is accessible by the extension via
270        /// `browser.runtime.id` and is used for messaging the extension via `browser.runtime.sendMessage()`.
271        #[unsafe(method(uniqueIdentifier))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn uniqueIdentifier(&self) -> Retained<NSString>;
274
275        /// Setter for [`uniqueIdentifier`][Self::uniqueIdentifier].
276        ///
277        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
278        #[unsafe(method(setUniqueIdentifier:))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn setUniqueIdentifier(&self, unique_identifier: &NSString);
281
282        /// Determines whether Web Inspector can inspect the ``WKWebView`` instances for this context.
283        ///
284        /// A context can control multiple ``WKWebView`` instances, from the background content, to the popover.
285        /// You should set this to `YES` when needed for debugging purposes. The default value is `NO`.
286        #[unsafe(method(isInspectable))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn isInspectable(&self) -> bool;
289
290        /// Setter for [`isInspectable`][Self::isInspectable].
291        #[unsafe(method(setInspectable:))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn setInspectable(&self, inspectable: bool);
294
295        /// The name shown when inspecting the background web view.
296        ///
297        /// This is the text that will appear when inspecting the background web view.
298        #[unsafe(method(inspectionName))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn inspectionName(&self) -> Option<Retained<NSString>>;
301
302        /// Setter for [`inspectionName`][Self::inspectionName].
303        ///
304        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
305        #[unsafe(method(setInspectionName:))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn setInspectionName(&self, inspection_name: Option<&NSString>);
308
309        /// Specifies unsupported APIs for this extension, making them `undefined` in JavaScript.
310        ///
311        /// This property allows the app to specify a subset of web extension APIs that it chooses not to support, effectively making
312        /// these APIs `undefined` within the extension's JavaScript contexts. This enables extensions to employ feature detection techniques
313        /// for unsupported APIs, allowing them to adapt their behavior based on the APIs actually supported by the app. Setting is only allowed when
314        /// the context is not loaded. Only certain APIs can be specified here, particularly those within the `browser` namespace and other dynamic
315        /// functions and properties, anything else will be silently ignored.
316        ///
317        /// Note: For example, specifying `"browser.windows.create"` and `"browser.storage"` in this set will result in the
318        /// `browser.windows.create()` function and `browser.storage` property being `undefined`.
319        #[unsafe(method(unsupportedAPIs))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn unsupportedAPIs(&self) -> Retained<NSSet<NSString>>;
322
323        /// Setter for [`unsupportedAPIs`][Self::unsupportedAPIs].
324        ///
325        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
326        #[unsafe(method(setUnsupportedAPIs:))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn setUnsupportedAPIs(&self, unsupported_ap_is: Option<&NSSet<NSString>>);
329
330        #[cfg(feature = "WKWebViewConfiguration")]
331        /// The web view configuration to use for web views that load pages from this extension.
332        ///
333        /// Returns a customized copy of the configuration, originally set in the web extension controller configuration, for this extension.
334        /// The app must use this configuration when initializing web views intended to navigate to a URL originating from this extension's base URL.
335        /// The app must also swap web views in tabs when navigating to and from web extension URLs. This property returns `nil` if the context isn't
336        /// associated with a web extension controller. The returned configuration copy can be customized prior to web view initialization.
337        ///
338        /// Note: Navigations will fail if a web view using this configuration attempts to navigate to a URL that doesn't originate from this extension's
339        /// base URL. Similarly, navigations will be canceled if a web view not configured with this configuration attempts to navigate to a URL that does
340        /// originate from this extension's base URL.
341        #[unsafe(method(webViewConfiguration))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn webViewConfiguration(&self) -> Option<Retained<WKWebViewConfiguration>>;
344
345        /// The URL of the extension's options page, if the extension has one.
346        ///
347        /// Provides the URL for the dedicated options page, if provided by the extension; otherwise `nil` if no page is defined.
348        /// The app should provide access to this page through a user interface element.
349        ///
350        /// Note: Navigation to the options page is only possible after this extension has been loaded.
351        ///
352        /// See also: webViewConfiguration
353        #[unsafe(method(optionsPageURL))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn optionsPageURL(&self) -> Option<Retained<NSURL>>;
356
357        /// The URL to use as an alternative to the default new tab page, if the extension has one.
358        ///
359        /// Provides the URL for a new tab page, if provided by the extension; otherwise `nil` if no page is defined.
360        /// The app should prompt the user for permission to use the extension's new tab page as the default.
361        ///
362        /// Note: Navigation to the override new tab page is only possible after this extension has been loaded.
363        ///
364        /// See also: webViewConfiguration
365        #[unsafe(method(overrideNewTabPageURL))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn overrideNewTabPageURL(&self) -> Option<Retained<NSURL>>;
368
369        #[cfg(feature = "WKWebExtensionPermission")]
370        /// The currently granted permissions and their expiration dates.
371        ///
372        /// Permissions that don't expire will have a distant future date. This will never include expired entries at time of access.
373        /// Setting this property will replace all existing entries. Use this property for saving and restoring permission status in bulk.
374        /// Permissions in this dictionary should be explicitly granted by the user before being added. Any permissions in this collection will not be
375        /// presented for approval again until they expire. This value should be saved and restored as needed by the app.
376        ///
377        /// See also: setPermissionStatus:forPermission:
378        ///
379        /// See also: setPermissionStatus:forPermission:expirationDate:
380        #[unsafe(method(grantedPermissions))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn grantedPermissions(
383            &self,
384        ) -> Retained<NSDictionary<WKWebExtensionPermission, NSDate>>;
385
386        #[cfg(feature = "WKWebExtensionPermission")]
387        /// Setter for [`grantedPermissions`][Self::grantedPermissions].
388        ///
389        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
390        #[unsafe(method(setGrantedPermissions:))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn setGrantedPermissions(
393            &self,
394            granted_permissions: &NSDictionary<WKWebExtensionPermission, NSDate>,
395        );
396
397        #[cfg(feature = "WKWebExtensionMatchPattern")]
398        /// The currently granted permission match patterns and their expiration dates.
399        ///
400        /// Match patterns that don't expire will have a distant future date. This will never include expired entries at time of access.
401        /// Setting this property will replace all existing entries. Use this property for saving and restoring permission status in bulk.
402        /// Match patterns in this dictionary should be explicitly granted by the user before being added. Any match pattern in this collection will not be
403        /// presented for approval again until they expire. This value should be saved and restored as needed by the app.
404        ///
405        /// See also: setPermissionStatus:forMatchPattern:
406        ///
407        /// See also: setPermissionStatus:forMatchPattern:expirationDate:
408        #[unsafe(method(grantedPermissionMatchPatterns))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn grantedPermissionMatchPatterns(
411            &self,
412        ) -> Retained<NSDictionary<WKWebExtensionMatchPattern, NSDate>>;
413
414        #[cfg(feature = "WKWebExtensionMatchPattern")]
415        /// Setter for [`grantedPermissionMatchPatterns`][Self::grantedPermissionMatchPatterns].
416        ///
417        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
418        #[unsafe(method(setGrantedPermissionMatchPatterns:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn setGrantedPermissionMatchPatterns(
421            &self,
422            granted_permission_match_patterns: &NSDictionary<WKWebExtensionMatchPattern, NSDate>,
423        );
424
425        #[cfg(feature = "WKWebExtensionPermission")]
426        /// The currently denied permissions and their expiration dates.
427        ///
428        /// Permissions that don't expire will have a distant future date. This will never include expired entries at time of access.
429        /// Setting this property will replace all existing entries. Use this property for saving and restoring permission status in bulk.
430        /// Permissions in this dictionary should be explicitly denied by the user before being added. Any match pattern in this collection will not be
431        /// presented for approval again until they expire. This value should be saved and restored as needed by the app.
432        ///
433        /// See also: setPermissionStatus:forPermission:
434        ///
435        /// See also: setPermissionStatus:forPermission:expirationDate:
436        #[unsafe(method(deniedPermissions))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn deniedPermissions(
439            &self,
440        ) -> Retained<NSDictionary<WKWebExtensionPermission, NSDate>>;
441
442        #[cfg(feature = "WKWebExtensionPermission")]
443        /// Setter for [`deniedPermissions`][Self::deniedPermissions].
444        ///
445        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
446        #[unsafe(method(setDeniedPermissions:))]
447        #[unsafe(method_family = none)]
448        pub unsafe fn setDeniedPermissions(
449            &self,
450            denied_permissions: &NSDictionary<WKWebExtensionPermission, NSDate>,
451        );
452
453        #[cfg(feature = "WKWebExtensionMatchPattern")]
454        /// The currently denied permission match patterns and their expiration dates.
455        ///
456        /// Match patterns that don't expire will have a distant future date. This will never include expired entries at time of access.
457        /// Setting this property will replace all existing entries. Use this property for saving and restoring permission status in bulk.
458        /// Match patterns in this dictionary should be explicitly denied by the user before being added. Any match pattern in this collection will not be
459        /// presented for approval again until they expire. This value should be saved and restored as needed by the app.
460        ///
461        /// See also: setPermissionStatus:forMatchPattern:
462        ///
463        /// See also: setPermissionStatus:forMatchPattern:expirationDate:
464        #[unsafe(method(deniedPermissionMatchPatterns))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn deniedPermissionMatchPatterns(
467            &self,
468        ) -> Retained<NSDictionary<WKWebExtensionMatchPattern, NSDate>>;
469
470        #[cfg(feature = "WKWebExtensionMatchPattern")]
471        /// Setter for [`deniedPermissionMatchPatterns`][Self::deniedPermissionMatchPatterns].
472        ///
473        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
474        #[unsafe(method(setDeniedPermissionMatchPatterns:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn setDeniedPermissionMatchPatterns(
477            &self,
478            denied_permission_match_patterns: &NSDictionary<WKWebExtensionMatchPattern, NSDate>,
479        );
480
481        /// A Boolean value indicating if the extension has requested optional access to all hosts.
482        ///
483        /// If this property is `YES`, the extension has asked for access to all hosts in a call to `browser.runtime.permissions.request()`,
484        /// and future permission checks will present discrete hosts for approval as being implicitly requested. This value should be saved and restored as needed by the app.
485        #[unsafe(method(hasRequestedOptionalAccessToAllHosts))]
486        #[unsafe(method_family = none)]
487        pub unsafe fn hasRequestedOptionalAccessToAllHosts(&self) -> bool;
488
489        /// Setter for [`hasRequestedOptionalAccessToAllHosts`][Self::hasRequestedOptionalAccessToAllHosts].
490        #[unsafe(method(setHasRequestedOptionalAccessToAllHosts:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn setHasRequestedOptionalAccessToAllHosts(
493            &self,
494            has_requested_optional_access_to_all_hosts: bool,
495        );
496
497        /// A Boolean value indicating if the extension has access to private data.
498        ///
499        /// If this property is `YES`, the extension is granted permission to interact with private windows, tabs, and cookies. Access to private data
500        /// should be explicitly allowed by the user before setting this property. This value should be saved and restored as needed by the app.
501        ///
502        /// Note: To ensure proper isolation between private and non-private data, web views associated with private data must use a
503        /// different ``WKUserContentController``. Likewise, to be identified as a private web view and to ensure that cookies and other
504        /// website data is not shared, private web views must be configured to use a non-persistent ``WKWebsiteDataStore``.
505        #[unsafe(method(hasAccessToPrivateData))]
506        #[unsafe(method_family = none)]
507        pub unsafe fn hasAccessToPrivateData(&self) -> bool;
508
509        /// Setter for [`hasAccessToPrivateData`][Self::hasAccessToPrivateData].
510        #[unsafe(method(setHasAccessToPrivateData:))]
511        #[unsafe(method_family = none)]
512        pub unsafe fn setHasAccessToPrivateData(&self, has_access_to_private_data: bool);
513
514        #[cfg(feature = "WKWebExtensionPermission")]
515        /// The currently granted permissions that have not expired.
516        ///
517        /// See also: grantedPermissions
518        #[unsafe(method(currentPermissions))]
519        #[unsafe(method_family = none)]
520        pub unsafe fn currentPermissions(&self) -> Retained<NSSet<WKWebExtensionPermission>>;
521
522        #[cfg(feature = "WKWebExtensionMatchPattern")]
523        /// The currently granted permission match patterns that have not expired.
524        ///
525        /// See also: grantedPermissionMatchPatterns
526        #[unsafe(method(currentPermissionMatchPatterns))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn currentPermissionMatchPatterns(
529            &self,
530        ) -> Retained<NSSet<WKWebExtensionMatchPattern>>;
531
532        #[cfg(feature = "WKWebExtensionPermission")]
533        /// Checks the specified permission against the currently granted permissions.
534        ///
535        /// Parameter `permission`: The permission for which to return the status.
536        ///
537        /// See also: currentPermissions
538        ///
539        /// See also: hasPermission:inTab:
540        ///
541        /// See also: permissionStatusForPermission:
542        ///
543        /// See also: permissionStatusForPermission:inTab:
544        #[unsafe(method(hasPermission:))]
545        #[unsafe(method_family = none)]
546        pub unsafe fn hasPermission(&self, permission: &WKWebExtensionPermission) -> bool;
547
548        #[cfg(all(feature = "WKWebExtensionPermission", feature = "WKWebExtensionTab"))]
549        /// Checks the specified permission against the currently granted permissions in a specific tab.
550        ///
551        /// Parameter `permission`: The permission for which to return the status.
552        ///
553        /// Parameter `tab`: The tab in which to return the permission status, or
554        /// `nil`if the tab is not known or the global status is desired.
555        ///
556        /// Permissions can be granted on a per-tab basis. When the tab is known, permission checks should always use this method.
557        ///
558        /// See also: currentPermissions
559        ///
560        /// See also: hasPermission:
561        ///
562        /// See also: permissionStatusForPermission:
563        ///
564        /// See also: permissionStatusForPermission:inTab:
565        #[unsafe(method(hasPermission:inTab:))]
566        #[unsafe(method_family = none)]
567        pub unsafe fn hasPermission_inTab(
568            &self,
569            permission: &WKWebExtensionPermission,
570            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
571        ) -> bool;
572
573        /// Checks the specified URL against the currently granted permission match patterns.
574        ///
575        /// Parameter `url`: The URL for which to return the status.
576        ///
577        /// See also: currentPermissionMatchPatterns
578        ///
579        /// See also: hasAccessToURL:inTab:
580        ///
581        /// See also: permissionStatusForURL:
582        ///
583        /// See also: permissionStatusForURL:inTab:
584        ///
585        /// See also: permissionStatusForMatchPattern:
586        ///
587        /// See also: permissionStatusForMatchPattern:inTab:
588        #[unsafe(method(hasAccessToURL:))]
589        #[unsafe(method_family = none)]
590        pub unsafe fn hasAccessToURL(&self, url: &NSURL) -> bool;
591
592        #[cfg(feature = "WKWebExtensionTab")]
593        /// Checks the specified URL against the currently granted permission match patterns in a specific tab.
594        ///
595        /// Parameter `url`: The URL for which to return the status.
596        ///
597        /// Parameter `tab`: The tab in which to return the permission status, or
598        /// `nil`if the tab is not known or the global status is desired.
599        ///
600        /// Some match patterns can be granted on a per-tab basis. When the tab is known, access checks should always use this method.
601        ///
602        /// See also: currentPermissionMatchPatterns
603        ///
604        /// See also: hasAccessToURL:
605        ///
606        /// See also: permissionStatusForURL:
607        ///
608        /// See also: permissionStatusForURL:inTab:
609        ///
610        /// See also: permissionStatusForMatchPattern:
611        ///
612        /// See also: permissionStatusForMatchPattern:inTab:
613        #[unsafe(method(hasAccessToURL:inTab:))]
614        #[unsafe(method_family = none)]
615        pub unsafe fn hasAccessToURL_inTab(
616            &self,
617            url: &NSURL,
618            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
619        ) -> bool;
620
621        /// A Boolean value indicating if the currently granted permission match patterns set contains the `
622        /// <all
623        /// _urls>` pattern.
624        ///
625        /// This does not check for any `*` host patterns. In most cases you should use the broader ``hasAccessToAllHosts``.
626        ///
627        /// See also: currentPermissionMatchPatterns
628        ///
629        /// See also: hasAccessToAllHosts
630        #[unsafe(method(hasAccessToAllURLs))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn hasAccessToAllURLs(&self) -> bool;
633
634        /// A Boolean value indicating if the currently granted permission match patterns set contains the `
635        /// <all
636        /// _urls>` pattern or any `*` host patterns.
637        ///
638        /// See also: currentPermissionMatchPatterns
639        ///
640        /// See also: hasAccessToAllURLs
641        #[unsafe(method(hasAccessToAllHosts))]
642        #[unsafe(method_family = none)]
643        pub unsafe fn hasAccessToAllHosts(&self) -> bool;
644
645        /// A Boolean value indicating whether the extension has script or stylesheet content that can be injected into webpages.
646        ///
647        /// If this property is `YES`, the extension has content that can be injected by matching against the extension's requested match patterns.
648        ///
649        /// See also: hasInjectedContentForURL:
650        #[unsafe(method(hasInjectedContent))]
651        #[unsafe(method_family = none)]
652        pub unsafe fn hasInjectedContent(&self) -> bool;
653
654        /// Checks if the extension has script or stylesheet content that can be injected into the specified URL.
655        ///
656        /// Parameter `url`: The webpage URL to check.
657        ///
658        /// Returns: Returns `YES` if the extension has content that can be injected by matching the URL against the extension's requested match patterns.
659        ///
660        /// The extension context will still need to be loaded and have granted website permissions for its content to actually be injected.
661        #[unsafe(method(hasInjectedContentForURL:))]
662        #[unsafe(method_family = none)]
663        pub unsafe fn hasInjectedContentForURL(&self, url: &NSURL) -> bool;
664
665        /// A boolean value indicating whether the extension includes rules used for content modification or blocking.
666        ///
667        /// This includes both static rules available in the extension's manifest and dynamic rules applied during a browsing session.
668        #[unsafe(method(hasContentModificationRules))]
669        #[unsafe(method_family = none)]
670        pub unsafe fn hasContentModificationRules(&self) -> bool;
671
672        #[cfg(feature = "WKWebExtensionPermission")]
673        /// Checks the specified permission against the currently denied, granted, and requested permissions.
674        ///
675        /// Parameter `permission`: The permission for which to return the status.
676        ///
677        /// Permissions can be granted on a per-tab basis. When the tab is known, access checks should always use the method that checks in a tab.
678        ///
679        /// See also: permissionStatusForPermission:inTab:
680        ///
681        /// See also: hasPermission:
682        #[unsafe(method(permissionStatusForPermission:))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn permissionStatusForPermission(
685            &self,
686            permission: &WKWebExtensionPermission,
687        ) -> WKWebExtensionContextPermissionStatus;
688
689        #[cfg(all(feature = "WKWebExtensionPermission", feature = "WKWebExtensionTab"))]
690        /// Checks the specified permission against the currently denied, granted, and requested permissions.
691        ///
692        /// Parameter `permission`: The permission for which to return the status.
693        ///
694        /// Parameter `tab`: The tab in which to return the permission status, or
695        /// `nil`if the tab is not known or the global status is desired.
696        ///
697        /// Permissions can be granted on a per-tab basis. When the tab is known, access checks should always specify the tab.
698        ///
699        /// See also: permissionStatusForPermission:
700        ///
701        /// See also: hasPermission:inTab:
702        #[unsafe(method(permissionStatusForPermission:inTab:))]
703        #[unsafe(method_family = none)]
704        pub unsafe fn permissionStatusForPermission_inTab(
705            &self,
706            permission: &WKWebExtensionPermission,
707            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
708        ) -> WKWebExtensionContextPermissionStatus;
709
710        #[cfg(feature = "WKWebExtensionPermission")]
711        /// Sets the status of a permission with a distant future expiration date.
712        ///
713        /// Parameter `status`: The new permission status to set for the given permission.
714        ///
715        /// Parameter `permission`: The permission for which to set the status.
716        ///
717        /// This method will update ``grantedPermissions`` and ``deniedPermissions``. Use this method for changing a single permission's status.
718        /// Only ``WKWebExtensionContextPermissionStatusDeniedExplicitly``, ``WKWebExtensionContextPermissionStatusUnknown``, and ``WKWebExtensionContextPermissionStatusGrantedExplicitly``
719        /// states are allowed to be set using this method.
720        ///
721        /// See also: setPermissionStatus:forPermission:expirationDate:
722        ///
723        /// See also: setPermissionStatus:forPermission:inTab:
724        #[unsafe(method(setPermissionStatus:forPermission:))]
725        #[unsafe(method_family = none)]
726        pub unsafe fn setPermissionStatus_forPermission(
727            &self,
728            status: WKWebExtensionContextPermissionStatus,
729            permission: &WKWebExtensionPermission,
730        );
731
732        #[cfg(feature = "WKWebExtensionPermission")]
733        /// Sets the status of a permission with a specific expiration date.
734        ///
735        /// Parameter `status`: The new permission status to set for the given permission.
736        ///
737        /// Parameter `permission`: The permission for which to set the status.
738        ///
739        /// Parameter `expirationDate`: The expiration date for the new permission status, or
740        /// `nil`for distant future.
741        ///
742        /// This method will update ``grantedPermissions`` and ``deniedPermissions``. Use this method for changing a single permission's status.
743        /// Passing a `nil` expiration date will be treated as a distant future date. Only ``WKWebExtensionContextPermissionStatusDeniedExplicitly``, ``WKWebExtensionContextPermissionStatusUnknown``,
744        /// and ``WKWebExtensionContextPermissionStatusGrantedExplicitly`` states are allowed to be set using this method.
745        ///
746        /// See also: setPermissionStatus:forPermission:
747        ///
748        /// See also: setPermissionStatus:forPermission:inTab:
749        #[unsafe(method(setPermissionStatus:forPermission:expirationDate:))]
750        #[unsafe(method_family = none)]
751        pub unsafe fn setPermissionStatus_forPermission_expirationDate(
752            &self,
753            status: WKWebExtensionContextPermissionStatus,
754            permission: &WKWebExtensionPermission,
755            expiration_date: Option<&NSDate>,
756        );
757
758        /// Checks the specified URL against the currently denied, granted, and requested permission match patterns.
759        ///
760        /// Parameter `url`: The URL for which to return the status.
761        ///
762        /// URLs and match patterns can be granted on a per-tab basis. When the tab is known, access checks should always use the method that checks in a tab.
763        ///
764        /// See also: permissionStatusForURL:inTab:
765        ///
766        /// See also: hasAccessToURL:
767        #[unsafe(method(permissionStatusForURL:))]
768        #[unsafe(method_family = none)]
769        pub unsafe fn permissionStatusForURL(
770            &self,
771            url: &NSURL,
772        ) -> WKWebExtensionContextPermissionStatus;
773
774        #[cfg(feature = "WKWebExtensionTab")]
775        /// Checks the specified URL against the currently denied, granted, and requested permission match patterns.
776        ///
777        /// Parameter `url`: The URL for which to return the status.
778        ///
779        /// Parameter `tab`: The tab in which to return the permission status, or
780        /// `nil`if the tab is not known or the global status is desired.
781        ///
782        /// URLs and match patterns can be granted on a per-tab basis. When the tab is known, access checks should always use this method.
783        ///
784        /// See also: permissionStatusForURL:
785        ///
786        /// See also: hasAccessToURL:inTab:
787        #[unsafe(method(permissionStatusForURL:inTab:))]
788        #[unsafe(method_family = none)]
789        pub unsafe fn permissionStatusForURL_inTab(
790            &self,
791            url: &NSURL,
792            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
793        ) -> WKWebExtensionContextPermissionStatus;
794
795        /// Sets the permission status of a URL with a distant future expiration date.
796        ///
797        /// Parameter `status`: The new permission status to set for the given URL.
798        ///
799        /// Parameter `url`: The URL for which to set the status.
800        ///
801        /// The URL is converted into a match pattern and will update ``grantedPermissionMatchPatterns`` and ``deniedPermissionMatchPatterns``. Use this method for changing a single URL's status.
802        /// Only ``WKWebExtensionContextPermissionStatusDeniedExplicitly``, ``WKWebExtensionContextPermissionStatusUnknown``, and ``WKWebExtensionContextPermissionStatusGrantedExplicitly``
803        /// states are allowed to be set using this method.
804        ///
805        /// See also: setPermissionStatus:forURL:expirationDate:
806        ///
807        /// See also: setPermissionStatus:forURL:inTab:
808        #[unsafe(method(setPermissionStatus:forURL:))]
809        #[unsafe(method_family = none)]
810        pub unsafe fn setPermissionStatus_forURL(
811            &self,
812            status: WKWebExtensionContextPermissionStatus,
813            url: &NSURL,
814        );
815
816        /// Sets the permission status of a URL with a distant future expiration date.
817        ///
818        /// Parameter `status`: The new permission status to set for the given URL.
819        ///
820        /// Parameter `url`: The URL for which to set the status.
821        ///
822        /// Parameter `expirationDate`: The expiration date for the new permission status, or
823        /// `nil`for distant future.
824        ///
825        /// The URL is converted into a match pattern and will update ``grantedPermissionMatchPatterns`` and ``deniedPermissionMatchPatterns``. Use this method for changing a single URL's status.
826        /// Passing a `nil` expiration date will be treated as a distant future date. Only ``WKWebExtensionContextPermissionStatusDeniedExplicitly``, ``WKWebExtensionContextPermissionStatusUnknown``,
827        /// and ``WKWebExtensionContextPermissionStatusGrantedExplicitly`` states are allowed to be set using this method.
828        ///
829        /// See also: setPermissionStatus:forURL:
830        ///
831        /// See also: setPermissionStatus:forURL:inTab:
832        #[unsafe(method(setPermissionStatus:forURL:expirationDate:))]
833        #[unsafe(method_family = none)]
834        pub unsafe fn setPermissionStatus_forURL_expirationDate(
835            &self,
836            status: WKWebExtensionContextPermissionStatus,
837            url: &NSURL,
838            expiration_date: Option<&NSDate>,
839        );
840
841        #[cfg(feature = "WKWebExtensionMatchPattern")]
842        /// Checks the specified match pattern against the currently denied, granted, and requested permission match patterns.
843        ///
844        /// Parameter `pattern`: The pattern for which to return the status.
845        ///
846        /// Match patterns can be granted on a per-tab basis. When the tab is known, access checks should always use the method that checks in a tab.
847        ///
848        /// See also: permissionStatusForMatchPattern:inTab:
849        ///
850        /// See also: hasAccessToURL:inTab:
851        #[unsafe(method(permissionStatusForMatchPattern:))]
852        #[unsafe(method_family = none)]
853        pub unsafe fn permissionStatusForMatchPattern(
854            &self,
855            pattern: &WKWebExtensionMatchPattern,
856        ) -> WKWebExtensionContextPermissionStatus;
857
858        #[cfg(all(feature = "WKWebExtensionMatchPattern", feature = "WKWebExtensionTab"))]
859        /// Checks the specified match pattern against the currently denied, granted, and requested permission match patterns.
860        ///
861        /// Parameter `pattern`: The pattern for which to return the status.
862        ///
863        /// Parameter `tab`: The tab in which to return the permission status, or
864        /// `nil`if the tab is not known or the global status is desired.
865        ///
866        /// Match patterns can be granted on a per-tab basis. When the tab is known, access checks should always use this method.
867        ///
868        /// See also: permissionStatusForMatchPattern:
869        ///
870        /// See also: hasAccessToURL:inTab:
871        #[unsafe(method(permissionStatusForMatchPattern:inTab:))]
872        #[unsafe(method_family = none)]
873        pub unsafe fn permissionStatusForMatchPattern_inTab(
874            &self,
875            pattern: &WKWebExtensionMatchPattern,
876            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
877        ) -> WKWebExtensionContextPermissionStatus;
878
879        #[cfg(feature = "WKWebExtensionMatchPattern")]
880        /// Sets the status of a match pattern with a distant future expiration date.
881        ///
882        /// Parameter `status`: The new permission status to set for the given match pattern.
883        ///
884        /// Parameter `pattern`: The match pattern for which to set the status.
885        ///
886        /// This method will update ``grantedPermissionMatchPatterns`` and ``deniedPermissionMatchPatterns``. Use this method for changing a single match pattern's status.
887        /// Only ``WKWebExtensionContextPermissionStatusDeniedExplicitly``, ``WKWebExtensionContextPermissionStatusUnknown``, and ``WKWebExtensionContextPermissionStatusGrantedExplicitly``
888        /// states are allowed to be set using this method.
889        ///
890        /// See also: setPermissionStatus:forMatchPattern:expirationDate:
891        ///
892        /// See also: setPermissionStatus:forMatchPattern:inTab:
893        #[unsafe(method(setPermissionStatus:forMatchPattern:))]
894        #[unsafe(method_family = none)]
895        pub unsafe fn setPermissionStatus_forMatchPattern(
896            &self,
897            status: WKWebExtensionContextPermissionStatus,
898            pattern: &WKWebExtensionMatchPattern,
899        );
900
901        #[cfg(feature = "WKWebExtensionMatchPattern")]
902        /// Sets the status of a match pattern with a specific expiration date.
903        ///
904        /// Parameter `status`: The new permission status to set for the given match pattern.
905        ///
906        /// Parameter `pattern`: The match pattern for which to set the status.
907        ///
908        /// Parameter `expirationDate`: The expiration date for the new permission status, or
909        /// `nil`for distant future.
910        ///
911        /// This method will update ``grantedPermissionMatchPatterns`` and ``deniedPermissionMatchPatterns``. Use this method for changing a single match pattern's status.
912        /// Passing a `nil` expiration date will be treated as a distant future date. Only ``WKWebExtensionContextPermissionStatusDeniedExplicitly``, ``WKWebExtensionContextPermissionStatusUnknown``,
913        /// and ``WKWebExtensionContextPermissionStatusGrantedExplicitly`` states are allowed to be set using this method.
914        ///
915        /// See also: setPermissionStatus:forMatchPattern:
916        ///
917        /// See also: setPermissionStatus:forMatchPattern:inTab:
918        #[unsafe(method(setPermissionStatus:forMatchPattern:expirationDate:))]
919        #[unsafe(method_family = none)]
920        pub unsafe fn setPermissionStatus_forMatchPattern_expirationDate(
921            &self,
922            status: WKWebExtensionContextPermissionStatus,
923            pattern: &WKWebExtensionMatchPattern,
924            expiration_date: Option<&NSDate>,
925        );
926
927        #[cfg(feature = "block2")]
928        /// Loads the background content if needed for the extension.
929        ///
930        /// Parameter `completionHandler`: A block to be called upon completion of the loading process, with an optional error.
931        ///
932        /// This method forces the loading of the background content for the extension that will otherwise be loaded on-demand during specific events.
933        /// It is useful when the app requires the background content to be loaded for other reasons. If the background content is already loaded, the completion handler
934        /// will be called immediately. An error will occur if the extension does not have any background content to load or loading fails.
935        #[unsafe(method(loadBackgroundContentWithCompletionHandler:))]
936        #[unsafe(method_family = none)]
937        pub unsafe fn loadBackgroundContentWithCompletionHandler(
938            &self,
939            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
940        );
941
942        #[cfg(all(feature = "WKWebExtensionAction", feature = "WKWebExtensionTab"))]
943        /// Retrieves the extension action for a given tab, or the default action if `nil` is passed.
944        ///
945        /// Parameter `tab`: The tab for which to retrieve the extension action, or `nil` to get the default action.
946        ///
947        /// The returned object represents the action specific to the tab when provided; otherwise, it returns the default action. The default
948        /// action is useful when the context is unrelated to a specific tab. When possible, specify the tab to get the most context-relevant action.
949        ///
950        /// See also: performActionForTab:
951        #[unsafe(method(actionForTab:))]
952        #[unsafe(method_family = none)]
953        pub unsafe fn actionForTab(
954            &self,
955            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
956        ) -> Option<Retained<WKWebExtensionAction>>;
957
958        #[cfg(feature = "WKWebExtensionTab")]
959        /// Performs the extension action associated with the specified tab or performs the default action if `nil` is passed.
960        ///
961        /// Parameter `tab`: The tab for which to perform the extension action, or `nil` to perform the default action.
962        ///
963        /// Performing the action will mark the tab, if specified, as having an active user gesture. When the ``tab`` parameter is `nil`,
964        /// the default action is performed. The action can either trigger an event or display a popup, depending on how the extension is configured.
965        /// If the action is configured to display a popup, implementing the appropriate web extension controller delegate method is required; otherwise,
966        /// no action is performed for popup actions.
967        #[unsafe(method(performActionForTab:))]
968        #[unsafe(method_family = none)]
969        pub unsafe fn performActionForTab(
970            &self,
971            tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
972        );
973
974        #[cfg(feature = "WKWebExtensionCommand")]
975        /// The commands associated with the extension.
976        ///
977        /// Provides all commands registered within the extension. Each command represents an action or behavior available for the web extension.
978        ///
979        /// See also: performCommand:
980        #[unsafe(method(commands))]
981        #[unsafe(method_family = none)]
982        pub unsafe fn commands(&self) -> Retained<NSArray<WKWebExtensionCommand>>;
983
984        #[cfg(feature = "WKWebExtensionCommand")]
985        /// Performs the specified command, triggering events specific to this extension.
986        ///
987        /// Parameter `command`: The command to be performed.
988        ///
989        /// This method performs the given command as if it was triggered by a user gesture within the context of the focused window and active tab.
990        #[unsafe(method(performCommand:))]
991        #[unsafe(method_family = none)]
992        pub unsafe fn performCommand(&self, command: &WKWebExtensionCommand);
993
994        #[cfg(feature = "objc2-app-kit")]
995        #[cfg(target_os = "macos")]
996        /// Performs the command associated with the given event.
997        ///
998        /// This method checks for a command corresponding to the provided event and performs it, if available. The app should use this method to perform
999        /// any extension commands at an appropriate time in the app's event handling, like in ``sendEvent:`` of ``NSApplication`` or ``NSWindow`` subclasses.
1000        ///
1001        /// Parameter `event`: The event representing the user input.
1002        ///
1003        /// Returns: Returns `YES` if a command corresponding to the event was found and performed, `NO` otherwise.
1004        #[unsafe(method(performCommandForEvent:))]
1005        #[unsafe(method_family = none)]
1006        pub unsafe fn performCommandForEvent(&self, event: &NSEvent) -> bool;
1007
1008        #[cfg(all(feature = "WKWebExtensionCommand", feature = "objc2-app-kit"))]
1009        #[cfg(target_os = "macos")]
1010        /// Retrieves the command associated with the given event without performing it.
1011        ///
1012        /// Returns the command that corresponds to the provided event, if such a command exists. This provides a way to programmatically
1013        /// determine what action would occur for a given event, without triggering the command.
1014        ///
1015        /// Parameter `event`: The event for which to retrieve the corresponding command.
1016        ///
1017        /// Returns: The command associated with the event, or `nil` if there is no such command.
1018        #[unsafe(method(commandForEvent:))]
1019        #[unsafe(method_family = none)]
1020        pub unsafe fn commandForEvent(
1021            &self,
1022            event: &NSEvent,
1023        ) -> Option<Retained<WKWebExtensionCommand>>;
1024
1025        #[cfg(all(feature = "WKWebExtensionTab", feature = "objc2-app-kit"))]
1026        #[cfg(target_os = "macos")]
1027        #[unsafe(method(menuItemsForTab:))]
1028        #[unsafe(method_family = none)]
1029        pub unsafe fn menuItemsForTab(
1030            &self,
1031            tab: &ProtocolObject<dyn WKWebExtensionTab>,
1032        ) -> Retained<NSArray<NSMenuItem>>;
1033
1034        #[cfg(feature = "WKWebExtensionTab")]
1035        /// Should be called by the app when a user gesture is performed in a specific tab.
1036        ///
1037        /// Parameter `tab`: The tab in which the user gesture was performed.
1038        ///
1039        /// When a user gesture is performed in a tab, this method should be called to update the extension context.
1040        /// This enables the extension to be aware of the user gesture, potentially granting it access to features that require user interaction,
1041        /// such as `activeTab`. Not required if using ``performActionForTab:``.
1042        ///
1043        /// See also: hasActiveUserGestureInTab:
1044        #[unsafe(method(userGesturePerformedInTab:))]
1045        #[unsafe(method_family = none)]
1046        pub unsafe fn userGesturePerformedInTab(&self, tab: &ProtocolObject<dyn WKWebExtensionTab>);
1047
1048        #[cfg(feature = "WKWebExtensionTab")]
1049        /// Indicates if a user gesture is currently active in the specified tab.
1050        ///
1051        /// Parameter `tab`: The tab for which to check for an active user gesture.
1052        ///
1053        /// An active user gesture may influence the availability of certain permissions, such as `activeTab`. User gestures can
1054        /// be triggered by various user interactions with the web extension, including clicking on extension menu items, executing extension commands,
1055        /// or interacting with extension actions. A tab as having an active user gesture enables the extension to access features that require user interaction.
1056        ///
1057        /// See also: userGesturePerformedInTab:
1058        #[unsafe(method(hasActiveUserGestureInTab:))]
1059        #[unsafe(method_family = none)]
1060        pub unsafe fn hasActiveUserGestureInTab(
1061            &self,
1062            tab: &ProtocolObject<dyn WKWebExtensionTab>,
1063        ) -> bool;
1064
1065        #[cfg(feature = "WKWebExtensionTab")]
1066        /// Should be called by the app to clear a user gesture in a specific tab.
1067        ///
1068        /// Parameter `tab`: The tab from which the user gesture should be cleared.
1069        ///
1070        /// When a user gesture is no longer relevant in a tab, this method should be called to update the extension context.
1071        /// This will revoke the extension's access to features that require active user interaction, such as `activeTab`. User gestures are
1072        /// automatically cleared during navigation in certain scenarios; this method is needed if the app intends to clear the gesture more aggressively.
1073        ///
1074        /// See also: userGesturePerformedInTab:
1075        #[unsafe(method(clearUserGestureInTab:))]
1076        #[unsafe(method_family = none)]
1077        pub unsafe fn clearUserGestureInTab(&self, tab: &ProtocolObject<dyn WKWebExtensionTab>);
1078
1079        #[cfg(feature = "WKWebExtensionWindow")]
1080        /// The open windows that are exposed to this extension.
1081        ///
1082        /// Provides the windows that are open and visible to the extension, as updated by the ``didOpenWindow:`` and ``didCloseWindow:`` methods.
1083        /// Initially populated by the windows returned by the extension controller delegate method ``webExtensionController:openWindowsForExtensionContext:``.
1084        ///
1085        /// See also: didOpenWindow:
1086        ///
1087        /// See also: didCloseWindow:
1088        #[unsafe(method(openWindows))]
1089        #[unsafe(method_family = none)]
1090        pub unsafe fn openWindows(
1091            &self,
1092        ) -> Retained<NSArray<ProtocolObject<dyn WKWebExtensionWindow>>>;
1093
1094        #[cfg(feature = "WKWebExtensionWindow")]
1095        /// The window that currently has focus for this extension.
1096        ///
1097        /// Provides the window that currently has focus, as set by the ``didFocusWindow:`` method.
1098        /// It will be `nil` if no window has focus or if a window has focus that is not visible to the extension. Initially populated by the window
1099        /// returned by the extension controller delegate method ``webExtensionController:focusedWindowForExtensionContext:``.
1100        ///
1101        /// See also: didFocusWindow:
1102        #[unsafe(method(focusedWindow))]
1103        #[unsafe(method_family = none)]
1104        pub unsafe fn focusedWindow(
1105            &self,
1106        ) -> Option<Retained<ProtocolObject<dyn WKWebExtensionWindow>>>;
1107
1108        #[cfg(feature = "WKWebExtensionTab")]
1109        /// A set of open tabs in all open windows that are exposed to this extension.
1110        ///
1111        /// Provides a set of tabs in all open windows that are visible to the extension, as updated by the ``didOpenTab:`` and ``didCloseTab:`` methods.
1112        /// Initially populated by the tabs in the windows returned by the extension controller delegate method ``webExtensionController:openWindowsForExtensionContext:``.
1113        ///
1114        /// See also: didOpenTab:
1115        ///
1116        /// See also: didCloseTab:
1117        #[unsafe(method(openTabs))]
1118        #[unsafe(method_family = none)]
1119        pub unsafe fn openTabs(&self) -> Retained<NSSet<ProtocolObject<dyn WKWebExtensionTab>>>;
1120
1121        #[cfg(feature = "WKWebExtensionWindow")]
1122        /// Should be called by the app when a new window is opened to fire appropriate events with only this extension.
1123        ///
1124        /// Parameter `newWindow`: The newly opened window.
1125        ///
1126        /// This method informs only the specific extension of the opening of a new window. If the intention is to inform all loaded
1127        /// extensions consistently, you should use the respective method on the extension controller instead.
1128        ///
1129        /// See also: didCloseWindow:
1130        ///
1131        /// See also: openWindows
1132        #[unsafe(method(didOpenWindow:))]
1133        #[unsafe(method_family = none)]
1134        pub unsafe fn didOpenWindow(&self, new_window: &ProtocolObject<dyn WKWebExtensionWindow>);
1135
1136        #[cfg(feature = "WKWebExtensionWindow")]
1137        /// Should be called by the app when a window is closed to fire appropriate events with only this extension.
1138        ///
1139        /// Parameter `newWindow`: The window that was closed.
1140        ///
1141        /// This method informs only the specific extension of the closure of a window. If the intention is to inform all loaded
1142        /// extensions consistently, you should use the respective method on the extension controller instead.
1143        ///
1144        /// See also: didOpenWindow:
1145        ///
1146        /// See also: openWindows
1147        #[unsafe(method(didCloseWindow:))]
1148        #[unsafe(method_family = none)]
1149        pub unsafe fn didCloseWindow(
1150            &self,
1151            closed_window: &ProtocolObject<dyn WKWebExtensionWindow>,
1152        );
1153
1154        #[cfg(feature = "WKWebExtensionWindow")]
1155        /// Should be called by the app when a window gains focus to fire appropriate events with only this extension.
1156        ///
1157        /// Parameter `focusedWindow`: The window that gained focus, or
1158        /// `nil`if no window has focus or a window has focus that is not visible to this extension.
1159        ///
1160        /// This method informs only the specific extension that a window has gained focus. If the intention is to inform all loaded
1161        /// extensions consistently, you should use the respective method on the extension controller instead.
1162        #[unsafe(method(didFocusWindow:))]
1163        #[unsafe(method_family = none)]
1164        pub unsafe fn didFocusWindow(
1165            &self,
1166            focused_window: Option<&ProtocolObject<dyn WKWebExtensionWindow>>,
1167        );
1168
1169        #[cfg(feature = "WKWebExtensionTab")]
1170        /// Should be called by the app when a new tab is opened to fire appropriate events with only this extension.
1171        ///
1172        /// Parameter `newTab`: The newly opened tab.
1173        ///
1174        /// This method informs only the specific extension of the opening of a new tab. If the intention is to inform all loaded
1175        /// extensions consistently, you should use the respective method on the extension controller instead.
1176        ///
1177        /// See also: didCloseTab:
1178        ///
1179        /// See also: openTabs
1180        #[unsafe(method(didOpenTab:))]
1181        #[unsafe(method_family = none)]
1182        pub unsafe fn didOpenTab(&self, new_tab: &ProtocolObject<dyn WKWebExtensionTab>);
1183
1184        #[cfg(feature = "WKWebExtensionTab")]
1185        /// Should be called by the app when a tab is closed to fire appropriate events with only this extension.
1186        ///
1187        /// Parameter `closedTab`: The tab that was closed.
1188        ///
1189        /// Parameter `windowIsClosing`: A boolean value indicating whether the window containing the tab is also closing.
1190        ///
1191        /// This method informs only the specific extension of the closure of a tab. If the intention is to inform all loaded
1192        /// extensions consistently, you should use the respective method on the extension controller instead.
1193        ///
1194        /// See also: didOpenTab:
1195        ///
1196        /// See also: openTabs
1197        #[unsafe(method(didCloseTab:windowIsClosing:))]
1198        #[unsafe(method_family = none)]
1199        pub unsafe fn didCloseTab_windowIsClosing(
1200            &self,
1201            closed_tab: &ProtocolObject<dyn WKWebExtensionTab>,
1202            window_is_closing: bool,
1203        );
1204
1205        #[cfg(feature = "WKWebExtensionTab")]
1206        /// Should be called by the app when a tab is activated to notify only this specific extension.
1207        ///
1208        /// Parameter `activatedTab`: The tab that has become active.
1209        ///
1210        /// Parameter `previousTab`: The tab that was active before. This parameter can be
1211        /// `nil`if there was no previously active tab.
1212        ///
1213        /// This method informs only the specific extension of the tab activation. If the intention is to inform all loaded
1214        /// extensions consistently, you should use the respective method on the extension controller instead.
1215        #[unsafe(method(didActivateTab:previousActiveTab:))]
1216        #[unsafe(method_family = none)]
1217        pub unsafe fn didActivateTab_previousActiveTab(
1218            &self,
1219            activated_tab: &ProtocolObject<dyn WKWebExtensionTab>,
1220            previous_tab: Option<&ProtocolObject<dyn WKWebExtensionTab>>,
1221        );
1222
1223        #[cfg(feature = "WKWebExtensionTab")]
1224        /// Should be called by the app when tabs are selected to fire appropriate events with only this extension.
1225        ///
1226        /// Parameter `selectedTabs`: The set of tabs that were selected.
1227        ///
1228        /// This method informs only the specific extension that tabs have been selected. If the intention is to inform all loaded
1229        /// extensions consistently, you should use the respective method on the extension controller instead.
1230        #[unsafe(method(didSelectTabs:))]
1231        #[unsafe(method_family = none)]
1232        pub unsafe fn didSelectTabs(
1233            &self,
1234            selected_tabs: &NSArray<ProtocolObject<dyn WKWebExtensionTab>>,
1235        );
1236
1237        #[cfg(feature = "WKWebExtensionTab")]
1238        /// Should be called by the app when tabs are deselected to fire appropriate events with only this extension.
1239        ///
1240        /// Parameter `deselectedTabs`: The set of tabs that were deselected.
1241        ///
1242        /// This method informs only the specific extension that tabs have been deselected. If the intention is to inform all loaded
1243        /// extensions consistently, you should use the respective method on the extension controller instead.
1244        #[unsafe(method(didDeselectTabs:))]
1245        #[unsafe(method_family = none)]
1246        pub unsafe fn didDeselectTabs(
1247            &self,
1248            deselected_tabs: &NSArray<ProtocolObject<dyn WKWebExtensionTab>>,
1249        );
1250
1251        #[cfg(all(feature = "WKWebExtensionTab", feature = "WKWebExtensionWindow"))]
1252        /// Should be called by the app when a tab is moved to fire appropriate events with only this extension.
1253        ///
1254        /// Parameter `movedTab`: The tab that was moved.
1255        ///
1256        /// Parameter `index`: The old index of the tab within the window.
1257        ///
1258        /// Parameter `oldWindow`: The window that the tab was moved from, or
1259        /// `nil`if the tab is moving from no open window.
1260        ///
1261        /// If the window is staying the same, the current window should be specified. This method informs only the specific extension
1262        /// that a tab has been moved. If the intention is to inform all loaded extensions consistently, you should use the respective method on
1263        /// the extension controller instead.
1264        #[unsafe(method(didMoveTab:fromIndex:inWindow:))]
1265        #[unsafe(method_family = none)]
1266        pub unsafe fn didMoveTab_fromIndex_inWindow(
1267            &self,
1268            moved_tab: &ProtocolObject<dyn WKWebExtensionTab>,
1269            index: NSUInteger,
1270            old_window: Option<&ProtocolObject<dyn WKWebExtensionWindow>>,
1271        );
1272
1273        #[cfg(feature = "WKWebExtensionTab")]
1274        /// Should be called by the app when a tab is replaced by another tab to fire appropriate events with only this extension.
1275        ///
1276        /// Parameter `oldTab`: The tab that was replaced.
1277        ///
1278        /// Parameter `newTab`: The tab that replaced the old tab.
1279        ///
1280        /// This method informs only the specific extension that a tab has been replaced. If the intention is to inform all loaded
1281        /// extensions consistently, you should use the respective method on the extension controller instead.
1282        #[unsafe(method(didReplaceTab:withTab:))]
1283        #[unsafe(method_family = none)]
1284        pub unsafe fn didReplaceTab_withTab(
1285            &self,
1286            old_tab: &ProtocolObject<dyn WKWebExtensionTab>,
1287            new_tab: &ProtocolObject<dyn WKWebExtensionTab>,
1288        );
1289
1290        #[cfg(feature = "WKWebExtensionTab")]
1291        /// Should be called by the app when the properties of a tab are changed to fire appropriate events with only this extension.
1292        ///
1293        /// Parameter `properties`: The properties of the tab that were changed.
1294        ///
1295        /// Parameter `changedTab`: The tab whose properties were changed.
1296        ///
1297        /// This method informs only the specific extension of the changes to a tab's properties. If the intention is to inform all loaded
1298        /// extensions consistently, you should use the respective method on the extension controller instead.
1299        #[unsafe(method(didChangeTabProperties:forTab:))]
1300        #[unsafe(method_family = none)]
1301        pub unsafe fn didChangeTabProperties_forTab(
1302            &self,
1303            properties: WKWebExtensionTabChangedProperties,
1304            changed_tab: &ProtocolObject<dyn WKWebExtensionTab>,
1305        );
1306    );
1307}