// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved. // License: New BSD License. // Website: http://code.google.com/p/cefpython/ #pragma once #if defined(_WIN32) #include "../windows/stdint.h" #endif #include "cefpython_public_api.h" class ClientHandler : public CefClient, public CefLoadHandler, public CefKeyboardHandler, public CefV8ContextHandler, public CefRequestHandler, public CefDisplayHandler, public CefLifeSpanHandler, public CefRenderHandler, public CefDragHandler /* public CefFocusHandler, public CefMenuHandler, public CefPrintHandler, public CefPermissionHandler, public CefFindHandler, public CefJSDialogHandler, */ { public: ClientHandler(){} virtual ~ClientHandler(){} // --------------------------------------------------------------------------- // Handlers that are already implemented // --------------------------------------------------------------------------- virtual CefRefPtr GetLoadHandler() OVERRIDE { return this; } virtual CefRefPtr GetRequestHandler() OVERRIDE { return this; } virtual CefRefPtr GetDisplayHandler() OVERRIDE { return this; } virtual CefRefPtr GetKeyboardHandler() OVERRIDE { return this; } virtual CefRefPtr GetV8ContextHandler() OVERRIDE { return this; } virtual CefRefPtr GetLifeSpanHandler() OVERRIDE { return this; } virtual CefRefPtr GetRenderHandler() OVERRIDE { return this; } virtual CefRefPtr GetDragHandler() OVERRIDE { return this; } // --------------------------------------------------------------------------- // NOT yet implemented handlers // --------------------------------------------------------------------------- virtual CefRefPtr GetFocusHandler() OVERRIDE { return NULL; } virtual CefRefPtr GetMenuHandler() OVERRIDE { return NULL; } virtual CefRefPtr GetPermissionHandler() OVERRIDE { return NULL; } virtual CefRefPtr GetPrintHandler() OVERRIDE { return NULL; } virtual CefRefPtr GetFindHandler() OVERRIDE { return NULL; } virtual CefRefPtr GetJSDialogHandler() OVERRIDE { return NULL; } // --------------------------------------------------------------------------- // CefLoadHandler methods. // --------------------------------------------------------------------------- virtual void OnLoadEnd( CefRefPtr browser, CefRefPtr frame, int httpStatusCode ) OVERRIDE; virtual void OnLoadStart( CefRefPtr browser, CefRefPtr frame ) OVERRIDE; virtual bool OnLoadError( CefRefPtr browser, CefRefPtr frame, cef_handler_errorcode_t errorCode, const CefString& failedUrl, CefString& errorText ) OVERRIDE; // --------------------------------------------------------------------------- // CefKeyboardHandler methods. // --------------------------------------------------------------------------- virtual bool OnKeyEvent( CefRefPtr browser, cef_handler_keyevent_type_t eventType, int keyCode, int modifiers, bool isSystemKey, bool isAfterJavascript ) OVERRIDE; // --------------------------------------------------------------------------- // CefV8ContextHandler methods. // --------------------------------------------------------------------------- virtual void OnContextCreated( CefRefPtr cefBrowser, CefRefPtr cefFrame, CefRefPtr v8Context) OVERRIDE; virtual void OnContextReleased( CefRefPtr cefBrowser, CefRefPtr cefFrame, CefRefPtr v8Context) OVERRIDE; virtual void OnUncaughtException( CefRefPtr browser, CefRefPtr frame, CefRefPtr context, CefRefPtr exception, CefRefPtr stackTrace) OVERRIDE; // --------------------------------------------------------------------------- // CefRequestHandler methods. // --------------------------------------------------------------------------- virtual bool OnBeforeBrowse( CefRefPtr browser, CefRefPtr frame, CefRefPtr request, cef_handler_navtype_t navType, bool isRedirect) OVERRIDE; virtual bool OnBeforeResourceLoad( CefRefPtr browser, CefRefPtr request, CefString& redirectUrl, CefRefPtr& resourceStream, CefRefPtr response, int loadFlags) OVERRIDE; virtual void OnResourceRedirect( CefRefPtr browser, const CefString& old_url, CefString& new_url) OVERRIDE; virtual void OnResourceResponse( CefRefPtr browser, const CefString& url, CefRefPtr response, CefRefPtr& filter) OVERRIDE; virtual bool OnProtocolExecution( CefRefPtr browser, const CefString& url, bool& allowOSExecution) OVERRIDE; virtual bool GetDownloadHandler( CefRefPtr browser, const CefString& mimeType, const CefString& fileName, int64 contentLength, CefRefPtr& handler) OVERRIDE; virtual bool GetAuthCredentials( CefRefPtr browser, bool isProxy, const CefString& host, int port, const CefString& realm, const CefString& scheme, CefString& username, CefString& password) OVERRIDE; virtual CefRefPtr GetCookieManager( CefRefPtr browser, const CefString& main_url) OVERRIDE; // --------------------------------------------------------------------------- // CefDisplayHandler // --------------------------------------------------------------------------- virtual void OnAddressChange(CefRefPtr browser, CefRefPtr frame, const CefString& url) OVERRIDE; virtual bool OnConsoleMessage(CefRefPtr browser, const CefString& message, const CefString& source, int line) OVERRIDE; virtual void OnContentsSizeChange(CefRefPtr browser, CefRefPtr frame, int width, int height) OVERRIDE; virtual void OnNavStateChange(CefRefPtr browser, bool canGoBack, bool canGoForward) OVERRIDE; virtual void OnStatusMessage(CefRefPtr browser, const CefString& value, StatusType type) OVERRIDE; virtual void OnTitleChange(CefRefPtr browser, const CefString& title) OVERRIDE; virtual bool OnTooltip(CefRefPtr browser, CefString& text) OVERRIDE; // --------------------------------------------------------------------------- // CefLifeSpanHandler // --------------------------------------------------------------------------- virtual bool DoClose(CefRefPtr browser) OVERRIDE; virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; virtual bool OnBeforePopup(CefRefPtr parentBrowser, const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, const CefString& url, CefRefPtr& client, CefBrowserSettings& settings) OVERRIDE; virtual bool RunModal(CefRefPtr browser) OVERRIDE; // --------------------------------------------------------------------------- // CefRenderHandler // --------------------------------------------------------------------------- #if defined(OS_WIN) virtual bool GetViewRect(CefRefPtr browser, CefRect& rect) OVERRIDE; virtual bool GetScreenRect(CefRefPtr browser, CefRect& rect) OVERRIDE; virtual bool GetScreenPoint(CefRefPtr browser, int viewX, int viewY, int& screenX, int& screenY) OVERRIDE; virtual void OnPopupShow(CefRefPtr browser, bool show) OVERRIDE; virtual void OnPopupSize(CefRefPtr browser, const CefRect& rect) OVERRIDE; virtual void OnPaint(CefRefPtr browser, PaintElementType type, const RectList& dirtyRects, const void* buffer) OVERRIDE; virtual void OnCursorChange(CefRefPtr browser, CefCursorHandle cursor) OVERRIDE; #endif // --------------------------------------------------------------------------- // CefDragHandler // --------------------------------------------------------------------------- virtual bool OnDragStart(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask) OVERRIDE; virtual bool OnDragEnter(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask) OVERRIDE; protected: // Include the default reference counting implementation. IMPLEMENT_REFCOUNTING(ClientHandler); // Include the default locking implementation. IMPLEMENT_LOCKING(ClientHandler); };