// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace WebKit {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class AuthenticationRequest : GLib.Object {

		public AuthenticationRequest (IntPtr raw) : base(raw) {}

		protected AuthenticationRequest() : base(IntPtr.Zero)
		{
			CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
		}

		[GLib.Signal("authenticated")]
		public event WebKit.AuthenticatedHandler Authenticated {
			add {
				this.AddSignalHandler ("authenticated", value, typeof (WebKit.AuthenticatedArgs));
			}
			remove {
				this.RemoveSignalHandler ("authenticated", value);
			}
		}

		[GLib.Signal("cancelled")]
		public event System.EventHandler Cancelled {
			add {
				this.AddSignalHandler ("cancelled", value);
			}
			remove {
				this.RemoveSignalHandler ("cancelled", value);
			}
		}

		static AuthenticatedNativeDelegate Authenticated_cb_delegate;
		static AuthenticatedNativeDelegate AuthenticatedVMCallback {
			get {
				if (Authenticated_cb_delegate == null)
					Authenticated_cb_delegate = new AuthenticatedNativeDelegate (Authenticated_cb);
				return Authenticated_cb_delegate;
			}
		}

		static void OverrideAuthenticated (GLib.GType gtype)
		{
			OverrideAuthenticated (gtype, AuthenticatedVMCallback);
		}

		static void OverrideAuthenticated (GLib.GType gtype, AuthenticatedNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "authenticated", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void AuthenticatedNativeDelegate (IntPtr inst, IntPtr credential);

		static void Authenticated_cb (IntPtr inst, IntPtr credential)
		{
			try {
				AuthenticationRequest __obj = GLib.Object.GetObject (inst, false) as AuthenticationRequest;
				__obj.OnAuthenticated (WebKit.Credential.New (credential));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.AuthenticationRequest), ConnectionMethod="OverrideAuthenticated")]
		protected virtual void OnAuthenticated (WebKit.Credential credential)
		{
			InternalAuthenticated (credential);
		}

		private void InternalAuthenticated (WebKit.Credential credential)
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (credential);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static CancelledNativeDelegate Cancelled_cb_delegate;
		static CancelledNativeDelegate CancelledVMCallback {
			get {
				if (Cancelled_cb_delegate == null)
					Cancelled_cb_delegate = new CancelledNativeDelegate (Cancelled_cb);
				return Cancelled_cb_delegate;
			}
		}

		static void OverrideCancelled (GLib.GType gtype)
		{
			OverrideCancelled (gtype, CancelledVMCallback);
		}

		static void OverrideCancelled (GLib.GType gtype, CancelledNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "cancelled", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void CancelledNativeDelegate (IntPtr inst);

		static void Cancelled_cb (IntPtr inst)
		{
			try {
				AuthenticationRequest __obj = GLib.Object.GetObject (inst, false) as AuthenticationRequest;
				__obj.OnCancelled ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.AuthenticationRequest), ConnectionMethod="OverrideCancelled")]
		protected virtual void OnCancelled ()
		{
			InternalCancelled ();
		}

		private void InternalCancelled ()
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
			GLib.Value[] vals = new GLib.Value [1];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("_webkit_reserved0"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // _webkit_reserved0
							, null
							, "_webkit_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved1
							, "_webkit_reserved0"
							, "_webkit_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved2
							, "_webkit_reserved1"
							, "_webkit_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved3
							, "_webkit_reserved2"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_authentication_request_get_type();
		static d_webkit_authentication_request_get_type webkit_authentication_request_get_type = FuncLoader.LoadFunction<d_webkit_authentication_request_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_type"));

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = webkit_authentication_request_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_authentication_request_authenticate(IntPtr raw, IntPtr credential);
		static d_webkit_authentication_request_authenticate webkit_authentication_request_authenticate = FuncLoader.LoadFunction<d_webkit_authentication_request_authenticate>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_authenticate"));

		public void Authenticate(WebKit.Credential credential) {
			IntPtr native_credential = GLib.Marshaller.StructureToPtrAlloc (credential);
			webkit_authentication_request_authenticate(Handle, native_credential);
			Marshal.FreeHGlobal (native_credential);
		}

		public void Authenticate() {
			Authenticate (WebKit.Credential.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_webkit_authentication_request_can_save_credentials(IntPtr raw);
		static d_webkit_authentication_request_can_save_credentials webkit_authentication_request_can_save_credentials = FuncLoader.LoadFunction<d_webkit_authentication_request_can_save_credentials>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_can_save_credentials"));

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_authentication_request_set_can_save_credentials(IntPtr raw, bool enabled);
		static d_webkit_authentication_request_set_can_save_credentials webkit_authentication_request_set_can_save_credentials = FuncLoader.LoadFunction<d_webkit_authentication_request_set_can_save_credentials>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_set_can_save_credentials"));

		public bool CanSaveCredentials { 
			get {
				bool raw_ret = webkit_authentication_request_can_save_credentials(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set {
				webkit_authentication_request_set_can_save_credentials(Handle, value);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_authentication_request_cancel(IntPtr raw);
		static d_webkit_authentication_request_cancel webkit_authentication_request_cancel = FuncLoader.LoadFunction<d_webkit_authentication_request_cancel>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_cancel"));

		public void Cancel() {
			webkit_authentication_request_cancel(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_authentication_request_get_host(IntPtr raw);
		static d_webkit_authentication_request_get_host webkit_authentication_request_get_host = FuncLoader.LoadFunction<d_webkit_authentication_request_get_host>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_host"));

		public string Host { 
			get {
				IntPtr raw_ret = webkit_authentication_request_get_host(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate uint d_webkit_authentication_request_get_port(IntPtr raw);
		static d_webkit_authentication_request_get_port webkit_authentication_request_get_port = FuncLoader.LoadFunction<d_webkit_authentication_request_get_port>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_port"));

		public uint Port { 
			get {
				uint raw_ret = webkit_authentication_request_get_port(Handle);
				uint ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_authentication_request_get_proposed_credential(IntPtr raw);
		static d_webkit_authentication_request_get_proposed_credential webkit_authentication_request_get_proposed_credential = FuncLoader.LoadFunction<d_webkit_authentication_request_get_proposed_credential>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_proposed_credential"));

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_authentication_request_set_proposed_credential(IntPtr raw, IntPtr value);
		static d_webkit_authentication_request_set_proposed_credential webkit_authentication_request_set_proposed_credential = FuncLoader.LoadFunction<d_webkit_authentication_request_set_proposed_credential>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_set_proposed_credential"));

		public WebKit.Credential ProposedCredential { 
			get {
				IntPtr raw_ret = webkit_authentication_request_get_proposed_credential(Handle);
				WebKit.Credential ret = WebKit.Credential.New (raw_ret);
				return ret;
			}
			set {
				IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
				webkit_authentication_request_set_proposed_credential(Handle, native_value);
				Marshal.FreeHGlobal (native_value);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_authentication_request_get_realm(IntPtr raw);
		static d_webkit_authentication_request_get_realm webkit_authentication_request_get_realm = FuncLoader.LoadFunction<d_webkit_authentication_request_get_realm>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_realm"));

		public string Realm { 
			get {
				IntPtr raw_ret = webkit_authentication_request_get_realm(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_webkit_authentication_request_get_scheme(IntPtr raw);
		static d_webkit_authentication_request_get_scheme webkit_authentication_request_get_scheme = FuncLoader.LoadFunction<d_webkit_authentication_request_get_scheme>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_scheme"));

		public WebKit.AuthenticationScheme Scheme { 
			get {
				int raw_ret = webkit_authentication_request_get_scheme(Handle);
				WebKit.AuthenticationScheme ret = (WebKit.AuthenticationScheme) raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_authentication_request_get_security_origin(IntPtr raw);
		static d_webkit_authentication_request_get_security_origin webkit_authentication_request_get_security_origin = FuncLoader.LoadFunction<d_webkit_authentication_request_get_security_origin>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_get_security_origin"));

		public WebKit.SecurityOrigin SecurityOrigin { 
			get {
				IntPtr raw_ret = webkit_authentication_request_get_security_origin(Handle);
				WebKit.SecurityOrigin ret = WebKit.SecurityOrigin.New (raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_webkit_authentication_request_is_for_proxy(IntPtr raw);
		static d_webkit_authentication_request_is_for_proxy webkit_authentication_request_is_for_proxy = FuncLoader.LoadFunction<d_webkit_authentication_request_is_for_proxy>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_is_for_proxy"));

		public bool IsForProxy { 
			get {
				bool raw_ret = webkit_authentication_request_is_for_proxy(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_webkit_authentication_request_is_retry(IntPtr raw);
		static d_webkit_authentication_request_is_retry webkit_authentication_request_is_retry = FuncLoader.LoadFunction<d_webkit_authentication_request_is_retry>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_authentication_request_is_retry"));

		public bool IsRetry { 
			get {
				bool raw_ret = webkit_authentication_request_is_retry(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}


		static AuthenticationRequest ()
		{
			GtkSharp.WebkitGtkSharp.ObjectManager.Initialize ();
		}

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, GLib.Object.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
