mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-13 18:16:20 +01:00
dbe8de277f
- Replace CefHandler with a new CefClient interface and separate handler interfaces. - Add support for virtual inheritance to allow multiple CefBase parented interfaces to be implemented in the same class. - Replace CefThreadSafeBase with IMPLEMENT_* macros to support virtual inheritance and to only provide locking implementations when needed. - Move the CefBrowserSettings parameter from CefInitialize to CreateBrowser. - Add a new cef_build.h header that provides platform-specific and OS_* defines. - Introduce the use of OVERRIDE to generate compiler errors on Windows if a child virtual method declaration doesn't match the parent declaration. - Use NDEBUG instead of _DEBUG because _DEBUG is not defined on Mac. (issue #240). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@235 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
145 lines
4.1 KiB
C++
145 lines
4.1 KiB
C++
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
//
|
|
// A portion of this file was generated by the CEF translator tool. When
|
|
// making changes by hand only do so within the body of existing function
|
|
// implementations. See the translator.README.txt file in the tools directory
|
|
// for more information.
|
|
//
|
|
|
|
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
|
|
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
|
|
int CEF_CALLBACK render_handler_get_view_rect(
|
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
|
cef_rect_t* rect)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
DCHECK(rect);
|
|
if (!self || !browser || !rect)
|
|
return 0;
|
|
|
|
CefRect changeRect(*rect);
|
|
int rv = CefRenderHandlerCppToC::Get(self)->GetViewRect(
|
|
CefBrowserCToCpp::Wrap(browser), changeRect);
|
|
*rect = changeRect;
|
|
return rv;
|
|
}
|
|
|
|
int CEF_CALLBACK render_handler_get_screen_rect(
|
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
|
cef_rect_t* rect)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
DCHECK(rect);
|
|
if (!self || !browser || !rect)
|
|
return 0;
|
|
|
|
CefRect changeRect(*rect);
|
|
int rv = CefRenderHandlerCppToC::Get(self)->GetScreenRect(
|
|
CefBrowserCToCpp::Wrap(browser), changeRect);
|
|
*rect = changeRect;
|
|
return rv;
|
|
}
|
|
|
|
int CEF_CALLBACK render_handler_get_screen_point(
|
|
struct _cef_render_handler_t* self, cef_browser_t* browser, int viewX,
|
|
int viewY, int* screenX, int* screenY)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
DCHECK(screenX);
|
|
DCHECK(screenY);
|
|
if (!self || !browser || !screenX || !screenY)
|
|
return 0;
|
|
|
|
return CefRenderHandlerCppToC::Get(self)->GetScreenPoint(
|
|
CefBrowserCToCpp::Wrap(browser), viewX, viewY, *screenX, *screenY);
|
|
}
|
|
|
|
void CEF_CALLBACK render_handler_on_popup_show(
|
|
struct _cef_render_handler_t* self, cef_browser_t* browser, int show)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
if (!self || !browser)
|
|
return;
|
|
|
|
CefRenderHandlerCppToC::Get(self)->OnPopupShow(
|
|
CefBrowserCToCpp::Wrap(browser), show?true:false);
|
|
}
|
|
|
|
void CEF_CALLBACK render_handler_on_popup_size(
|
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
|
const cef_rect_t* rect)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
DCHECK(rect);
|
|
if (!self || !browser || !rect)
|
|
return;
|
|
|
|
CefRect sizeRect(*rect);
|
|
return CefRenderHandlerCppToC::Get(self)->OnPopupSize(
|
|
CefBrowserCToCpp::Wrap(browser), sizeRect);
|
|
}
|
|
|
|
void CEF_CALLBACK render_handler_on_paint(struct _cef_render_handler_t* self,
|
|
cef_browser_t* browser, enum cef_paint_element_type_t type,
|
|
const cef_rect_t* dirtyRect, const void* buffer)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
DCHECK(dirtyRect);
|
|
DCHECK(buffer);
|
|
if (!self || !browser || !dirtyRect || !buffer)
|
|
return;
|
|
|
|
CefRect rect(*dirtyRect);
|
|
return CefRenderHandlerCppToC::Get(self)->OnPaint(
|
|
CefBrowserCToCpp::Wrap(browser), type, rect, buffer);
|
|
}
|
|
|
|
void CEF_CALLBACK render_handler_on_cursor_change(
|
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
|
cef_cursor_handle_t cursor)
|
|
{
|
|
DCHECK(self);
|
|
DCHECK(browser);
|
|
if (!self || !browser)
|
|
return;
|
|
|
|
return CefRenderHandlerCppToC::Get(self)->OnCursorChange(
|
|
CefBrowserCToCpp::Wrap(browser), cursor);
|
|
}
|
|
|
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
CefRenderHandlerCppToC::CefRenderHandlerCppToC(CefRenderHandler* cls)
|
|
: CefCppToC<CefRenderHandlerCppToC, CefRenderHandler, cef_render_handler_t>(
|
|
cls)
|
|
{
|
|
struct_.struct_.get_view_rect = render_handler_get_view_rect;
|
|
struct_.struct_.get_screen_rect = render_handler_get_screen_rect;
|
|
struct_.struct_.get_screen_point = render_handler_get_screen_point;
|
|
struct_.struct_.on_popup_show = render_handler_on_popup_show;
|
|
struct_.struct_.on_popup_size = render_handler_on_popup_size;
|
|
struct_.struct_.on_paint = render_handler_on_paint;
|
|
struct_.struct_.on_cursor_change = render_handler_on_cursor_change;
|
|
}
|
|
|
|
#ifndef NDEBUG
|
|
template<> long CefCppToC<CefRenderHandlerCppToC, CefRenderHandler,
|
|
cef_render_handler_t>::DebugObjCt = 0;
|
|
#endif
|
|
|