gi-webkit2webextension-4.0.19: 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 (inaki@blueleaf.cc)
/No description available in the introspection data./
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.WebKit2WebExtension.Objects.Frame
(
-- * Exported types
Frame(..) ,
IsFrame ,
toFrame ,
noFrame ,
-- * Methods
-- ** getJsContext #method:getJsContext#
#if ENABLE_OVERLOADING
FrameGetJsContextMethodInfo ,
#endif
frameGetJsContext ,
-- ** getJsContextForScriptWorld #method:getJsContextForScriptWorld#
#if ENABLE_OVERLOADING
FrameGetJsContextForScriptWorldMethodInfo,
#endif
frameGetJsContextForScriptWorld ,
-- ** getJsValueForDomObject #method:getJsValueForDomObject#
#if ENABLE_OVERLOADING
FrameGetJsValueForDomObjectMethodInfo ,
#endif
frameGetJsValueForDomObject ,
-- ** getJsValueForDomObjectInScriptWorld #method:getJsValueForDomObjectInScriptWorld#
#if ENABLE_OVERLOADING
FrameGetJsValueForDomObjectInScriptWorldMethodInfo,
#endif
frameGetJsValueForDomObjectInScriptWorld,
-- ** getUri #method:getUri#
#if ENABLE_OVERLOADING
FrameGetUriMethodInfo ,
#endif
frameGetUri ,
-- ** isMainFrame #method:isMainFrame#
#if ENABLE_OVERLOADING
FrameIsMainFrameMethodInfo ,
#endif
frameIsMainFrame ,
) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.JavaScriptCore.Objects.Context as JavaScriptCore.Context
import qualified GI.JavaScriptCore.Objects.Value as JavaScriptCore.Value
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.ScriptWorld as WebKit2WebExtension.ScriptWorld
-- | Memory-managed wrapper type.
newtype Frame = Frame (ManagedPtr Frame)
foreign import ccall "webkit_frame_get_type"
c_webkit_frame_get_type :: IO GType
instance GObject Frame where
gobjectType = c_webkit_frame_get_type
-- | Type class for types which can be safely cast to `Frame`, for instance with `toFrame`.
class (GObject o, O.IsDescendantOf Frame o) => IsFrame o
instance (GObject o, O.IsDescendantOf Frame o) => IsFrame o
instance O.HasParentTypes Frame
type instance O.ParentTypes Frame = '[GObject.Object.Object]
-- | Cast to `Frame`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toFrame :: (MonadIO m, IsFrame o) => o -> m Frame
toFrame = liftIO . unsafeCastTo Frame
-- | A convenience alias for `Nothing` :: `Maybe` `Frame`.
noFrame :: Maybe Frame
noFrame = Nothing
#if ENABLE_OVERLOADING
type family ResolveFrameMethod (t :: Symbol) (o :: *) :: * where
ResolveFrameMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFrameMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFrameMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFrameMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFrameMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFrameMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFrameMethod "isMainFrame" o = FrameIsMainFrameMethodInfo
ResolveFrameMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFrameMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFrameMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFrameMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFrameMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFrameMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFrameMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFrameMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFrameMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFrameMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFrameMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFrameMethod "getJsContext" o = FrameGetJsContextMethodInfo
ResolveFrameMethod "getJsContextForScriptWorld" o = FrameGetJsContextForScriptWorldMethodInfo
ResolveFrameMethod "getJsValueForDomObject" o = FrameGetJsValueForDomObjectMethodInfo
ResolveFrameMethod "getJsValueForDomObjectInScriptWorld" o = FrameGetJsValueForDomObjectInScriptWorldMethodInfo
ResolveFrameMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFrameMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFrameMethod "getUri" o = FrameGetUriMethodInfo
ResolveFrameMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFrameMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFrameMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFrameMethod t Frame, O.MethodInfo info Frame p) => OL.IsLabel t (Frame -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Frame
type instance O.AttributeList Frame = FrameAttributeList
type FrameAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Frame = FrameSignalList
type FrameSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method Frame::get_js_context
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "JavaScriptCore", name = "Context"}))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_js_context" webkit_frame_get_js_context ::
Ptr Frame -> -- frame : TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"})
IO (Ptr JavaScriptCore.Context.Context)
{- |
Get the JavaScript execution context of /@frame@/. Use this function to bridge
between the WebKit and JavaScriptCore APIs.
/Since: 2.22/
-}
frameGetJsContext ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a) =>
a
{- ^ /@frame@/: a 'GI.WebKit2WebExtension.Objects.Frame.Frame' -}
-> m JavaScriptCore.Context.Context
{- ^ __Returns:__ the 'GI.JavaScriptCore.Objects.Context.Context' for the JavaScript execution context of /@frame@/. -}
frameGetJsContext frame = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
result <- webkit_frame_get_js_context frame'
checkUnexpectedReturnNULL "frameGetJsContext" result
result' <- (wrapObject JavaScriptCore.Context.Context) result
touchManagedPtr frame
return result'
#if ENABLE_OVERLOADING
data FrameGetJsContextMethodInfo
instance (signature ~ (m JavaScriptCore.Context.Context), MonadIO m, IsFrame a) => O.MethodInfo FrameGetJsContextMethodInfo a signature where
overloadedMethod _ = frameGetJsContext
#endif
-- method Frame::get_js_context_for_script_world
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "world", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "ScriptWorld"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitScriptWorld", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "JavaScriptCore", name = "Context"}))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_js_context_for_script_world" webkit_frame_get_js_context_for_script_world ::
Ptr Frame -> -- frame : TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"})
Ptr WebKit2WebExtension.ScriptWorld.ScriptWorld -> -- world : TInterface (Name {namespace = "WebKit2WebExtension", name = "ScriptWorld"})
IO (Ptr JavaScriptCore.Context.Context)
{- |
Get the JavaScript execution context of /@frame@/ for the given 'GI.WebKit2WebExtension.Objects.ScriptWorld.ScriptWorld'.
/Since: 2.22/
-}
frameGetJsContextForScriptWorld ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a, WebKit2WebExtension.ScriptWorld.IsScriptWorld b) =>
a
{- ^ /@frame@/: a 'GI.WebKit2WebExtension.Objects.Frame.Frame' -}
-> b
{- ^ /@world@/: a 'GI.WebKit2WebExtension.Objects.ScriptWorld.ScriptWorld' -}
-> m JavaScriptCore.Context.Context
{- ^ __Returns:__ the 'GI.JavaScriptCore.Objects.Context.Context' for the JavaScript execution context of /@frame@/ for /@world@/. -}
frameGetJsContextForScriptWorld frame world = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
world' <- unsafeManagedPtrCastPtr world
result <- webkit_frame_get_js_context_for_script_world frame' world'
checkUnexpectedReturnNULL "frameGetJsContextForScriptWorld" result
result' <- (wrapObject JavaScriptCore.Context.Context) result
touchManagedPtr frame
touchManagedPtr world
return result'
#if ENABLE_OVERLOADING
data FrameGetJsContextForScriptWorldMethodInfo
instance (signature ~ (b -> m JavaScriptCore.Context.Context), MonadIO m, IsFrame a, WebKit2WebExtension.ScriptWorld.IsScriptWorld b) => O.MethodInfo FrameGetJsContextForScriptWorldMethodInfo a signature where
overloadedMethod _ = frameGetJsContextForScriptWorld
#endif
-- method Frame::get_js_value_for_dom_object
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dom_object", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitDOMObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "JavaScriptCore", name = "Value"}))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_js_value_for_dom_object" webkit_frame_get_js_value_for_dom_object ::
Ptr Frame -> -- frame : TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"})
Ptr WebKit2WebExtension.DOMObject.DOMObject -> -- dom_object : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMObject"})
IO (Ptr JavaScriptCore.Value.Value)
{- |
Get a 'GI.JavaScriptCore.Objects.Value.Value' referencing the given DOM object. The value is created in the JavaScript execution
context of /@frame@/.
/Since: 2.22/
-}
frameGetJsValueForDomObject ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a, WebKit2WebExtension.DOMObject.IsDOMObject b) =>
a
{- ^ /@frame@/: a 'GI.WebKit2WebExtension.Objects.Frame.Frame' -}
-> b
{- ^ /@domObject@/: a 'GI.WebKit2WebExtension.Objects.DOMObject.DOMObject' -}
-> m JavaScriptCore.Value.Value
{- ^ __Returns:__ the 'GI.JavaScriptCore.Objects.Value.Value' referencing /@domObject@/. -}
frameGetJsValueForDomObject frame domObject = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
domObject' <- unsafeManagedPtrCastPtr domObject
result <- webkit_frame_get_js_value_for_dom_object frame' domObject'
checkUnexpectedReturnNULL "frameGetJsValueForDomObject" result
result' <- (wrapObject JavaScriptCore.Value.Value) result
touchManagedPtr frame
touchManagedPtr domObject
return result'
#if ENABLE_OVERLOADING
data FrameGetJsValueForDomObjectMethodInfo
instance (signature ~ (b -> m JavaScriptCore.Value.Value), MonadIO m, IsFrame a, WebKit2WebExtension.DOMObject.IsDOMObject b) => O.MethodInfo FrameGetJsValueForDomObjectMethodInfo a signature where
overloadedMethod _ = frameGetJsValueForDomObject
#endif
-- method Frame::get_js_value_for_dom_object_in_script_world
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dom_object", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitDOMObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "world", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "ScriptWorld"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitScriptWorld", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "JavaScriptCore", name = "Value"}))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_js_value_for_dom_object_in_script_world" webkit_frame_get_js_value_for_dom_object_in_script_world ::
Ptr Frame -> -- frame : TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"})
Ptr WebKit2WebExtension.DOMObject.DOMObject -> -- dom_object : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMObject"})
Ptr WebKit2WebExtension.ScriptWorld.ScriptWorld -> -- world : TInterface (Name {namespace = "WebKit2WebExtension", name = "ScriptWorld"})
IO (Ptr JavaScriptCore.Value.Value)
{- |
Get a 'GI.JavaScriptCore.Objects.Value.Value' referencing the given DOM object. The value is created in the JavaScript execution
context of /@frame@/ for the given 'GI.WebKit2WebExtension.Objects.ScriptWorld.ScriptWorld'.
/Since: 2.22/
-}
frameGetJsValueForDomObjectInScriptWorld ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a, WebKit2WebExtension.DOMObject.IsDOMObject b, WebKit2WebExtension.ScriptWorld.IsScriptWorld c) =>
a
{- ^ /@frame@/: a 'GI.WebKit2WebExtension.Objects.Frame.Frame' -}
-> b
{- ^ /@domObject@/: a 'GI.WebKit2WebExtension.Objects.DOMObject.DOMObject' -}
-> c
{- ^ /@world@/: a 'GI.WebKit2WebExtension.Objects.ScriptWorld.ScriptWorld' -}
-> m JavaScriptCore.Value.Value
{- ^ __Returns:__ the 'GI.JavaScriptCore.Objects.Value.Value' referencing /@domObject@/ -}
frameGetJsValueForDomObjectInScriptWorld frame domObject world = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
domObject' <- unsafeManagedPtrCastPtr domObject
world' <- unsafeManagedPtrCastPtr world
result <- webkit_frame_get_js_value_for_dom_object_in_script_world frame' domObject' world'
checkUnexpectedReturnNULL "frameGetJsValueForDomObjectInScriptWorld" result
result' <- (wrapObject JavaScriptCore.Value.Value) result
touchManagedPtr frame
touchManagedPtr domObject
touchManagedPtr world
return result'
#if ENABLE_OVERLOADING
data FrameGetJsValueForDomObjectInScriptWorldMethodInfo
instance (signature ~ (b -> c -> m JavaScriptCore.Value.Value), MonadIO m, IsFrame a, WebKit2WebExtension.DOMObject.IsDOMObject b, WebKit2WebExtension.ScriptWorld.IsScriptWorld c) => O.MethodInfo FrameGetJsValueForDomObjectInScriptWorldMethodInfo a signature where
overloadedMethod _ = frameGetJsValueForDomObjectInScriptWorld
#endif
-- method Frame::get_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_get_uri" webkit_frame_get_uri ::
Ptr Frame -> -- frame : TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"})
IO CString
{- |
Gets the current active URI of /@frame@/.
/Since: 2.2/
-}
frameGetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a) =>
a
{- ^ /@frame@/: a 'GI.WebKit2WebExtension.Objects.Frame.Frame' -}
-> m (Maybe T.Text)
{- ^ __Returns:__ the current active URI of /@frame@/ or 'Nothing' if nothing has been
loaded yet. -}
frameGetUri frame = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
result <- webkit_frame_get_uri frame'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr frame
return maybeResult
#if ENABLE_OVERLOADING
data FrameGetUriMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsFrame a) => O.MethodInfo FrameGetUriMethodInfo a signature where
overloadedMethod _ = frameGetUri
#endif
-- method Frame::is_main_frame
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "webkit_frame_is_main_frame" webkit_frame_is_main_frame ::
Ptr Frame -> -- frame : TInterface (Name {namespace = "WebKit2WebExtension", name = "Frame"})
IO CInt
{- |
Gets whether /@frame@/ is the main frame of a 'GI.WebKit2WebExtension.Objects.WebPage.WebPage'
/Since: 2.2/
-}
frameIsMainFrame ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a) =>
a
{- ^ /@frame@/: a 'GI.WebKit2WebExtension.Objects.Frame.Frame' -}
-> m Bool
{- ^ __Returns:__ 'True' if /@frame@/ is a main frame or 'False' otherwise -}
frameIsMainFrame frame = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
result <- webkit_frame_is_main_frame frame'
let result' = (/= 0) result
touchManagedPtr frame
return result'
#if ENABLE_OVERLOADING
data FrameIsMainFrameMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFrame a) => O.MethodInfo FrameIsMainFrameMethodInfo a signature where
overloadedMethod _ = frameIsMainFrame
#endif