objc2_web_kit/generated/
WKWebExtensionControllerConfiguration.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// A ``WKWebExtensionControllerConfiguration`` object with which to initialize a web extension controller.
12    ///
13    /// Contains properties used to configure a ``WKWebExtensionController``.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensioncontrollerconfiguration?language=objc)
16    #[unsafe(super(NSObject))]
17    #[thread_kind = MainThreadOnly]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct WKWebExtensionControllerConfiguration;
20);
21
22extern_conformance!(
23    unsafe impl NSCoding for WKWebExtensionControllerConfiguration {}
24);
25
26extern_conformance!(
27    unsafe impl NSCopying for WKWebExtensionControllerConfiguration {}
28);
29
30unsafe impl CopyingHelper for WKWebExtensionControllerConfiguration {
31    type Result = Self;
32}
33
34extern_conformance!(
35    unsafe impl NSObjectProtocol for WKWebExtensionControllerConfiguration {}
36);
37
38extern_conformance!(
39    unsafe impl NSSecureCoding for WKWebExtensionControllerConfiguration {}
40);
41
42impl WKWebExtensionControllerConfiguration {
43    extern_methods!(
44        #[unsafe(method(new))]
45        #[unsafe(method_family = new)]
46        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
47
48        #[unsafe(method(init))]
49        #[unsafe(method_family = init)]
50        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52        /// Returns a new default configuration that is persistent and not unique.
53        ///
54        /// If a ``WKWebExtensionController`` is associated with a persistent configuration,
55        /// data will be written to the file system in a common location. When using multiple extension controllers, each
56        /// controller should use a unique configuration to avoid conflicts.
57        ///
58        /// See also: configurationWithIdentifier:
59        #[unsafe(method(defaultConfiguration))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn defaultConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
62
63        /// Returns a new non-persistent configuration.
64        ///
65        /// If a ``WKWebExtensionController`` is associated with a non-persistent configuration,
66        /// no data will be written to the file system. This is useful for extensions in "private browsing" situations.
67        #[unsafe(method(nonPersistentConfiguration))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn nonPersistentConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
70
71        /// Returns a new configuration that is persistent and unique for the specified identifier.
72        ///
73        /// If a ``WKWebExtensionController`` is associated with a unique persistent configuration,
74        /// data will be written to the file system in a unique location based on the specified identifier.
75        ///
76        /// See also: defaultConfiguration
77        #[unsafe(method(configurationWithIdentifier:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn configurationWithIdentifier(
80            identifier: &NSUUID,
81            mtm: MainThreadMarker,
82        ) -> Retained<Self>;
83
84        /// A Boolean value indicating if this context will write data to the the file system.
85        #[unsafe(method(isPersistent))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn isPersistent(&self) -> bool;
88
89        /// The unique identifier used for persistent configuration storage, or `nil` when it is the default or not persistent.
90        #[unsafe(method(identifier))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn identifier(&self) -> Option<Retained<NSUUID>>;
93
94        #[cfg(feature = "WKWebViewConfiguration")]
95        /// The web view configuration to be used as a basis for configuring web views in extension contexts.
96        #[unsafe(method(webViewConfiguration))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn webViewConfiguration(&self) -> Retained<WKWebViewConfiguration>;
99
100        #[cfg(feature = "WKWebViewConfiguration")]
101        /// Setter for [`webViewConfiguration`][Self::webViewConfiguration].
102        #[unsafe(method(setWebViewConfiguration:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setWebViewConfiguration(
105            &self,
106            web_view_configuration: Option<&WKWebViewConfiguration>,
107        );
108
109        #[cfg(feature = "WKWebsiteDataStore")]
110        /// The default data store for website data and cookie access in extension contexts.
111        ///
112        /// This property sets the primary data store for managing website data, including cookies, which extensions can access,
113        /// subject to the granted permissions within the extension contexts. Defaults to ``WKWebsiteDataStore.defaultDataStore``.
114        ///
115        /// Note: In addition to this data store, extensions can also access other data stores, such as non-persistent ones, for any open tabs.
116        #[unsafe(method(defaultWebsiteDataStore))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn defaultWebsiteDataStore(&self) -> Option<Retained<WKWebsiteDataStore>>;
119
120        #[cfg(feature = "WKWebsiteDataStore")]
121        /// Setter for [`defaultWebsiteDataStore`][Self::defaultWebsiteDataStore].
122        #[unsafe(method(setDefaultWebsiteDataStore:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setDefaultWebsiteDataStore(
125            &self,
126            default_website_data_store: Option<&WKWebsiteDataStore>,
127        );
128    );
129}