# Copyright (c) 2013 CEF Python, see the Authors file.# All rights reserved. Licensed under BSD 3-clause license.# Project website: https://github.com/cztomczak/cefpythoninclude "cefpython.pyx"include "browser.pyx"cdef JavascriptCallback CreateJavascriptCallback(int callbackId,CefRefPtr[CefBrowser] cefBrowser, object frameId,py_string functionName):# frameId is int64cdef JavascriptCallback jsCallback = JavascriptCallback()jsCallback.callbackId = callbackIdcdef PyBrowser browser = GetPyBrowser(cefBrowser)jsCallback.frame = browser.GetFrameByIdentifier(frameId)jsCallback.functionName = functionNameDebug("Created javascript callback, callbackId=%s, functionName=%s" % \(callbackId, functionName))return jsCallbackcdef class JavascriptCallback:"""A javascript callback object may still live while browser/frameare destroyed. Always check frame/browser for None value."""cdef int callbackIdcdef PyFrame framecdef py_string functionNamedef 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:# This code probably ain't neededraise Exception("JavascriptCallback.Call() FAILED: browser"" not found, callbackId = %s"% self.callbackId)else:# This code probably ain't neededraise Exception("JavascriptCallback.Call() FAILED: frame not found"", callbackId = %s" % self.callbackId)def GetFunctionName(self):return self.functionNamedef GetName(self):"""@deprecated."""return self.GetFunctionName()def GetId(self):return self.callbackIddef GetFrame(self):return self.frame
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。