1 module webkit2.ResponsePolicyDecision; 2 3 private import gobject.ObjectG; 4 private import webkit2.PolicyDecision; 5 private import webkit2.URIRequest; 6 private import webkit2.URIResponse; 7 private import webkit2.c.functions; 8 public import webkit2.c.types; 9 10 11 /** 12 * WebKitResponsePolicyDecision represents a policy decision for a 13 * resource response, whether from the network or the local system. 14 * A very common use case for these types of decision is deciding 15 * whether or not to download a particular resource or to load it 16 * normally. 17 */ 18 public class ResponsePolicyDecision : PolicyDecision 19 { 20 /** the main Gtk struct */ 21 protected WebKitResponsePolicyDecision* webKitResponsePolicyDecision; 22 23 /** Get the main Gtk struct */ 24 public WebKitResponsePolicyDecision* getResponsePolicyDecisionStruct(bool transferOwnership = false) 25 { 26 if (transferOwnership) 27 ownedRef = false; 28 return webKitResponsePolicyDecision; 29 } 30 31 /** the main Gtk struct as a void* */ 32 protected override void* getStruct() 33 { 34 return cast(void*)webKitResponsePolicyDecision; 35 } 36 37 /** 38 * Sets our main struct and passes it to the parent class. 39 */ 40 public this (WebKitResponsePolicyDecision* webKitResponsePolicyDecision, bool ownedRef = false) 41 { 42 this.webKitResponsePolicyDecision = webKitResponsePolicyDecision; 43 super(cast(WebKitPolicyDecision*)webKitResponsePolicyDecision, ownedRef); 44 } 45 46 47 /** */ 48 public static GType getType() 49 { 50 return webkit_response_policy_decision_get_type(); 51 } 52 53 /** 54 * Return the #WebKitURIRequest associated with the response decision. 55 * Modifications to the returned object are <emphasis>not</emphasis> taken 56 * into account when the request is sent over the network, and is intended 57 * only to aid in evaluating whether a response decision should be taken or 58 * not. To modify requests before they are sent over the network the 59 * #WebKitPage::send-request signal can be used instead. 60 * 61 * Returns: The URI request that is associated with this policy decision. 62 */ 63 public URIRequest getRequest() 64 { 65 auto __p = webkit_response_policy_decision_get_request(webKitResponsePolicyDecision); 66 67 if(__p is null) 68 { 69 return null; 70 } 71 72 return ObjectG.getDObject!(URIRequest)(cast(WebKitURIRequest*) __p); 73 } 74 75 /** 76 * Gets the value of the #WebKitResponsePolicyDecision:response property. 77 * 78 * Returns: The URI response that is associated with this policy decision. 79 */ 80 public URIResponse getResponse() 81 { 82 auto __p = webkit_response_policy_decision_get_response(webKitResponsePolicyDecision); 83 84 if(__p is null) 85 { 86 return null; 87 } 88 89 return ObjectG.getDObject!(URIResponse)(cast(WebKitURIResponse*) __p); 90 } 91 92 /** 93 * Gets whether the MIME type of the response can be displayed in the #WebKitWebView 94 * that triggered this policy decision request. See also webkit_web_view_can_show_mime_type(). 95 * 96 * Returns: %TRUE if the MIME type of the response is supported or %FALSE otherwise 97 * 98 * Since: 2.4 99 */ 100 public bool isMimeTypeSupported() 101 { 102 return webkit_response_policy_decision_is_mime_type_supported(webKitResponsePolicyDecision) != 0; 103 } 104 }