#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.WebKit2WebExtension.Objects.Frame
(
Frame(..) ,
IsFrame ,
toFrame ,
noFrame ,
#if ENABLE_OVERLOADING
FrameGetJavascriptContextForScriptWorldMethodInfo,
#endif
frameGetJavascriptContextForScriptWorld ,
#if ENABLE_OVERLOADING
FrameGetJavascriptGlobalContextMethodInfo,
#endif
frameGetJavascriptGlobalContext ,
#if ENABLE_OVERLOADING
FrameGetUriMethodInfo ,
#endif
frameGetUri ,
#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.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.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.JavaScriptCore.Structs.GlobalContext as JavaScriptCore.GlobalContext
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.ScriptWorld as WebKit2WebExtension.ScriptWorld
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
class GObject o => IsFrame o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Frame a) =>
IsFrame a
#endif
instance IsFrame Frame
instance GObject.Object.IsObject Frame
toFrame :: (MonadIO m, IsFrame o) => o -> m Frame
toFrame = liftIO . unsafeCastTo 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 "getJavascriptContextForScriptWorld" o = FrameGetJavascriptContextForScriptWorldMethodInfo
ResolveFrameMethod "getJavascriptGlobalContext" o = FrameGetJavascriptGlobalContextMethodInfo
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) => O.IsLabelProxy t (Frame -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveFrameMethod t Frame, O.MethodInfo info Frame p) => O.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
#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
foreign import ccall "webkit_frame_get_javascript_context_for_script_world" webkit_frame_get_javascript_context_for_script_world ::
Ptr Frame ->
Ptr WebKit2WebExtension.ScriptWorld.ScriptWorld ->
IO (Ptr JavaScriptCore.GlobalContext.GlobalContext)
frameGetJavascriptContextForScriptWorld ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a, WebKit2WebExtension.ScriptWorld.IsScriptWorld b) =>
a
-> b
-> m JavaScriptCore.GlobalContext.GlobalContext
frameGetJavascriptContextForScriptWorld frame world = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
world' <- unsafeManagedPtrCastPtr world
result <- webkit_frame_get_javascript_context_for_script_world frame' world'
checkUnexpectedReturnNULL "frameGetJavascriptContextForScriptWorld" result
result' <- (newPtr JavaScriptCore.GlobalContext.GlobalContext) result
touchManagedPtr frame
touchManagedPtr world
return result'
#if ENABLE_OVERLOADING
data FrameGetJavascriptContextForScriptWorldMethodInfo
instance (signature ~ (b -> m JavaScriptCore.GlobalContext.GlobalContext), MonadIO m, IsFrame a, WebKit2WebExtension.ScriptWorld.IsScriptWorld b) => O.MethodInfo FrameGetJavascriptContextForScriptWorldMethodInfo a signature where
overloadedMethod _ = frameGetJavascriptContextForScriptWorld
#endif
foreign import ccall "webkit_frame_get_javascript_global_context" webkit_frame_get_javascript_global_context ::
Ptr Frame ->
IO (Ptr JavaScriptCore.GlobalContext.GlobalContext)
frameGetJavascriptGlobalContext ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a) =>
a
-> m JavaScriptCore.GlobalContext.GlobalContext
frameGetJavascriptGlobalContext frame = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
result <- webkit_frame_get_javascript_global_context frame'
checkUnexpectedReturnNULL "frameGetJavascriptGlobalContext" result
result' <- (newPtr JavaScriptCore.GlobalContext.GlobalContext) result
touchManagedPtr frame
return result'
#if ENABLE_OVERLOADING
data FrameGetJavascriptGlobalContextMethodInfo
instance (signature ~ (m JavaScriptCore.GlobalContext.GlobalContext), MonadIO m, IsFrame a) => O.MethodInfo FrameGetJavascriptGlobalContextMethodInfo a signature where
overloadedMethod _ = frameGetJavascriptGlobalContext
#endif
foreign import ccall "webkit_frame_get_uri" webkit_frame_get_uri ::
Ptr Frame ->
IO CString
frameGetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a) =>
a
-> m (Maybe T.Text)
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
foreign import ccall "webkit_frame_is_main_frame" webkit_frame_is_main_frame ::
Ptr Frame ->
IO CInt
frameIsMainFrame ::
(B.CallStack.HasCallStack, MonadIO m, IsFrame a) =>
a
-> m Bool
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