FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/src/javascript_callback.pyx at cefpython54 · down2bit/cefpython · GitHub
down2bit
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
src
/
javascript_callback.pyx
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (42 loc) · 1.75 KB
Breadcrumbs
cefpython
/
src
/
javascript_callback.pyx
Copy path
File metadata and controls
49 lines (42 loc) · 1.75 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
49
#
Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
#
License: New BSD License.
#
Website: http://code.google.com/p/cefpython/
include
"
cefpython.pyx
"
cdef JavascriptCallback CreateJavascriptCallback(
int
callbackId,
CefRefPtr[CefBrowser] cefBrowser,
object
frameId, py_string functionName):
#
frameId is int64
cdef JavascriptCallback jsCallback
=
JavascriptCallback()
jsCallback.callbackId
=
callbackId
cdef PyBrowser browser
=
GetPyBrowser(cefBrowser)
jsCallback.frame
=
browser.GetFrameByIdentifier(frameId)
jsCallback.functionName
=
functionName
Debug(
"
Created javascript callback, callbackId=
%s
, functionName=
%s
"
%
\
(callbackId, functionName))
return
jsCallback
cdef
class
JavascriptCallback:
cdef
int
callbackId
cdef PyFrame frame
cdef py_string functionName
def
Call
(
self
, *
args
):
#
Send process message "ExecuteJavascriptCallback".
if
self
.frame:
browser
=
self
.frame.GetBrowser()
if
browser:
browser.SendProcessMessage(
cef_types.PID_RENDERER,
self
.frame.GetIdentifier(),
"
ExecuteJavascriptCallback
"
,
[
self
.callbackId]
+
list
(args))
else
:
Debug(
"
JavascriptCallback.Call() FAILED: browser not found,
"
\
"
callbackId =
%s
"
%
self
.callbackId)
else
:
Debug(
"
JavascriptCallback.Call() FAILED: frame not found,
"
\
"
callbackId =
%s
"
%
self
.callbackId)
def
GetFunctionName
(
self
):
return
self
.functionName
def
GetName
(
self
):
#
DEPRECATED name.
return
self
.GetFunctionName()
def
GetFrame
(
self
):
return
self
.frame
Back
|
FazBrowse Home
|
New Git URL