-
Notifications
You must be signed in to change notification settings - Fork 0
/
render_process_handler.go
48 lines (40 loc) · 1.19 KB
/
render_process_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"log"
"github.com/turutcrane/cefingo/capi"
"github.com/turutcrane/cefingo/message_router"
)
type myRenderProcessHandler struct {
renderProcessHandler *capi.CRenderProcessHandlerT
router *router.RendererMessageRouter
}
func init() {
var rph *myRenderProcessHandler
var _ capi.OnContextCreatedHandler = rph
var _ capi.CRenderProcessHandlerTOnProcessMessageReceivedHandler = rph
}
const (
jsQueryFunctionName = "cefQuery"
jsQueryCancelFunctionName = "cefQueryCancel"
)
func (rph *myRenderProcessHandler) OnContextCreated(
self *capi.CRenderProcessHandlerT,
browser *capi.CBrowserT,
frame *capi.CFrameT,
context *capi.CV8contextT,
) {
log.Println("T25:OnContextCreated")
rph.router = router.RendererProcessOnContextCreated(routerMessagePrefix, context, jsQueryFunctionName, jsQueryCancelFunctionName)
}
func (rph *myRenderProcessHandler) OnProcessMessageReceived(
self *capi.CRenderProcessHandlerT,
browser *capi.CBrowserT,
frame *capi.CFrameT,
source_process capi.CProcessIdT,
message *capi.CProcessMessageT,
) (ret bool) {
if rph.router != nil {
return rph.router.OnProcessMessageReceived(browser, frame, source_process, message)
}
return false
}