{- |
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.WebKit.Functions
    ( 

 -- * Methods
-- ** applicationCacheGetDatabaseDirectoryPath #method:applicationCacheGetDatabaseDirectoryPath#
    applicationCacheGetDatabaseDirectoryPath,


-- ** contextMenuItemGetAction #method:contextMenuItemGetAction#
    contextMenuItemGetAction                ,


-- ** geolocationPolicyAllow #method:geolocationPolicyAllow#
    geolocationPolicyAllow                  ,


-- ** geolocationPolicyDeny #method:geolocationPolicyDeny#
    geolocationPolicyDeny                   ,


-- ** getCacheModel #method:getCacheModel#
    getCacheModel                           ,


-- ** getDefaultSession #method:getDefaultSession#
    getDefaultSession                       ,


-- ** getDefaultWebDatabaseQuota #method:getDefaultWebDatabaseQuota#
    getDefaultWebDatabaseQuota              ,


-- ** getFaviconDatabase #method:getFaviconDatabase#
    getFaviconDatabase                      ,


-- ** getIconDatabase #method:getIconDatabase#
    getIconDatabase                         ,


-- ** getSecurityPolicyForUriScheme #method:getSecurityPolicyForUriScheme#
    getSecurityPolicyForUriScheme           ,


-- ** getTextChecker #method:getTextChecker#
    getTextChecker                          ,


-- ** getWebDatabaseDirectoryPath #method:getWebDatabaseDirectoryPath#
    getWebDatabaseDirectoryPath             ,


-- ** getWebPluginDatabase #method:getWebPluginDatabase#
    getWebPluginDatabase                    ,


-- ** majorVersion #method:majorVersion#
    majorVersion                            ,


-- ** microVersion #method:microVersion#
    microVersion                            ,


-- ** minorVersion #method:minorVersion#
    minorVersion                            ,


-- ** removeAllWebDatabases #method:removeAllWebDatabases#
    removeAllWebDatabases                   ,


-- ** setCacheModel #method:setCacheModel#
    setCacheModel                           ,


-- ** setDefaultWebDatabaseQuota #method:setDefaultWebDatabaseQuota#
    setDefaultWebDatabaseQuota              ,


-- ** setSecurityPolicyForUriScheme #method:setSecurityPolicyForUriScheme#
    setSecurityPolicyForUriScheme           ,


-- ** setTextChecker #method:setTextChecker#
    setTextChecker                          ,


-- ** setWebDatabaseDirectoryPath #method:setWebDatabaseDirectoryPath#
    setWebDatabaseDirectoryPath             ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Objects.MenuItem as Gtk.MenuItem
import qualified GI.Soup.Objects.Session as Soup.Session
import {-# SOURCE #-} qualified GI.WebKit.Enums as WebKit.Enums
import {-# SOURCE #-} qualified GI.WebKit.Flags as WebKit.Flags
import {-# SOURCE #-} qualified GI.WebKit.Objects.FaviconDatabase as WebKit.FaviconDatabase
import {-# SOURCE #-} qualified GI.WebKit.Objects.GeolocationPolicyDecision as WebKit.GeolocationPolicyDecision
import {-# SOURCE #-} qualified GI.WebKit.Objects.IconDatabase as WebKit.IconDatabase
import {-# SOURCE #-} qualified GI.WebKit.Objects.WebPluginDatabase as WebKit.WebPluginDatabase

-- function webkit_set_web_database_directory_path
-- Args : [Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new database directory path in the filesystem encoding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_set_web_database_directory_path" webkit_set_web_database_directory_path :: 
    CString ->                              -- path : TBasicType TUTF8
    IO ()

{- |
Sets the current path to the directory WebKit will write Web
Database and Indexed Database databases.

@since 1.1.14
-}
setWebDatabaseDirectoryPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@path@/: the new database directory path in the filesystem encoding -}
    -> m ()
setWebDatabaseDirectoryPath path = liftIO $ do
    path' <- textToCString path
    webkit_set_web_database_directory_path path'
    freeMem path'
    return ()


-- function webkit_set_text_checker
-- Args : [Arg {argCName = "checker", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitSpellChecker or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_set_text_checker" webkit_set_text_checker :: 
    Ptr GObject.Object.Object ->            -- checker : TInterface (Name {namespace = "GObject", name = "Object"})
    IO ()

{- |
Sets /@checker@/ as the spell checker to be used by WebKit. The API
accepts GObject since in the future we might accept objects
implementing multiple interfaces (for example, spell checking and
grammar checking).

@since 1.5.1
-}
setTextChecker ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    a
    {- ^ /@checker@/: a 'GI.WebKit.Interfaces.SpellChecker.SpellChecker' or 'Nothing' -}
    -> m ()
setTextChecker checker = liftIO $ do
    checker' <- unsafeManagedPtrCastPtr checker
    webkit_set_text_checker checker'
    touchManagedPtr checker
    return ()


-- function webkit_set_security_policy_for_uri_scheme
-- Args : [Arg {argCName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a URI scheme", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "policy", argType = TInterface (Name {namespace = "WebKit", name = "SecurityPolicy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitSecurityPolicy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_set_security_policy_for_uri_scheme" webkit_set_security_policy_for_uri_scheme :: 
    CString ->                              -- scheme : TBasicType TUTF8
    CUInt ->                                -- policy : TInterface (Name {namespace = "WebKit", name = "SecurityPolicy"})
    IO ()

{- |
Set the security policy for the given URI scheme.

@since 2.0
-}
setSecurityPolicyForUriScheme ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@scheme@/: a URI scheme -}
    -> [WebKit.Flags.SecurityPolicy]
    {- ^ /@policy@/: a 'GI.WebKit.Flags.SecurityPolicy' -}
    -> m ()
setSecurityPolicyForUriScheme scheme policy = liftIO $ do
    scheme' <- textToCString scheme
    let policy' = gflagsToWord policy
    webkit_set_security_policy_for_uri_scheme scheme' policy'
    freeMem scheme'
    return ()


-- function webkit_set_default_web_database_quota
-- Args : [Arg {argCName = "defaultQuota", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new default database quota", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_set_default_web_database_quota" webkit_set_default_web_database_quota :: 
    Word64 ->                               -- defaultQuota : TBasicType TUInt64
    IO ()

{- |
Sets the default quota for Web Database databases.

@since 1.1.14
-}
setDefaultWebDatabaseQuota ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@defaultQuota@/: the new default database quota -}
    -> m ()
setDefaultWebDatabaseQuota defaultQuota = liftIO $ do
    webkit_set_default_web_database_quota defaultQuota
    return ()


-- function webkit_set_cache_model
-- Args : [Arg {argCName = "cache_model", argType = TInterface (Name {namespace = "WebKit", name = "CacheModel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitCacheModel", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_set_cache_model" webkit_set_cache_model :: 
    CUInt ->                                -- cache_model : TInterface (Name {namespace = "WebKit", name = "CacheModel"})
    IO ()

{- |
Specifies a usage model for WebViews, which WebKit will use to
determine its caching behavior. All web views follow the cache
model. This cache model determines the RAM and disk space to use
for caching previously viewed content .

Research indicates that users tend to browse within clusters of
documents that hold resources in common, and to revisit previously
visited documents. WebKit and the frameworks below it include
built-in caches that take advantage of these patterns,
substantially improving document load speed in browsing
situations. The WebKit cache model controls the behaviors of all of
these caches, including various WebCore caches.

Browsers can improve document load speed substantially by
specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a
browsing interface can reduce memory usage substantially by
specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. Default value is
WEBKIT_CACHE_MODEL_WEB_BROWSER.

@since 1.1.18
-}
setCacheModel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebKit.Enums.CacheModel
    {- ^ /@cacheModel@/: a 'GI.WebKit.Enums.CacheModel' -}
    -> m ()
setCacheModel cacheModel = liftIO $ do
    let cacheModel' = (fromIntegral . fromEnum) cacheModel
    webkit_set_cache_model cacheModel'
    return ()


-- function webkit_remove_all_web_databases
-- Args : []
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_remove_all_web_databases" webkit_remove_all_web_databases :: 
    IO ()

{- |
Removes all web databases from the current database directory path.

@since 1.1.14
-}
removeAllWebDatabases ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
removeAllWebDatabases  = liftIO $ do
    webkit_remove_all_web_databases
    return ()


-- function webkit_minor_version
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_minor_version" webkit_minor_version :: 
    IO Word32

{- |
The minor version number of the WebKit that is linked against.

@since 1.0.1
-}
minorVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    {- ^ __Returns:__ The minor version -}
minorVersion  = liftIO $ do
    result <- webkit_minor_version
    return result


-- function webkit_micro_version
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_micro_version" webkit_micro_version :: 
    IO Word32

{- |
The micro version number of the WebKit that is linked against.

@since 1.0.1
-}
microVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    {- ^ __Returns:__ The micro version -}
microVersion  = liftIO $ do
    result <- webkit_micro_version
    return result


-- function webkit_major_version
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_major_version" webkit_major_version :: 
    IO Word32

{- |
The major version number of the WebKit that is linked against.

@since 1.0.1
-}
majorVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    {- ^ __Returns:__ The major version -}
majorVersion  = liftIO $ do
    result <- webkit_major_version
    return result


-- function webkit_get_web_plugin_database
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "WebPluginDatabase"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_web_plugin_database" webkit_get_web_plugin_database :: 
    IO (Ptr WebKit.WebPluginDatabase.WebPluginDatabase)

{- |
Returns the current 'GI.WebKit.Objects.WebPluginDatabase.WebPluginDatabase' with information about
all the plugins WebKit knows about in this instance.

@since 1.3.8
-}
getWebPluginDatabase ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m WebKit.WebPluginDatabase.WebPluginDatabase
    {- ^ __Returns:__ the current 'GI.WebKit.Objects.WebPluginDatabase.WebPluginDatabase' -}
getWebPluginDatabase  = liftIO $ do
    result <- webkit_get_web_plugin_database
    checkUnexpectedReturnNULL "getWebPluginDatabase" result
    result' <- (newObject WebKit.WebPluginDatabase.WebPluginDatabase) result
    return result'


-- function webkit_get_web_database_directory_path
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_web_database_directory_path" webkit_get_web_database_directory_path :: 
    IO CString

{- |
Returns the current path to the directory WebKit will write Web
Database and Indexed Database databases. By default this path will
be in the user data directory.

@since 1.1.14
-}
getWebDatabaseDirectoryPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    {- ^ __Returns:__ the current database directory path in the filesystem encoding -}
getWebDatabaseDirectoryPath  = liftIO $ do
    result <- webkit_get_web_database_directory_path
    checkUnexpectedReturnNULL "getWebDatabaseDirectoryPath" result
    result' <- cstringToText result
    return result'


-- function webkit_get_text_checker
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Object"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_text_checker" webkit_get_text_checker :: 
    IO (Ptr GObject.Object.Object)

{- |
/No description available in the introspection data./

@since 1.5.1
-}
getTextChecker ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GObject.Object.Object
    {- ^ __Returns:__ the 'GI.WebKit.Interfaces.SpellChecker.SpellChecker' used by WebKit, or 'Nothing' if spell
checking is not enabled -}
getTextChecker  = liftIO $ do
    result <- webkit_get_text_checker
    checkUnexpectedReturnNULL "getTextChecker" result
    result' <- (newObject GObject.Object.Object) result
    return result'


-- function webkit_get_security_policy_for_uri_scheme
-- Args : [Arg {argCName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a URI scheme", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "SecurityPolicy"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_security_policy_for_uri_scheme" webkit_get_security_policy_for_uri_scheme :: 
    CString ->                              -- scheme : TBasicType TUTF8
    IO CUInt

{- |
Get the security policy for the given URI scheme.

@since 2.0
-}
getSecurityPolicyForUriScheme ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@scheme@/: a URI scheme -}
    -> m [WebKit.Flags.SecurityPolicy]
    {- ^ __Returns:__ a 'GI.WebKit.Flags.SecurityPolicy' -}
getSecurityPolicyForUriScheme scheme = liftIO $ do
    scheme' <- textToCString scheme
    result <- webkit_get_security_policy_for_uri_scheme scheme'
    let result' = wordToGFlags result
    freeMem scheme'
    return result'


-- function webkit_get_icon_database
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "IconDatabase"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_icon_database" webkit_get_icon_database :: 
    IO (Ptr WebKit.IconDatabase.IconDatabase)

{-# DEPRECATED getIconDatabase ["(Since version 1.8)","Use 'GI.WebKit.Functions.getFaviconDatabase' instead"] #-}
{- |
Returns the 'GI.WebKit.Objects.IconDatabase.IconDatabase' providing access to website icons.

@since 1.3.13
-}
getIconDatabase ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m WebKit.IconDatabase.IconDatabase
    {- ^ __Returns:__ the current 'GI.WebKit.Objects.IconDatabase.IconDatabase' -}
getIconDatabase  = liftIO $ do
    result <- webkit_get_icon_database
    checkUnexpectedReturnNULL "getIconDatabase" result
    result' <- (newObject WebKit.IconDatabase.IconDatabase) result
    return result'


-- function webkit_get_favicon_database
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "FaviconDatabase"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_favicon_database" webkit_get_favicon_database :: 
    IO (Ptr WebKit.FaviconDatabase.FaviconDatabase)

{- |
Returns the 'GI.WebKit.Objects.FaviconDatabase.FaviconDatabase' providing access to website
icons.

@since 1.8
-}
getFaviconDatabase ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m WebKit.FaviconDatabase.FaviconDatabase
    {- ^ __Returns:__ the current 'GI.WebKit.Objects.FaviconDatabase.FaviconDatabase' -}
getFaviconDatabase  = liftIO $ do
    result <- webkit_get_favicon_database
    checkUnexpectedReturnNULL "getFaviconDatabase" result
    result' <- (newObject WebKit.FaviconDatabase.FaviconDatabase) result
    return result'


-- function webkit_get_default_web_database_quota
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_default_web_database_quota" webkit_get_default_web_database_quota :: 
    IO Word64

{- |
Returns the default quota for Web Database databases. By default
this value is 5MB.

@since 1.1.14
-}
getDefaultWebDatabaseQuota ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word64
    {- ^ __Returns:__ the current default database quota in bytes -}
getDefaultWebDatabaseQuota  = liftIO $ do
    result <- webkit_get_default_web_database_quota
    return result


-- function webkit_get_default_session
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Session"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_default_session" webkit_get_default_session :: 
    IO (Ptr Soup.Session.Session)

{- |
Retrieves the default 'GI.Soup.Objects.Session.Session' used by all web views.
Note that the session features are added by WebKit on demand,
so if you insert your own 'GI.Soup.Objects.CookieJar.CookieJar' before any network
traffic occurs, WebKit will use it instead of the default.

@since 1.1.1
-}
getDefaultSession ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Soup.Session.Session
    {- ^ __Returns:__ the default 'GI.Soup.Objects.Session.Session' -}
getDefaultSession  = liftIO $ do
    result <- webkit_get_default_session
    checkUnexpectedReturnNULL "getDefaultSession" result
    result' <- (newObject Soup.Session.Session) result
    return result'


-- function webkit_get_cache_model
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "CacheModel"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_get_cache_model" webkit_get_cache_model :: 
    IO CUInt

{- |
Returns the current cache model. For more information about this
value check the documentation of the function
'GI.WebKit.Functions.setCacheModel'.

@since 1.1.18
-}
getCacheModel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m WebKit.Enums.CacheModel
    {- ^ __Returns:__ the current 'GI.WebKit.Enums.CacheModel' -}
getCacheModel  = liftIO $ do
    result <- webkit_get_cache_model
    let result' = (toEnum . fromIntegral) result
    return result'


-- function webkit_geolocation_policy_deny
-- Args : [Arg {argCName = "decision", argType = TInterface (Name {namespace = "WebKit", name = "GeolocationPolicyDecision"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitGeolocationPolicyDecision", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_geolocation_policy_deny" webkit_geolocation_policy_deny :: 
    Ptr WebKit.GeolocationPolicyDecision.GeolocationPolicyDecision -> -- decision : TInterface (Name {namespace = "WebKit", name = "GeolocationPolicyDecision"})
    IO ()

{- |
Will send the deny decision to the policy implementer.

@since 1.1.23
-}
geolocationPolicyDeny ::
    (B.CallStack.HasCallStack, MonadIO m, WebKit.GeolocationPolicyDecision.IsGeolocationPolicyDecision a) =>
    a
    {- ^ /@decision@/: a 'GI.WebKit.Objects.GeolocationPolicyDecision.GeolocationPolicyDecision' -}
    -> m ()
geolocationPolicyDeny decision = liftIO $ do
    decision' <- unsafeManagedPtrCastPtr decision
    webkit_geolocation_policy_deny decision'
    touchManagedPtr decision
    return ()


-- function webkit_geolocation_policy_allow
-- Args : [Arg {argCName = "decision", argType = TInterface (Name {namespace = "WebKit", name = "GeolocationPolicyDecision"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitGeolocationPolicyDecision", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_geolocation_policy_allow" webkit_geolocation_policy_allow :: 
    Ptr WebKit.GeolocationPolicyDecision.GeolocationPolicyDecision -> -- decision : TInterface (Name {namespace = "WebKit", name = "GeolocationPolicyDecision"})
    IO ()

{- |
Will send the allow decision to the policy implementer.

@since 1.1.23
-}
geolocationPolicyAllow ::
    (B.CallStack.HasCallStack, MonadIO m, WebKit.GeolocationPolicyDecision.IsGeolocationPolicyDecision a) =>
    a
    {- ^ /@decision@/: a 'GI.WebKit.Objects.GeolocationPolicyDecision.GeolocationPolicyDecision' -}
    -> m ()
geolocationPolicyAllow decision = liftIO $ do
    decision' <- unsafeManagedPtrCastPtr decision
    webkit_geolocation_policy_allow decision'
    touchManagedPtr decision
    return ()


-- function webkit_context_menu_item_get_action
-- Args : [Arg {argCName = "item", argType = TInterface (Name {namespace = "Gtk", name = "MenuItem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkMenuItem of the default context menu", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "ContextMenuAction"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_context_menu_item_get_action" webkit_context_menu_item_get_action :: 
    Ptr Gtk.MenuItem.MenuItem ->            -- item : TInterface (Name {namespace = "Gtk", name = "MenuItem"})
    IO CUInt

{- |
Returns the 'GI.WebKit.Enums.ContextMenuAction' of the given /@item@/. This function
can be used to determine the items present in the default context menu.
In order to inspect the default context menu, you should connect to
'GI.WebKit.Objects.WebView.WebView'::@/context-menu/@ signal.

\<example>
\<title>Inspecting the default context menu\<\/title>
\<programlisting>
static gboolean context_menu_cb (WebKitWebView       *webView,
                                 GtkWidget           *default_menu,
                                 WebKitHitTestResult *hit_test_result,
                                 gboolean             triggered_with_keyboard,
                                 gpointer             user_data)
{
    GList *items = gtk_container_get_children (GTK_CONTAINER (default_menu));
    GList *l;
    GtkAction *action;
    GtkWidget *sub_menu;

    for (l = items; l; l = g_list_next (l)) {
        GtkMenuItem *item = (GtkMenuItem *)l->data;

        if (GTK_IS_SEPARATOR_MENU_ITEM (item)) {
            \/&ast; It\'s  separator, do nothing &ast;\/
            continue;
        }

        switch (webkit_context_menu_item_get_action (item)) {
        case WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION:
            \/&ast; No action for this item &ast;\/
            break;
        \/&ast; Don\'t allow to ope links from context menu &ast;\/
        case WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK:
        case WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW:
            action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (item));
            gtk_action_set_sensitive (action, FALSE);
            break;
        default:
            break;
        }

        sub_menu = gtk_menu_item_get_submenu (item);
        if (sub_menu) {
            GtkWidget *menu_item;

            \/&ast; Add custom action to submenu &ast;\/
            action = gtk_action_new (\"CustomItemName\", \"Custom Action\", NULL, NULL);
            g_signal_connect (action, \"activate\", G_CALLBACK (custom_menu_item_activated), NULL);

            menu_item = gtk_action_create_menu_item (action);
            g_object_unref (action);
            gtk_menu_shell_append (GTK_MENU_SHELL (sub_menu), menu_item);
            gtk_widget_show (menu_item);
        }
    }

    g_list_free(items);
}
\<\/programlisting>
\<\/example>

Note that you can get the 'GI.Gtk.Objects.Action.Action' of any item in the default context menu with
'GI.Gtk.Interfaces.Activatable.activatableGetRelatedAction'.

@since 1.10
-}
contextMenuItemGetAction ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.MenuItem.IsMenuItem a) =>
    a
    {- ^ /@item@/: a 'GI.Gtk.Objects.MenuItem.MenuItem' of the default context menu -}
    -> m WebKit.Enums.ContextMenuAction
    {- ^ __Returns:__ the 'GI.WebKit.Enums.ContextMenuAction' of the given /@item@/ -}
contextMenuItemGetAction item = liftIO $ do
    item' <- unsafeManagedPtrCastPtr item
    result <- webkit_context_menu_item_get_action item'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr item
    return result'


-- function webkit_application_cache_get_database_directory_path
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_cache_get_database_directory_path" webkit_application_cache_get_database_directory_path :: 
    IO CString

{- |
Returns the path to the directory WebKit will write web application
cache databases to. By default this path is set to
$XDG_CACHE_HOME\/webkitgtk\/applications and cannot be modified.

@since 1.3.13
-}
applicationCacheGetDatabaseDirectoryPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    {- ^ __Returns:__ the application cache database directory path -}
applicationCacheGetDatabaseDirectoryPath  = liftIO $ do
    result <- webkit_application_cache_get_database_directory_path
    checkUnexpectedReturnNULL "applicationCacheGetDatabaseDirectoryPath" result
    result' <- cstringToText result
    return result'