module GI.WebKit2.Objects.AuthenticationRequest
(
AuthenticationRequest(..) ,
AuthenticationRequestK ,
toAuthenticationRequest ,
noAuthenticationRequest ,
authenticationRequestAuthenticate ,
authenticationRequestCanSaveCredentials ,
authenticationRequestCancel ,
authenticationRequestGetHost ,
authenticationRequestGetPort ,
authenticationRequestGetProposedCredential,
authenticationRequestGetRealm ,
authenticationRequestGetScheme ,
authenticationRequestIsForProxy ,
authenticationRequestIsRetry ,
AuthenticationRequestCancelledCallback ,
AuthenticationRequestCancelledCallbackC ,
AuthenticationRequestCancelledSignalInfo,
afterAuthenticationRequestCancelled ,
authenticationRequestCancelledCallbackWrapper,
authenticationRequestCancelledClosure ,
mkAuthenticationRequestCancelledCallback,
noAuthenticationRequestCancelledCallback,
onAuthenticationRequestCancelled ,
) 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.GObject as GObject
newtype AuthenticationRequest = AuthenticationRequest (ForeignPtr AuthenticationRequest)
foreign import ccall "webkit_authentication_request_get_type"
c_webkit_authentication_request_get_type :: IO GType
type instance ParentTypes AuthenticationRequest = AuthenticationRequestParentTypes
type AuthenticationRequestParentTypes = '[GObject.Object]
instance GObject AuthenticationRequest where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_authentication_request_get_type
class GObject o => AuthenticationRequestK o
instance (GObject o, IsDescendantOf AuthenticationRequest o) => AuthenticationRequestK o
toAuthenticationRequest :: AuthenticationRequestK o => o -> IO AuthenticationRequest
toAuthenticationRequest = unsafeCastTo AuthenticationRequest
noAuthenticationRequest :: Maybe AuthenticationRequest
noAuthenticationRequest = Nothing
type AuthenticationRequestCancelledCallback =
IO ()
noAuthenticationRequestCancelledCallback :: Maybe AuthenticationRequestCancelledCallback
noAuthenticationRequestCancelledCallback = Nothing
type AuthenticationRequestCancelledCallbackC =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkAuthenticationRequestCancelledCallback :: AuthenticationRequestCancelledCallbackC -> IO (FunPtr AuthenticationRequestCancelledCallbackC)
authenticationRequestCancelledClosure :: AuthenticationRequestCancelledCallback -> IO Closure
authenticationRequestCancelledClosure cb = newCClosure =<< mkAuthenticationRequestCancelledCallback wrapped
where wrapped = authenticationRequestCancelledCallbackWrapper cb
authenticationRequestCancelledCallbackWrapper ::
AuthenticationRequestCancelledCallback ->
Ptr () ->
Ptr () ->
IO ()
authenticationRequestCancelledCallbackWrapper _cb _ _ = do
_cb
onAuthenticationRequestCancelled :: (GObject a, MonadIO m) => a -> AuthenticationRequestCancelledCallback -> m SignalHandlerId
onAuthenticationRequestCancelled obj cb = liftIO $ connectAuthenticationRequestCancelled obj cb SignalConnectBefore
afterAuthenticationRequestCancelled :: (GObject a, MonadIO m) => a -> AuthenticationRequestCancelledCallback -> m SignalHandlerId
afterAuthenticationRequestCancelled obj cb = connectAuthenticationRequestCancelled obj cb SignalConnectAfter
connectAuthenticationRequestCancelled :: (GObject a, MonadIO m) =>
a -> AuthenticationRequestCancelledCallback -> SignalConnectMode -> m SignalHandlerId
connectAuthenticationRequestCancelled obj cb after = liftIO $ do
cb' <- mkAuthenticationRequestCancelledCallback (authenticationRequestCancelledCallbackWrapper cb)
connectSignalFunPtr obj "cancelled" cb' after
type instance AttributeList AuthenticationRequest = AuthenticationRequestAttributeList
type AuthenticationRequestAttributeList = ('[ ] :: [(Symbol, *)])
data AuthenticationRequestCancelledSignalInfo
instance SignalInfo AuthenticationRequestCancelledSignalInfo where
type HaskellCallbackType AuthenticationRequestCancelledSignalInfo = AuthenticationRequestCancelledCallback
connectSignal _ = connectAuthenticationRequestCancelled
type instance SignalList AuthenticationRequest = AuthenticationRequestSignalList
type AuthenticationRequestSignalList = ('[ '("cancelled", AuthenticationRequestCancelledSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_authentication_request_authenticate" webkit_authentication_request_authenticate ::
Ptr AuthenticationRequest ->
Ptr Credential ->
IO ()
authenticationRequestAuthenticate ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
Maybe (Credential) ->
m ()
authenticationRequestAuthenticate _obj credential = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeCredential <- case credential of
Nothing -> return nullPtr
Just jCredential -> do
let jCredential' = unsafeManagedPtrGetPtr jCredential
return jCredential'
webkit_authentication_request_authenticate _obj' maybeCredential
touchManagedPtr _obj
whenJust credential touchManagedPtr
return ()
foreign import ccall "webkit_authentication_request_can_save_credentials" webkit_authentication_request_can_save_credentials ::
Ptr AuthenticationRequest ->
IO CInt
authenticationRequestCanSaveCredentials ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m Bool
authenticationRequestCanSaveCredentials _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_can_save_credentials _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_authentication_request_cancel" webkit_authentication_request_cancel ::
Ptr AuthenticationRequest ->
IO ()
authenticationRequestCancel ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m ()
authenticationRequestCancel _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
webkit_authentication_request_cancel _obj'
touchManagedPtr _obj
return ()
foreign import ccall "webkit_authentication_request_get_host" webkit_authentication_request_get_host ::
Ptr AuthenticationRequest ->
IO CString
authenticationRequestGetHost ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m T.Text
authenticationRequestGetHost _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_host _obj'
checkUnexpectedReturnNULL "webkit_authentication_request_get_host" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_authentication_request_get_port" webkit_authentication_request_get_port ::
Ptr AuthenticationRequest ->
IO Word32
authenticationRequestGetPort ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m Word32
authenticationRequestGetPort _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_port _obj'
touchManagedPtr _obj
return result
foreign import ccall "webkit_authentication_request_get_proposed_credential" webkit_authentication_request_get_proposed_credential ::
Ptr AuthenticationRequest ->
IO (Ptr Credential)
authenticationRequestGetProposedCredential ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m Credential
authenticationRequestGetProposedCredential _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_proposed_credential _obj'
checkUnexpectedReturnNULL "webkit_authentication_request_get_proposed_credential" result
result' <- (wrapBoxed Credential) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_authentication_request_get_realm" webkit_authentication_request_get_realm ::
Ptr AuthenticationRequest ->
IO CString
authenticationRequestGetRealm ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m T.Text
authenticationRequestGetRealm _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_realm _obj'
checkUnexpectedReturnNULL "webkit_authentication_request_get_realm" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_authentication_request_get_scheme" webkit_authentication_request_get_scheme ::
Ptr AuthenticationRequest ->
IO CUInt
authenticationRequestGetScheme ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m AuthenticationScheme
authenticationRequestGetScheme _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_scheme _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_authentication_request_is_for_proxy" webkit_authentication_request_is_for_proxy ::
Ptr AuthenticationRequest ->
IO CInt
authenticationRequestIsForProxy ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m Bool
authenticationRequestIsForProxy _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_is_for_proxy _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_authentication_request_is_retry" webkit_authentication_request_is_retry ::
Ptr AuthenticationRequest ->
IO CInt
authenticationRequestIsRetry ::
(MonadIO m, AuthenticationRequestK a) =>
a ->
m Bool
authenticationRequestIsRetry _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_is_retry _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'