[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/cleverphp/cefpython/cefpython53/src/subprocess/cefpython_app.h [Back]  [Original]

// 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 "include/cef_print_handler.h"

#if defined(OS_LINUX)
#include "print_handler_gtk.h"
#endif

#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.

class CefPythonApp :
        public CefApp,
        public CefBrowserProcessHandler,
        public CefRenderProcessHandler {
 protected:
  std::map javascriptBindings_;
  std::string commandLineString_;
  CefRefPtr print_handler_;

 public:
  CefPythonApp();

  void OnBeforeCommandLineProcessing(
      const CefString& process_type,
      CefRefPtr command_line) override;

  void OnRegisterCustomSchemes(
      CefRefPtr registrar) override;

  CefRefPtr GetResourceBundleHandler()
        override;

  CefRefPtr GetBrowserProcessHandler()
        override;

  CefRefPtr GetRenderProcessHandler()
        override;

  // ---------------------------------------------------------------------------
  // CefBrowserProcessHandler
  // ---------------------------------------------------------------------------

  void OnContextInitialized() override;

  void OnBeforeChildProcessLaunch(
      CefRefPtr command_line) override;

  void OnRenderProcessThreadCreated(
      CefRefPtr extra_info) override;

  CefRefPtr GetPrintHandler() override;

  void OnScheduleMessagePumpWork(int64 delay_ms) override;


  // ---------------------------------------------------------------------------
  // CefRenderProcessHandler
  // ---------------------------------------------------------------------------

  void OnRenderThreadCreated(CefRefPtr extra_info)
        override;

  void OnWebKitInitialized()
        override;

  void OnBrowserCreated(CefRefPtr browser)
        override;

  void OnBrowserDestroyed(CefRefPtr browser)
        override;

  bool OnBeforeNavigation(CefRefPtr browser,
                                  CefRefPtr frame,
                                  CefRefPtr request,
                                  cef_navigation_type_t navigation_type,
                                  bool is_redirect)
        override;

  void OnContextCreated(CefRefPtr browser,
                                CefRefPtr frame,
                                CefRefPtr context)
        override;

  void OnContextReleased(CefRefPtr browser,
                                 CefRefPtr frame,
                                 CefRefPtr context)
        override;

  void OnUncaughtException(CefRefPtr browser,
                                   CefRefPtr frame,
                                   CefRefPtr context,
                                   CefRefPtr exception,
                                   CefRefPtr stackTrace)
        override;

  void OnFocusedNodeChanged(CefRefPtr browser,
                                    CefRefPtr frame,
                                    CefRefPtr node)
        override;

  bool OnProcessMessageReceived(CefRefPtr browser,
                                        CefProcessId source_process,
                                        CefRefPtr message)
        override;

  // ---------------------------------------------------------------------------
  // Javascript bindings
  // ---------------------------------------------------------------------------

  void SetJavascriptBindings(CefRefPtr browser,
                                    CefRefPtr data);
  CefRefPtr GetJavascriptBindings(
                                    CefRefPtr browser);

  void RemoveJavascriptBindings(CefRefPtr browser);

  bool BindedFunctionExists(CefRefPtr browser,
                                    const CefString& funcName);

  void DoJavascriptBindingsForBrowser(CefRefPtr browser);

  void DoJavascriptBindingsForFrame(CefRefPtr browser,
                                    CefRefPtr frame,
                                    CefRefPtr context);

private:
  IMPLEMENT_REFCOUNTING(CefPythonApp);
};

Web Proxy Viewer  |  New URL  |  Original Page