:right-sidebar: True PolicyDecision =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: PolicyDecision(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.WebKit.NavigationPolicyDecision`, :class:`~gi.repository.WebKit.ResponsePolicyDecision` A pending policy decision. Often WebKit allows the client to decide the policy for certain operations. For instance, a client may want to open a link in a new tab, block a navigation entirely, query the user or trigger a download instead of a navigation. In these cases WebKit will fire the :obj:`~gi.repository.WebKit.WebView`\::decide-policy signal with a :obj:`~gi.repository.WebKit.PolicyDecision` object. If the signal handler does nothing, WebKit will act as if :func:`~gi.repository.WebKit.PolicyDecision.use` was called as soon as signal handling completes. To make a policy decision asynchronously, simply increment the reference count of the :obj:`~gi.repository.WebKit.PolicyDecision` object. Methods ------- .. rst-class:: interim-class .. class:: PolicyDecision :no-index: .. method:: download() -> None Spawn a download from this decision. .. method:: ignore() -> None :obj:`~gi.repository.WebKit.ResponsePolicyDecision`\, this would cancel the request. Ignore the action which triggered this decision. For instance, for a :obj:`~gi.repository.WebKit.ResponsePolicyDecision`\, this would cancel the request. .. method:: use() -> None Accept the action which triggered this decision. .. method:: use_with_policies(policies: ~gi.repository.WebKit.WebsitePolicies) -> None Accept the navigation action and continue with provided ``policies``\. Accept the navigation action which triggered this decision, and continue with ``policies`` affecting all subsequent loads of resources in the origin associated with the accepted navigation action. For example, a navigation decision to a video sharing website may be accepted under the priviso no movies are allowed to autoplay. The autoplay policy in this case would be set in the ``policies``\. .. versionadded:: 2.30 :param policies: a :obj:`~gi.repository.WebKit.WebsitePolicies` Fields ------ .. rst-class:: interim-class .. class:: PolicyDecision :no-index: .. attribute:: parent_instance .. attribute:: priv