gi-webkit2webextension-0.2.8.12: GI/WebKit2WebExtension/Objects/Frame.hs
{- |
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.WebKit2WebExtension.Objects.Frame
(
-- * Exported types
Frame(..) ,
FrameK ,
toFrame ,
noFrame ,
-- * Methods
-- ** frameGetJavascriptContextForScriptWorld
frameGetJavascriptContextForScriptWorld ,
-- ** frameGetJavascriptGlobalContext
frameGetJavascriptGlobalContext ,
-- ** frameGetUri
frameGetUri ,
-- ** frameIsMainFrame
frameIsMainFrame ,
) 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.WebKit2WebExtension.Types
import GI.WebKit2WebExtension.Callbacks
import qualified GI.GObject as GObject
import qualified GI.JavaScriptCore as JavaScriptCore
newtype Frame = Frame (ForeignPtr Frame)
foreign import ccall "webkit_frame_get_type"
c_webkit_frame_get_type :: IO GType
type instance ParentTypes Frame = FrameParentTypes
type FrameParentTypes = '[GObject.Object]
instance GObject Frame where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_frame_get_type
class GObject o => FrameK o
instance (GObject o, IsDescendantOf Frame o) => FrameK o
toFrame :: FrameK o => o -> IO Frame
toFrame = unsafeCastTo Frame
noFrame :: Maybe Frame
noFrame = Nothing
type instance AttributeList Frame = FrameAttributeList
type FrameAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList Frame = FrameSignalList
type FrameSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method Frame::get_javascript_context_for_script_world
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "world", argType = TInterface "WebKit2WebExtension" "ScriptWorld", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "world", argType = TInterface "WebKit2WebExtension" "ScriptWorld", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "JavaScriptCore" "GlobalContext"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_javascript_context_for_script_world" webkit_frame_get_javascript_context_for_script_world ::
Ptr Frame -> -- _obj : TInterface "WebKit2WebExtension" "Frame"
Ptr ScriptWorld -> -- world : TInterface "WebKit2WebExtension" "ScriptWorld"
IO (Ptr JavaScriptCore.GlobalContext)
frameGetJavascriptContextForScriptWorld ::
(MonadIO m, FrameK a, ScriptWorldK b) =>
a -> -- _obj
b -> -- world
m JavaScriptCore.GlobalContext
frameGetJavascriptContextForScriptWorld _obj world = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let world' = unsafeManagedPtrCastPtr world
result <- webkit_frame_get_javascript_context_for_script_world _obj' world'
checkUnexpectedReturnNULL "webkit_frame_get_javascript_context_for_script_world" result
-- XXX Wrapping a foreign struct/union with no known destructor, leak?
result' <- (\x -> JavaScriptCore.GlobalContext <$> newForeignPtr_ x) result
touchManagedPtr _obj
touchManagedPtr world
return result'
-- method Frame::get_javascript_global_context
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "JavaScriptCore" "GlobalContext"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_javascript_global_context" webkit_frame_get_javascript_global_context ::
Ptr Frame -> -- _obj : TInterface "WebKit2WebExtension" "Frame"
IO (Ptr JavaScriptCore.GlobalContext)
frameGetJavascriptGlobalContext ::
(MonadIO m, FrameK a) =>
a -> -- _obj
m JavaScriptCore.GlobalContext
frameGetJavascriptGlobalContext _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_frame_get_javascript_global_context _obj'
checkUnexpectedReturnNULL "webkit_frame_get_javascript_global_context" result
-- XXX Wrapping a foreign struct/union with no known destructor, leak?
result' <- (\x -> JavaScriptCore.GlobalContext <$> newForeignPtr_ x) result
touchManagedPtr _obj
return result'
-- method Frame::get_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_uri" webkit_frame_get_uri ::
Ptr Frame -> -- _obj : TInterface "WebKit2WebExtension" "Frame"
IO CString
frameGetUri ::
(MonadIO m, FrameK a) =>
a -> -- _obj
m T.Text
frameGetUri _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_frame_get_uri _obj'
checkUnexpectedReturnNULL "webkit_frame_get_uri" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method Frame::is_main_frame
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "Frame", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_is_main_frame" webkit_frame_is_main_frame ::
Ptr Frame -> -- _obj : TInterface "WebKit2WebExtension" "Frame"
IO CInt
frameIsMainFrame ::
(MonadIO m, FrameK a) =>
a -> -- _obj
m Bool
frameIsMainFrame _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_frame_is_main_frame _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'