Trait webkit2gtk::prelude::CookieManagerExt
source · [−]pub trait CookieManagerExt: 'static {
fn delete_all_cookies(&self);
fn delete_cookies_for_domain(&self, domain: &str);
fn accept_policy<P: FnOnce(Result<CookieAcceptPolicy, Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
);
fn accept_policy_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<CookieAcceptPolicy, Error>> + 'static>>;
fn domains_with_cookies<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
);
fn domains_with_cookies_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>;
fn set_accept_policy(&self, policy: CookieAcceptPolicy);
fn set_persistent_storage(
&self,
filename: &str,
storage: CookiePersistentStorage
);
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
Expand description
Required Methods
Remove all cookies of self
for the given domain
.
Deprecated since 2.16
Use WebsiteDataManagerExtManual::remove()
instead.
domain
a domain name
sourcefn accept_policy<P: FnOnce(Result<CookieAcceptPolicy, Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn accept_policy<P: FnOnce(Result<CookieAcceptPolicy, Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
Asynchronously get the cookie acceptance policy of self
.
Note that when policy was set to CookieAcceptPolicy::NoThirdParty
and
ITP is enabled, this will return CookieAcceptPolicy::Always
.
See also WebsiteDataManagerExt::set_itp_enabled()
.
When the operation is finished, callback
will be called. You can then call
webkit_cookie_manager_get_accept_policy_finish()
to get the result of the operation.
cancellable
a gio::Cancellable
or None
to ignore
callback
a GAsyncReadyCallback
to call when the request is satisfied
fn accept_policy_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<CookieAcceptPolicy, Error>> + 'static>>
Asynchronously get the list of domains for which self
contains cookies.
When the operation is finished, callback
will be called. You can then call
webkit_cookie_manager_get_domains_with_cookies_finish()
to get the result of the operation.
Deprecated since 2.16
Use WebsiteDataManagerExt::fetch()
instead.
cancellable
a gio::Cancellable
or None
to ignore
callback
a GAsyncReadyCallback
to call when the request is satisfied
sourcefn set_accept_policy(&self, policy: CookieAcceptPolicy)
fn set_accept_policy(&self, policy: CookieAcceptPolicy)
Set the cookie acceptance policy of self
as policy
.
Note that ITP has its own way to handle third-party cookies, so when it’s enabled,
and policy
is set to CookieAcceptPolicy::NoThirdParty
, CookieAcceptPolicy::Always
will be used instead. Once disabled, the policy will be set back to CookieAcceptPolicy::NoThirdParty
.
See also WebsiteDataManagerExt::set_itp_enabled()
.
policy
sourcefn set_persistent_storage(&self, filename: &str, storage: CookiePersistentStorage)
fn set_persistent_storage(&self, filename: &str, storage: CookiePersistentStorage)
Set non-session cookies.
Set the filename
where non-session cookies are stored persistently using
storage
as the format to read/write the cookies.
Cookies are initially read from filename
to create an initial set of cookies.
Then, non-session cookies will be written to filename
when the WebKitCookieManager::changed
signal is emitted.
By default, self
doesn’t store the cookies persistently, so you need to call this
method to keep cookies saved across sessions.
This method should never be called on a CookieManager
associated to an ephemeral WebsiteDataManager
.
filename
the filename to read to/write from
storage
sourcefn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
This signal is emitted when cookies are added, removed or modified.