module GI.WebKit2WebExtension.Objects.Frame
(
Frame(..) ,
IsFrame ,
toFrame ,
noFrame ,
FrameGetJavascriptContextForScriptWorldMethodInfo,
frameGetJavascriptContextForScriptWorld ,
FrameGetJavascriptGlobalContextMethodInfo,
frameGetJavascriptGlobalContext ,
FrameGetUriMethodInfo ,
frameGetUri ,
FrameIsMainFrameMethodInfo ,
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.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 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 (GObject a, O.UnknownAncestorError Frame a) =>
IsFrame a
#endif
instance IsFrame Frame
instance GObject.Object.IsObject Frame
toFrame :: IsFrame o => o -> IO Frame
toFrame = unsafeCastTo Frame
noFrame :: Maybe Frame
noFrame = Nothing
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 "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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
ResolveFrameMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
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
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
instance O.HasAttributeList Frame
type instance O.AttributeList Frame = FrameAttributeList
type FrameAttributeList = ('[ ] :: [(Symbol, *)])
type instance O.SignalList Frame = FrameSignalList
type FrameSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
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'
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
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'
data FrameGetJavascriptGlobalContextMethodInfo
instance (signature ~ (m JavaScriptCore.GlobalContext.GlobalContext), MonadIO m, IsFrame a) => O.MethodInfo FrameGetJavascriptGlobalContextMethodInfo a signature where
overloadedMethod _ = frameGetJavascriptGlobalContext
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 T.Text
frameGetUri frame = liftIO $ do
frame' <- unsafeManagedPtrCastPtr frame
result <- webkit_frame_get_uri frame'
checkUnexpectedReturnNULL "frameGetUri" result
result' <- cstringToText result
touchManagedPtr frame
return result'
data FrameGetUriMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFrame a) => O.MethodInfo FrameGetUriMethodInfo a signature where
overloadedMethod _ = frameGetUri
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'
data FrameIsMainFrameMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFrame a) => O.MethodInfo FrameIsMainFrameMethodInfo a signature where
overloadedMethod _ = frameIsMainFrame