{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.WebKit2.Objects.WebContext
    ( 

-- * Exported types
    WebContext(..)                          ,
    WebContextK                             ,
    toWebContext                            ,
    noWebContext                            ,


 -- * Methods
-- ** webContextAllowTlsCertificateForHost
    webContextAllowTlsCertificateForHost    ,


-- ** webContextClearCache
    webContextClearCache                    ,


-- ** webContextDownloadUri
    webContextDownloadUri                   ,


-- ** webContextGetCacheModel
    webContextGetCacheModel                 ,


-- ** webContextGetCookieManager
    webContextGetCookieManager              ,


-- ** webContextGetDefault
    webContextGetDefault                    ,


-- ** webContextGetFaviconDatabase
    webContextGetFaviconDatabase            ,


-- ** webContextGetFaviconDatabaseDirectory
    webContextGetFaviconDatabaseDirectory   ,


-- ** webContextGetPlugins
    webContextGetPlugins                    ,


-- ** webContextGetPluginsFinish
    webContextGetPluginsFinish              ,


-- ** webContextGetProcessModel
    webContextGetProcessModel               ,


-- ** webContextGetSecurityManager
    webContextGetSecurityManager            ,


-- ** webContextGetSpellCheckingEnabled
    webContextGetSpellCheckingEnabled       ,


-- ** webContextGetSpellCheckingLanguages
    webContextGetSpellCheckingLanguages     ,


-- ** webContextGetTlsErrorsPolicy
    webContextGetTlsErrorsPolicy            ,


-- ** webContextGetWebProcessCountLimit
    webContextGetWebProcessCountLimit       ,


-- ** webContextGetWebsiteDataManager
    webContextGetWebsiteDataManager         ,


-- ** webContextNew
    webContextNew                           ,


-- ** webContextNewWithWebsiteDataManager
    webContextNewWithWebsiteDataManager     ,


-- ** webContextPrefetchDns
    webContextPrefetchDns                   ,


-- ** webContextRegisterUriScheme
    webContextRegisterUriScheme             ,


-- ** webContextSetAdditionalPluginsDirectory
    webContextSetAdditionalPluginsDirectory ,


-- ** webContextSetCacheModel
    webContextSetCacheModel                 ,


-- ** webContextSetDiskCacheDirectory
    webContextSetDiskCacheDirectory         ,


-- ** webContextSetFaviconDatabaseDirectory
    webContextSetFaviconDatabaseDirectory   ,


-- ** webContextSetPreferredLanguages
    webContextSetPreferredLanguages         ,


-- ** webContextSetProcessModel
    webContextSetProcessModel               ,


-- ** webContextSetSpellCheckingEnabled
    webContextSetSpellCheckingEnabled       ,


-- ** webContextSetSpellCheckingLanguages
    webContextSetSpellCheckingLanguages     ,


-- ** webContextSetTlsErrorsPolicy
    webContextSetTlsErrorsPolicy            ,


-- ** webContextSetWebExtensionsDirectory
    webContextSetWebExtensionsDirectory     ,


-- ** webContextSetWebExtensionsInitializationUserData
    webContextSetWebExtensionsInitializationUserData,


-- ** webContextSetWebProcessCountLimit
    webContextSetWebProcessCountLimit       ,




 -- * Properties
-- ** LocalStorageDirectory
    WebContextLocalStorageDirectoryPropertyInfo,
    constructWebContextLocalStorageDirectory,
    getWebContextLocalStorageDirectory      ,


-- ** WebsiteDataManager
    WebContextWebsiteDataManagerPropertyInfo,
    constructWebContextWebsiteDataManager   ,
    getWebContextWebsiteDataManager         ,




 -- * Signals
-- ** DownloadStarted
    WebContextDownloadStartedCallback       ,
    WebContextDownloadStartedCallbackC      ,
    WebContextDownloadStartedSignalInfo     ,
    afterWebContextDownloadStarted          ,
    mkWebContextDownloadStartedCallback     ,
    noWebContextDownloadStartedCallback     ,
    onWebContextDownloadStarted             ,
    webContextDownloadStartedCallbackWrapper,
    webContextDownloadStartedClosure        ,


-- ** InitializeWebExtensions
    WebContextInitializeWebExtensionsCallback,
    WebContextInitializeWebExtensionsCallbackC,
    WebContextInitializeWebExtensionsSignalInfo,
    afterWebContextInitializeWebExtensions  ,
    mkWebContextInitializeWebExtensionsCallback,
    noWebContextInitializeWebExtensionsCallback,
    onWebContextInitializeWebExtensions     ,
    webContextInitializeWebExtensionsCallbackWrapper,
    webContextInitializeWebExtensionsClosure,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.WebKit2.Types
import GI.WebKit2.Callbacks
import qualified GI.GLib as GLib
import qualified GI.GObject as GObject
import qualified GI.Gio as Gio

newtype WebContext = WebContext (ForeignPtr WebContext)
foreign import ccall "webkit_web_context_get_type"
    c_webkit_web_context_get_type :: IO GType

type instance ParentTypes WebContext = WebContextParentTypes
type WebContextParentTypes = '[GObject.Object]

instance GObject WebContext where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_web_context_get_type
    

class GObject o => WebContextK o
instance (GObject o, IsDescendantOf WebContext o) => WebContextK o

toWebContext :: WebContextK o => o -> IO WebContext
toWebContext = unsafeCastTo WebContext

noWebContext :: Maybe WebContext
noWebContext = Nothing

-- signal WebContext::download-started
type WebContextDownloadStartedCallback =
    Download ->
    IO ()

noWebContextDownloadStartedCallback :: Maybe WebContextDownloadStartedCallback
noWebContextDownloadStartedCallback = Nothing

type WebContextDownloadStartedCallbackC =
    Ptr () ->                               -- object
    Ptr Download ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkWebContextDownloadStartedCallback :: WebContextDownloadStartedCallbackC -> IO (FunPtr WebContextDownloadStartedCallbackC)

webContextDownloadStartedClosure :: WebContextDownloadStartedCallback -> IO Closure
webContextDownloadStartedClosure cb = newCClosure =<< mkWebContextDownloadStartedCallback wrapped
    where wrapped = webContextDownloadStartedCallbackWrapper cb

webContextDownloadStartedCallbackWrapper ::
    WebContextDownloadStartedCallback ->
    Ptr () ->
    Ptr Download ->
    Ptr () ->
    IO ()
webContextDownloadStartedCallbackWrapper _cb _ download _ = do
    download' <- (newObject Download) download
    _cb  download'

onWebContextDownloadStarted :: (GObject a, MonadIO m) => a -> WebContextDownloadStartedCallback -> m SignalHandlerId
onWebContextDownloadStarted obj cb = liftIO $ connectWebContextDownloadStarted obj cb SignalConnectBefore
afterWebContextDownloadStarted :: (GObject a, MonadIO m) => a -> WebContextDownloadStartedCallback -> m SignalHandlerId
afterWebContextDownloadStarted obj cb = connectWebContextDownloadStarted obj cb SignalConnectAfter

connectWebContextDownloadStarted :: (GObject a, MonadIO m) =>
                                    a -> WebContextDownloadStartedCallback -> SignalConnectMode -> m SignalHandlerId
connectWebContextDownloadStarted obj cb after = liftIO $ do
    cb' <- mkWebContextDownloadStartedCallback (webContextDownloadStartedCallbackWrapper cb)
    connectSignalFunPtr obj "download-started" cb' after

-- signal WebContext::initialize-web-extensions
type WebContextInitializeWebExtensionsCallback =
    IO ()

noWebContextInitializeWebExtensionsCallback :: Maybe WebContextInitializeWebExtensionsCallback
noWebContextInitializeWebExtensionsCallback = Nothing

type WebContextInitializeWebExtensionsCallbackC =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkWebContextInitializeWebExtensionsCallback :: WebContextInitializeWebExtensionsCallbackC -> IO (FunPtr WebContextInitializeWebExtensionsCallbackC)

webContextInitializeWebExtensionsClosure :: WebContextInitializeWebExtensionsCallback -> IO Closure
webContextInitializeWebExtensionsClosure cb = newCClosure =<< mkWebContextInitializeWebExtensionsCallback wrapped
    where wrapped = webContextInitializeWebExtensionsCallbackWrapper cb

webContextInitializeWebExtensionsCallbackWrapper ::
    WebContextInitializeWebExtensionsCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
webContextInitializeWebExtensionsCallbackWrapper _cb _ _ = do
    _cb 

onWebContextInitializeWebExtensions :: (GObject a, MonadIO m) => a -> WebContextInitializeWebExtensionsCallback -> m SignalHandlerId
onWebContextInitializeWebExtensions obj cb = liftIO $ connectWebContextInitializeWebExtensions obj cb SignalConnectBefore
afterWebContextInitializeWebExtensions :: (GObject a, MonadIO m) => a -> WebContextInitializeWebExtensionsCallback -> m SignalHandlerId
afterWebContextInitializeWebExtensions obj cb = connectWebContextInitializeWebExtensions obj cb SignalConnectAfter

connectWebContextInitializeWebExtensions :: (GObject a, MonadIO m) =>
                                            a -> WebContextInitializeWebExtensionsCallback -> SignalConnectMode -> m SignalHandlerId
connectWebContextInitializeWebExtensions obj cb after = liftIO $ do
    cb' <- mkWebContextInitializeWebExtensionsCallback (webContextInitializeWebExtensionsCallbackWrapper cb)
    connectSignalFunPtr obj "initialize-web-extensions" cb' after

-- VVV Prop "local-storage-directory"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getWebContextLocalStorageDirectory :: (MonadIO m, WebContextK o) => o -> m T.Text
getWebContextLocalStorageDirectory obj = liftIO $ getObjectPropertyString obj "local-storage-directory"

constructWebContextLocalStorageDirectory :: T.Text -> IO ([Char], GValue)
constructWebContextLocalStorageDirectory val = constructObjectPropertyString "local-storage-directory" val

data WebContextLocalStorageDirectoryPropertyInfo
instance AttrInfo WebContextLocalStorageDirectoryPropertyInfo where
    type AttrAllowedOps WebContextLocalStorageDirectoryPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint WebContextLocalStorageDirectoryPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint WebContextLocalStorageDirectoryPropertyInfo = WebContextK
    type AttrGetType WebContextLocalStorageDirectoryPropertyInfo = T.Text
    type AttrLabel WebContextLocalStorageDirectoryPropertyInfo = "WebContext::local-storage-directory"
    attrGet _ = getWebContextLocalStorageDirectory
    attrSet _ = undefined
    attrConstruct _ = constructWebContextLocalStorageDirectory

-- VVV Prop "website-data-manager"
   -- Type: TInterface "WebKit2" "WebsiteDataManager"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getWebContextWebsiteDataManager :: (MonadIO m, WebContextK o) => o -> m WebsiteDataManager
getWebContextWebsiteDataManager obj = liftIO $ getObjectPropertyObject obj "website-data-manager" WebsiteDataManager

constructWebContextWebsiteDataManager :: (WebsiteDataManagerK a) => a -> IO ([Char], GValue)
constructWebContextWebsiteDataManager val = constructObjectPropertyObject "website-data-manager" val

data WebContextWebsiteDataManagerPropertyInfo
instance AttrInfo WebContextWebsiteDataManagerPropertyInfo where
    type AttrAllowedOps WebContextWebsiteDataManagerPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint WebContextWebsiteDataManagerPropertyInfo = WebsiteDataManagerK
    type AttrBaseTypeConstraint WebContextWebsiteDataManagerPropertyInfo = WebContextK
    type AttrGetType WebContextWebsiteDataManagerPropertyInfo = WebsiteDataManager
    type AttrLabel WebContextWebsiteDataManagerPropertyInfo = "WebContext::website-data-manager"
    attrGet _ = getWebContextWebsiteDataManager
    attrSet _ = undefined
    attrConstruct _ = constructWebContextWebsiteDataManager

type instance AttributeList WebContext = WebContextAttributeList
type WebContextAttributeList = ('[ '("local-storage-directory", WebContextLocalStorageDirectoryPropertyInfo), '("website-data-manager", WebContextWebsiteDataManagerPropertyInfo)] :: [(Symbol, *)])

data WebContextDownloadStartedSignalInfo
instance SignalInfo WebContextDownloadStartedSignalInfo where
    type HaskellCallbackType WebContextDownloadStartedSignalInfo = WebContextDownloadStartedCallback
    connectSignal _ = connectWebContextDownloadStarted

data WebContextInitializeWebExtensionsSignalInfo
instance SignalInfo WebContextInitializeWebExtensionsSignalInfo where
    type HaskellCallbackType WebContextInitializeWebExtensionsSignalInfo = WebContextInitializeWebExtensionsCallback
    connectSignal _ = connectWebContextInitializeWebExtensions

type instance SignalList WebContext = WebContextSignalList
type WebContextSignalList = ('[ '("download-started", WebContextDownloadStartedSignalInfo), '("initialize-web-extensions", WebContextInitializeWebExtensionsSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method WebContext::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "WebKit2" "WebContext"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_new" webkit_web_context_new :: 
    IO (Ptr WebContext)


webContextNew ::
    (MonadIO m) =>
    m WebContext
webContextNew  = liftIO $ do
    result <- webkit_web_context_new
    checkUnexpectedReturnNULL "webkit_web_context_new" result
    result' <- (wrapObject WebContext) result
    return result'

-- method WebContext::new_with_website_data_manager
-- method type : Constructor
-- Args : [Arg {argName = "manager", argType = TInterface "WebKit2" "WebsiteDataManager", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "manager", argType = TInterface "WebKit2" "WebsiteDataManager", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "WebContext"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_new_with_website_data_manager" webkit_web_context_new_with_website_data_manager :: 
    Ptr WebsiteDataManager ->               -- manager : TInterface "WebKit2" "WebsiteDataManager"
    IO (Ptr WebContext)


webContextNewWithWebsiteDataManager ::
    (MonadIO m, WebsiteDataManagerK a) =>
    a ->                                    -- manager
    m WebContext
webContextNewWithWebsiteDataManager manager = liftIO $ do
    let manager' = unsafeManagedPtrCastPtr manager
    result <- webkit_web_context_new_with_website_data_manager manager'
    checkUnexpectedReturnNULL "webkit_web_context_new_with_website_data_manager" result
    result' <- (wrapObject WebContext) result
    touchManagedPtr manager
    return result'

-- method WebContext::allow_tls_certificate_for_host
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "certificate", argType = TInterface "Gio" "TlsCertificate", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "host", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "certificate", argType = TInterface "Gio" "TlsCertificate", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "host", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_allow_tls_certificate_for_host" webkit_web_context_allow_tls_certificate_for_host :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Ptr Gio.TlsCertificate ->               -- certificate : TInterface "Gio" "TlsCertificate"
    CString ->                              -- host : TBasicType TUTF8
    IO ()


webContextAllowTlsCertificateForHost ::
    (MonadIO m, WebContextK a, Gio.TlsCertificateK b) =>
    a ->                                    -- _obj
    b ->                                    -- certificate
    T.Text ->                               -- host
    m ()
webContextAllowTlsCertificateForHost _obj certificate host = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let certificate' = unsafeManagedPtrCastPtr certificate
    host' <- textToCString host
    webkit_web_context_allow_tls_certificate_for_host _obj' certificate' host'
    touchManagedPtr _obj
    touchManagedPtr certificate
    freeMem host'
    return ()

-- method WebContext::clear_cache
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_clear_cache" webkit_web_context_clear_cache :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO ()


webContextClearCache ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m ()
webContextClearCache _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    webkit_web_context_clear_cache _obj'
    touchManagedPtr _obj
    return ()

-- method WebContext::download_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "Download"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_download_uri" webkit_web_context_download_uri :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- uri : TBasicType TUTF8
    IO (Ptr Download)


webContextDownloadUri ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- uri
    m Download
webContextDownloadUri _obj uri = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    uri' <- textToCString uri
    result <- webkit_web_context_download_uri _obj' uri'
    checkUnexpectedReturnNULL "webkit_web_context_download_uri" result
    result' <- (wrapObject Download) result
    touchManagedPtr _obj
    freeMem uri'
    return result'

-- method WebContext::get_cache_model
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "CacheModel"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_cache_model" webkit_web_context_get_cache_model :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO CUInt


webContextGetCacheModel ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m CacheModel
webContextGetCacheModel _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_cache_model _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_cookie_manager
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "CookieManager"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_cookie_manager" webkit_web_context_get_cookie_manager :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO (Ptr CookieManager)


webContextGetCookieManager ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m CookieManager
webContextGetCookieManager _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_cookie_manager _obj'
    checkUnexpectedReturnNULL "webkit_web_context_get_cookie_manager" result
    result' <- (newObject CookieManager) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_favicon_database
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "FaviconDatabase"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_favicon_database" webkit_web_context_get_favicon_database :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO (Ptr FaviconDatabase)


webContextGetFaviconDatabase ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m FaviconDatabase
webContextGetFaviconDatabase _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_favicon_database _obj'
    checkUnexpectedReturnNULL "webkit_web_context_get_favicon_database" result
    result' <- (newObject FaviconDatabase) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_favicon_database_directory
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_favicon_database_directory" webkit_web_context_get_favicon_database_directory :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO CString


webContextGetFaviconDatabaseDirectory ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m T.Text
webContextGetFaviconDatabaseDirectory _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_favicon_database_directory _obj'
    checkUnexpectedReturnNULL "webkit_web_context_get_favicon_database_directory" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_plugins
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_plugins" webkit_web_context_get_plugins :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Ptr Gio.Cancellable ->                  -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr Gio.AsyncReadyCallbackC ->       -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


webContextGetPlugins ::
    (MonadIO m, WebContextK a, Gio.CancellableK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- cancellable
    Maybe (Gio.AsyncReadyCallback) ->       -- callback
    m ()
webContextGetPlugins _obj cancellable callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.mkAsyncReadyCallback (Gio.asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    webkit_web_context_get_plugins _obj' maybeCancellable maybeCallback user_data
    touchManagedPtr _obj
    whenJust cancellable touchManagedPtr
    return ()

-- method WebContext::get_plugins_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "WebKit2" "Plugin")
-- throws : True
-- Skip return : False

foreign import ccall "webkit_web_context_get_plugins_finish" webkit_web_context_get_plugins_finish :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Ptr Gio.AsyncResult ->                  -- result : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Plugin)))


webContextGetPluginsFinish ::
    (MonadIO m, WebContextK a, Gio.AsyncResultK b) =>
    a ->                                    -- _obj
    b ->                                    -- result
    m [Plugin]
webContextGetPluginsFinish _obj result_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let result_' = unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ webkit_web_context_get_plugins_finish _obj' result_'
        checkUnexpectedReturnNULL "webkit_web_context_get_plugins_finish" result
        result' <- unpackGList result
        result'' <- mapM (wrapObject Plugin) result'
        g_list_free result
        touchManagedPtr _obj
        touchManagedPtr result_
        return result''
     ) (do
        return ()
     )

-- method WebContext::get_process_model
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "ProcessModel"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_process_model" webkit_web_context_get_process_model :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO CUInt


webContextGetProcessModel ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m ProcessModel
webContextGetProcessModel _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_process_model _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_security_manager
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "SecurityManager"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_security_manager" webkit_web_context_get_security_manager :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO (Ptr SecurityManager)


webContextGetSecurityManager ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m SecurityManager
webContextGetSecurityManager _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_security_manager _obj'
    checkUnexpectedReturnNULL "webkit_web_context_get_security_manager" result
    result' <- (newObject SecurityManager) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_spell_checking_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_spell_checking_enabled" webkit_web_context_get_spell_checking_enabled :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO CInt


webContextGetSpellCheckingEnabled ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m Bool
webContextGetSpellCheckingEnabled _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_spell_checking_enabled _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_spell_checking_languages
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_spell_checking_languages" webkit_web_context_get_spell_checking_languages :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO (Ptr CString)


webContextGetSpellCheckingLanguages ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m [T.Text]
webContextGetSpellCheckingLanguages _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_spell_checking_languages _obj'
    checkUnexpectedReturnNULL "webkit_web_context_get_spell_checking_languages" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_tls_errors_policy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "TLSErrorsPolicy"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_tls_errors_policy" webkit_web_context_get_tls_errors_policy :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO CUInt


webContextGetTlsErrorsPolicy ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m TLSErrorsPolicy
webContextGetTlsErrorsPolicy _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_tls_errors_policy _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method WebContext::get_web_process_count_limit
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_web_process_count_limit" webkit_web_context_get_web_process_count_limit :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO Word32


webContextGetWebProcessCountLimit ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m Word32
webContextGetWebProcessCountLimit _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_web_process_count_limit _obj'
    touchManagedPtr _obj
    return result

-- method WebContext::get_website_data_manager
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "WebsiteDataManager"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_website_data_manager" webkit_web_context_get_website_data_manager :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    IO (Ptr WebsiteDataManager)


webContextGetWebsiteDataManager ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    m WebsiteDataManager
webContextGetWebsiteDataManager _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_context_get_website_data_manager _obj'
    checkUnexpectedReturnNULL "webkit_web_context_get_website_data_manager" result
    result' <- (newObject WebsiteDataManager) result
    touchManagedPtr _obj
    return result'

-- method WebContext::prefetch_dns
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hostname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hostname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_prefetch_dns" webkit_web_context_prefetch_dns :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- hostname : TBasicType TUTF8
    IO ()


webContextPrefetchDns ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- hostname
    m ()
webContextPrefetchDns _obj hostname = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    hostname' <- textToCString hostname
    webkit_web_context_prefetch_dns _obj' hostname'
    touchManagedPtr _obj
    freeMem hostname'
    return ()

-- method WebContext::register_uri_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "WebKit2" "URISchemeRequestCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data_destroy_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "WebKit2" "URISchemeRequestCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_register_uri_scheme" webkit_web_context_register_uri_scheme :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- scheme : TBasicType TUTF8
    FunPtr URISchemeRequestCallbackC ->     -- callback : TInterface "WebKit2" "URISchemeRequestCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- user_data_destroy_func : TInterface "GLib" "DestroyNotify"
    IO ()


webContextRegisterUriScheme ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- scheme
    URISchemeRequestCallback ->             -- callback
    m ()
webContextRegisterUriScheme _obj scheme callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    scheme' <- textToCString scheme
    callback' <- mkURISchemeRequestCallback (uRISchemeRequestCallbackWrapper Nothing callback)
    let user_data = castFunPtrToPtr callback'
    let user_data_destroy_func = safeFreeFunPtrPtr
    webkit_web_context_register_uri_scheme _obj' scheme' callback' user_data user_data_destroy_func
    touchManagedPtr _obj
    freeMem scheme'
    return ()

-- method WebContext::set_additional_plugins_directory
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_additional_plugins_directory" webkit_web_context_set_additional_plugins_directory :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- directory : TBasicType TUTF8
    IO ()


webContextSetAdditionalPluginsDirectory ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- directory
    m ()
webContextSetAdditionalPluginsDirectory _obj directory = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    directory' <- textToCString directory
    webkit_web_context_set_additional_plugins_directory _obj' directory'
    touchManagedPtr _obj
    freeMem directory'
    return ()

-- method WebContext::set_cache_model
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cache_model", argType = TInterface "WebKit2" "CacheModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cache_model", argType = TInterface "WebKit2" "CacheModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_cache_model" webkit_web_context_set_cache_model :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CUInt ->                                -- cache_model : TInterface "WebKit2" "CacheModel"
    IO ()


webContextSetCacheModel ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    CacheModel ->                           -- cache_model
    m ()
webContextSetCacheModel _obj cache_model = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cache_model' = (fromIntegral . fromEnum) cache_model
    webkit_web_context_set_cache_model _obj' cache_model'
    touchManagedPtr _obj
    return ()

-- method WebContext::set_disk_cache_directory
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_disk_cache_directory" webkit_web_context_set_disk_cache_directory :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- directory : TBasicType TUTF8
    IO ()

{-# DEPRECATED webContextSetDiskCacheDirectory ["(Since version 2.10.)","Use webkit_web_context_new_with_website_data_manager() instead."]#-}
webContextSetDiskCacheDirectory ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- directory
    m ()
webContextSetDiskCacheDirectory _obj directory = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    directory' <- textToCString directory
    webkit_web_context_set_disk_cache_directory _obj' directory'
    touchManagedPtr _obj
    freeMem directory'
    return ()

-- method WebContext::set_favicon_database_directory
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_favicon_database_directory" webkit_web_context_set_favicon_database_directory :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- path : TBasicType TUTF8
    IO ()


webContextSetFaviconDatabaseDirectory ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- path
    m ()
webContextSetFaviconDatabaseDirectory _obj path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybePath <- case path of
        Nothing -> return nullPtr
        Just jPath -> do
            jPath' <- textToCString jPath
            return jPath'
    webkit_web_context_set_favicon_database_directory _obj' maybePath
    touchManagedPtr _obj
    freeMem maybePath
    return ()

-- method WebContext::set_preferred_languages
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "languages", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "languages", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_preferred_languages" webkit_web_context_set_preferred_languages :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Ptr CString ->                          -- languages : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO ()


webContextSetPreferredLanguages ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    Maybe ([T.Text]) ->                     -- languages
    m ()
webContextSetPreferredLanguages _obj languages = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeLanguages <- case languages of
        Nothing -> return nullPtr
        Just jLanguages -> do
            jLanguages' <- packZeroTerminatedUTF8CArray jLanguages
            return jLanguages'
    webkit_web_context_set_preferred_languages _obj' maybeLanguages
    touchManagedPtr _obj
    mapZeroTerminatedCArray freeMem maybeLanguages
    freeMem maybeLanguages
    return ()

-- method WebContext::set_process_model
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "process_model", argType = TInterface "WebKit2" "ProcessModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "process_model", argType = TInterface "WebKit2" "ProcessModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_process_model" webkit_web_context_set_process_model :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CUInt ->                                -- process_model : TInterface "WebKit2" "ProcessModel"
    IO ()


webContextSetProcessModel ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    ProcessModel ->                         -- process_model
    m ()
webContextSetProcessModel _obj process_model = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let process_model' = (fromIntegral . fromEnum) process_model
    webkit_web_context_set_process_model _obj' process_model'
    touchManagedPtr _obj
    return ()

-- method WebContext::set_spell_checking_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_spell_checking_enabled" webkit_web_context_set_spell_checking_enabled :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CInt ->                                 -- enabled : TBasicType TBoolean
    IO ()


webContextSetSpellCheckingEnabled ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- enabled
    m ()
webContextSetSpellCheckingEnabled _obj enabled = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let enabled' = (fromIntegral . fromEnum) enabled
    webkit_web_context_set_spell_checking_enabled _obj' enabled'
    touchManagedPtr _obj
    return ()

-- method WebContext::set_spell_checking_languages
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "languages", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "languages", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_spell_checking_languages" webkit_web_context_set_spell_checking_languages :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Ptr CString ->                          -- languages : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO ()


webContextSetSpellCheckingLanguages ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    [T.Text] ->                             -- languages
    m ()
webContextSetSpellCheckingLanguages _obj languages = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    languages' <- packZeroTerminatedUTF8CArray languages
    webkit_web_context_set_spell_checking_languages _obj' languages'
    touchManagedPtr _obj
    mapZeroTerminatedCArray freeMem languages'
    freeMem languages'
    return ()

-- method WebContext::set_tls_errors_policy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "policy", argType = TInterface "WebKit2" "TLSErrorsPolicy", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "policy", argType = TInterface "WebKit2" "TLSErrorsPolicy", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_tls_errors_policy" webkit_web_context_set_tls_errors_policy :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CUInt ->                                -- policy : TInterface "WebKit2" "TLSErrorsPolicy"
    IO ()


webContextSetTlsErrorsPolicy ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    TLSErrorsPolicy ->                      -- policy
    m ()
webContextSetTlsErrorsPolicy _obj policy = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let policy' = (fromIntegral . fromEnum) policy
    webkit_web_context_set_tls_errors_policy _obj' policy'
    touchManagedPtr _obj
    return ()

-- method WebContext::set_web_extensions_directory
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "directory", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_web_extensions_directory" webkit_web_context_set_web_extensions_directory :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    CString ->                              -- directory : TBasicType TUTF8
    IO ()


webContextSetWebExtensionsDirectory ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- directory
    m ()
webContextSetWebExtensionsDirectory _obj directory = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    directory' <- textToCString directory
    webkit_web_context_set_web_extensions_directory _obj' directory'
    touchManagedPtr _obj
    freeMem directory'
    return ()

-- method WebContext::set_web_extensions_initialization_user_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_web_extensions_initialization_user_data" webkit_web_context_set_web_extensions_initialization_user_data :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Ptr GVariant ->                         -- user_data : TVariant
    IO ()


webContextSetWebExtensionsInitializationUserData ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    GVariant ->                             -- user_data
    m ()
webContextSetWebExtensionsInitializationUserData _obj user_data = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let user_data' = unsafeManagedPtrGetPtr user_data
    webkit_web_context_set_web_extensions_initialization_user_data _obj' user_data'
    touchManagedPtr _obj
    return ()

-- method WebContext::set_web_process_count_limit
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "limit", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "WebContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "limit", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_set_web_process_count_limit" webkit_web_context_set_web_process_count_limit :: 
    Ptr WebContext ->                       -- _obj : TInterface "WebKit2" "WebContext"
    Word32 ->                               -- limit : TBasicType TUInt32
    IO ()


webContextSetWebProcessCountLimit ::
    (MonadIO m, WebContextK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- limit
    m ()
webContextSetWebProcessCountLimit _obj limit = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    webkit_web_context_set_web_process_count_limit _obj' limit
    touchManagedPtr _obj
    return ()

-- method WebContext::get_default
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "WebKit2" "WebContext"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_context_get_default" webkit_web_context_get_default :: 
    IO (Ptr WebContext)


webContextGetDefault ::
    (MonadIO m) =>
    m WebContext
webContextGetDefault  = liftIO $ do
    result <- webkit_web_context_get_default
    checkUnexpectedReturnNULL "webkit_web_context_get_default" result
    result' <- (newObject WebContext) result
    return result'