Class PolicyDecision

All Implemented Interfaces:
Proxy
Direct Known Subclasses:
NavigationPolicyDecision, PolicyDecision.PolicyDecision$Impl, ResponsePolicyDecision

@Generated("org.javagi.JavaGI") public abstract class PolicyDecision extends GObject

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 WebKitWebView::decide-policy signal with a WebKitPolicyDecision object. If the signal handler does nothing, WebKit will act as if webkit_policy_decision_use() was called as soon as signal handling completes. To make a policy decision asynchronously, simply increment the reference count of the WebKitPolicyDecision object.

  • Constructor Details

    • PolicyDecision

      public PolicyDecision(MemorySegment address)
      Create a PolicyDecision instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • PolicyDecision

      public PolicyDecision()
      Create a new PolicyDecision.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the PolicyDecision class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected PolicyDecision asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • download

      public void download()
      Spawn a download from this decision.
    • ignore

      public void ignore()

      WebKitResponsePolicyDecision, this would cancel the request.

      Ignore the action which triggered this decision. For instance, for a WebKitResponsePolicyDecision, this would cancel the request.

    • use

      public void use()
      Accept the action which triggered this decision.
    • useWithPolicies

      public void useWithPolicies(WebsitePolicies policies)

      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.

      Parameters:
      policies - a WebKitWebsitePolicies
      Since:
      2.30