X Tutup
// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved. // License: New BSD License. // Website: http://code.google.com/p/cefpython/ #pragma once #include "include/cef_app.h" #include
// CefPythonApp class is instantiated in subprocess and in // cefpython.pyx for the browser process, so the code is shared. // Using printf() in CefRenderProcessHandler won't work, use // the DebugLog() function instead, it will write the message // to the "debug.log" file. /// // Implement this interface to provide handler implementations. Methods will be // called by the process and/or thread indicated. /// /*--cef(source=client,no_debugct_check)--*/ class CefPythonApp : public CefApp, public CefBrowserProcessHandler, public CefRenderProcessHandler { public: CefPythonApp(); virtual void OnBeforeCommandLineProcessing( const CefString& process_type, CefRefPtr
command_line) OVERRIDE; virtual void OnRegisterCustomSchemes( CefRefPtr
registrar) OVERRIDE; virtual CefRefPtr
GetResourceBundleHandler() OVERRIDE; virtual CefRefPtr
GetBrowserProcessHandler() OVERRIDE; virtual CefRefPtr
GetRenderProcessHandler() OVERRIDE; // --------------------------------------------------------------------------- // CefBrowserProcessHandler // --------------------------------------------------------------------------- virtual void OnContextInitialized() OVERRIDE; virtual void OnBeforeChildProcessLaunch( CefRefPtr
command_line) OVERRIDE; virtual void OnRenderProcessThreadCreated( CefRefPtr
extra_info) OVERRIDE; // --------------------------------------------------------------------------- // CefRenderProcessHandler // --------------------------------------------------------------------------- virtual void OnRenderThreadCreated(CefRefPtr
extra_info) OVERRIDE; virtual void OnWebKitInitialized() OVERRIDE; virtual void OnBrowserCreated(CefRefPtr
browser) OVERRIDE; virtual void OnBrowserDestroyed(CefRefPtr
browser) OVERRIDE; virtual bool OnBeforeNavigation(CefRefPtr
browser, CefRefPtr
frame, CefRefPtr
request, cef_navigation_type_t navigation_type, bool is_redirect) OVERRIDE; virtual void OnContextCreated(CefRefPtr
browser, CefRefPtr
frame, CefRefPtr
context) OVERRIDE; virtual void OnContextReleased(CefRefPtr
browser, CefRefPtr
frame, CefRefPtr
context) OVERRIDE; virtual void OnUncaughtException(CefRefPtr
browser, CefRefPtr
frame, CefRefPtr
context, CefRefPtr
exception, CefRefPtr
stackTrace) OVERRIDE; virtual void OnFocusedNodeChanged(CefRefPtr
browser, CefRefPtr
frame, CefRefPtr
node) OVERRIDE; virtual bool OnProcessMessageReceived(CefRefPtr
browser, CefProcessId source_process, CefRefPtr
message) OVERRIDE; // --------------------------------------------------------------------------- // Javascript bindings // --------------------------------------------------------------------------- virtual void SetJavascriptBindings(CefRefPtr
browser, CefRefPtr
data); virtual CefRefPtr
GetJavascriptBindings( CefRefPtr
browser); virtual void RemoveJavascriptBindings(CefRefPtr
browser); virtual bool BindedFunctionExists(CefRefPtr
browser, const CefString& funcName); virtual void DoJavascriptBindingsForBrowser(CefRefPtr
browser); virtual void DoJavascriptBindingsForFrame(CefRefPtr
browser, CefRefPtr
frame, CefRefPtr
context); protected: std::map
> javascriptBindings_; std::string commandLineString_; private: // Include the default reference counting implementation. IMPLEMENT_REFCOUNTING(CefPythonApp); };
X Tutup