#include "stdafx.h" #pragma once #include "ClientAdapter.h" namespace CefSharp { using namespace System; interface class IOffscreenWebBrowser; class OffscreenClientAdapter : public ClientAdapter, public CefRenderHandler { private: gcroot _offscreenBrowserControl; public: ~OffscreenClientAdapter() { _offscreenBrowserControl = nullptr; } OffscreenClientAdapter(IOffscreenWebBrowser^ offscreenBrowserControl) : ClientAdapter((IWebBrowser^)offscreenBrowserControl) { _offscreenBrowserControl = offscreenBrowserControl; } // CefClient virtual CefRefPtr GetRenderHandler() OVERRIDE { return this; } // CefRenderHandler 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; IMPLEMENT_LOCKING(OffscreenClientAdapter); IMPLEMENT_REFCOUNTING(OffscreenClientAdapter); }; }