mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Implement off-screen rendering support using delegated rendering (issue #1257).
This implementation supports both GPU compositing and software compositing (used when GPU is not supported or when passing `--disable-gpu --disable-gpu-compositing` command-line flags). GPU-accelerated features (WebGL and 3D CSS) that did not work with the previous off-screen rendering implementation do work with this implementation when GPU support is available. Rendering now operates on a per-frame basis. The frame rate is configurable via CefBrowserSettings.windowless_frame_rate up to a maximum of 60fps (potentially limited by how fast the system can generate new frames). CEF generates a bitmap from the compositor backing and passes it to CefRenderHandler::OnPaint. The previous CefRenderHandler/CefBrowserHost API for off-screen rendering has been restored mostly as-is with some minor changes: - CefBrowserHost::Invalidate no longer accepts a CefRect region argument. Instead of invalidating a specific region it now triggers generation of a new frame. - The |dirtyRects| argument to CefRenderHandler::OnPaint will now always be a single CefRect representing the whole view (frame) size. Previously, invalidated regions were listed separately. - Linux: CefBrowserHost::SendKeyEvent now expects X11 event information instead of GTK event information. See cefclient for an example of converting GTK events to the necessary format. - Sizes passed to the CefRenderHandler OnPaint and OnPopupSize methods are now already DPI scaled. Previously, the client had to perform DPI scaling. - Includes drag&drop implementation from issue #1032. - Includes unit test fixes from issue #1245. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1751 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
@@ -330,6 +331,61 @@ bool CefBrowserHostCToCpp::IsMouseCursorChangeDisabled() {
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefBrowserHostCToCpp::IsWindowRenderingDisabled() {
|
||||
if (CEF_MEMBER_MISSING(struct_, is_window_rendering_disabled))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->is_window_rendering_disabled(struct_);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::WasResized() {
|
||||
if (CEF_MEMBER_MISSING(struct_, was_resized))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->was_resized(struct_);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::WasHidden(bool hidden) {
|
||||
if (CEF_MEMBER_MISSING(struct_, was_hidden))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->was_hidden(struct_,
|
||||
hidden);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::NotifyScreenInfoChanged() {
|
||||
if (CEF_MEMBER_MISSING(struct_, notify_screen_info_changed))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->notify_screen_info_changed(struct_);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::Invalidate(PaintElementType type) {
|
||||
if (CEF_MEMBER_MISSING(struct_, invalidate))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->invalidate(struct_,
|
||||
type);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::SendKeyEvent(const CefKeyEvent& event) {
|
||||
if (CEF_MEMBER_MISSING(struct_, send_key_event))
|
||||
return;
|
||||
@@ -404,6 +460,120 @@ void CefBrowserHostCToCpp::SendCaptureLostEvent() {
|
||||
struct_->send_capture_lost_event(struct_);
|
||||
}
|
||||
|
||||
CefTextInputContext CefBrowserHostCToCpp::GetNSTextInputContext() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_nstext_input_context))
|
||||
return NULL;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_text_input_context_t _retval = struct_->get_nstext_input_context(struct_);
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::HandleKeyEventBeforeTextInputClient(
|
||||
CefEventHandle keyEvent) {
|
||||
if (CEF_MEMBER_MISSING(struct_, handle_key_event_before_text_input_client))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->handle_key_event_before_text_input_client(struct_,
|
||||
keyEvent);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::HandleKeyEventAfterTextInputClient(
|
||||
CefEventHandle keyEvent) {
|
||||
if (CEF_MEMBER_MISSING(struct_, handle_key_event_after_text_input_client))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->handle_key_event_after_text_input_client(struct_,
|
||||
keyEvent);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||
const CefMouseEvent& event, DragOperationsMask allowed_ops) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drag_enter))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: drag_data; type: refptr_same
|
||||
DCHECK(drag_data.get());
|
||||
if (!drag_data.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drag_enter(struct_,
|
||||
CefDragDataCToCpp::Unwrap(drag_data),
|
||||
&event,
|
||||
allowed_ops);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDragOver(const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drag_over))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drag_over(struct_,
|
||||
&event,
|
||||
allowed_ops);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDragLeave() {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drag_leave))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drag_leave(struct_);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDrop(const CefMouseEvent& event) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drop))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drop(struct_,
|
||||
&event);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragSourceEndedAt(int x, int y,
|
||||
DragOperationsMask op) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_source_ended_at))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_source_ended_at(struct_,
|
||||
x,
|
||||
y,
|
||||
op);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragSourceSystemDragEnded() {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_source_system_drag_ended))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_source_system_drag_ended(struct_);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefBrowserHostCToCpp, CefBrowserHost,
|
||||
|
@@ -62,6 +62,11 @@ class CefBrowserHostCToCpp
|
||||
virtual void CloseDevTools() OVERRIDE;
|
||||
virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
|
||||
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
|
||||
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
||||
virtual void WasResized() OVERRIDE;
|
||||
virtual void WasHidden(bool hidden) OVERRIDE;
|
||||
virtual void NotifyScreenInfoChanged() OVERRIDE;
|
||||
virtual void Invalidate(PaintElementType type) OVERRIDE;
|
||||
virtual void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
|
||||
virtual void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
MouseButtonType type, bool mouseUp, int clickCount) OVERRIDE;
|
||||
@@ -71,6 +76,19 @@ class CefBrowserHostCToCpp
|
||||
int deltaY) OVERRIDE;
|
||||
virtual void SendFocusEvent(bool setFocus) OVERRIDE;
|
||||
virtual void SendCaptureLostEvent() OVERRIDE;
|
||||
virtual CefTextInputContext GetNSTextInputContext() OVERRIDE;
|
||||
virtual void HandleKeyEventBeforeTextInputClient(
|
||||
CefEventHandle keyEvent) OVERRIDE;
|
||||
virtual void HandleKeyEventAfterTextInputClient(
|
||||
CefEventHandle keyEvent) OVERRIDE;
|
||||
virtual void DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||
const CefMouseEvent& event, DragOperationsMask allowed_ops) OVERRIDE;
|
||||
virtual void DragTargetDragOver(const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops) OVERRIDE;
|
||||
virtual void DragTargetDragLeave() OVERRIDE;
|
||||
virtual void DragTargetDrop(const CefMouseEvent& event) OVERRIDE;
|
||||
virtual void DragSourceEndedAt(int x, int y, DragOperationsMask op) OVERRIDE;
|
||||
virtual void DragSourceSystemDragEnded() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/load_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
|
||||
|
||||
@@ -174,6 +175,19 @@ CefRefPtr<CefLoadHandler> CefClientCToCpp::GetLoadHandler() {
|
||||
return CefLoadHandlerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRenderHandler> CefClientCToCpp::GetRenderHandler() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_render_handler))
|
||||
return NULL;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_render_handler_t* _retval = struct_->get_render_handler(struct_);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRenderHandlerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestHandler> CefClientCToCpp::GetRequestHandler() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_request_handler))
|
||||
return NULL;
|
||||
|
@@ -43,6 +43,7 @@ class CefClientCToCpp
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE;
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
|
@@ -11,11 +11,51 @@
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefDragData> CefDragData::Create() {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_drag_data_t* _retval = cef_drag_data_create();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefDragDataCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefDragData> CefDragDataCToCpp::Clone() {
|
||||
if (CEF_MEMBER_MISSING(struct_, clone))
|
||||
return NULL;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_drag_data_t* _retval = struct_->clone(struct_);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefDragDataCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
bool CefDragDataCToCpp::IsReadOnly() {
|
||||
if (CEF_MEMBER_MISSING(struct_, is_read_only))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->is_read_only(struct_);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefDragDataCToCpp::IsLink() {
|
||||
if (CEF_MEMBER_MISSING(struct_, is_link))
|
||||
return false;
|
||||
@@ -160,6 +200,22 @@ CefString CefDragDataCToCpp::GetFileName() {
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
size_t CefDragDataCToCpp::GetFileContents(CefRefPtr<CefStreamWriter> writer) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_file_contents))
|
||||
return 0;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: writer
|
||||
|
||||
// Execute
|
||||
size_t _retval = struct_->get_file_contents(struct_,
|
||||
CefStreamWriterCToCpp::Unwrap(writer));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
bool CefDragDataCToCpp::GetFileNames(std::vector<CefString>& names) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_file_names))
|
||||
return false;
|
||||
@@ -187,6 +243,113 @@ bool CefDragDataCToCpp::GetFileNames(std::vector<CefString>& names) {
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::SetLinkURL(const CefString& url) {
|
||||
if (CEF_MEMBER_MISSING(struct_, set_link_url))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: url
|
||||
|
||||
// Execute
|
||||
struct_->set_link_url(struct_,
|
||||
url.GetStruct());
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::SetLinkTitle(const CefString& title) {
|
||||
if (CEF_MEMBER_MISSING(struct_, set_link_title))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: title
|
||||
|
||||
// Execute
|
||||
struct_->set_link_title(struct_,
|
||||
title.GetStruct());
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::SetLinkMetadata(const CefString& data) {
|
||||
if (CEF_MEMBER_MISSING(struct_, set_link_metadata))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: data
|
||||
|
||||
// Execute
|
||||
struct_->set_link_metadata(struct_,
|
||||
data.GetStruct());
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::SetFragmentText(const CefString& text) {
|
||||
if (CEF_MEMBER_MISSING(struct_, set_fragment_text))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: text
|
||||
|
||||
// Execute
|
||||
struct_->set_fragment_text(struct_,
|
||||
text.GetStruct());
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::SetFragmentHtml(const CefString& html) {
|
||||
if (CEF_MEMBER_MISSING(struct_, set_fragment_html))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: html
|
||||
|
||||
// Execute
|
||||
struct_->set_fragment_html(struct_,
|
||||
html.GetStruct());
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::SetFragmentBaseURL(const CefString& base_url) {
|
||||
if (CEF_MEMBER_MISSING(struct_, set_fragment_base_url))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: base_url
|
||||
|
||||
// Execute
|
||||
struct_->set_fragment_base_url(struct_,
|
||||
base_url.GetStruct());
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::ResetFileContents() {
|
||||
if (CEF_MEMBER_MISSING(struct_, reset_file_contents))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->reset_file_contents(struct_);
|
||||
}
|
||||
|
||||
void CefDragDataCToCpp::AddFile(const CefString& path,
|
||||
const CefString& display_name) {
|
||||
if (CEF_MEMBER_MISSING(struct_, add_file))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: path; type: string_byref_const
|
||||
DCHECK(!path.empty());
|
||||
if (path.empty())
|
||||
return;
|
||||
// Unverified params: display_name
|
||||
|
||||
// Execute
|
||||
struct_->add_file(struct_,
|
||||
path.GetStruct(),
|
||||
display_name.GetStruct());
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefDragDataCToCpp, CefDragData,
|
||||
|
@@ -33,6 +33,8 @@ class CefDragDataCToCpp
|
||||
virtual ~CefDragDataCToCpp() {}
|
||||
|
||||
// CefDragData methods
|
||||
virtual CefRefPtr<CefDragData> Clone() OVERRIDE;
|
||||
virtual bool IsReadOnly() OVERRIDE;
|
||||
virtual bool IsLink() OVERRIDE;
|
||||
virtual bool IsFragment() OVERRIDE;
|
||||
virtual bool IsFile() OVERRIDE;
|
||||
@@ -43,7 +45,17 @@ class CefDragDataCToCpp
|
||||
virtual CefString GetFragmentHtml() OVERRIDE;
|
||||
virtual CefString GetFragmentBaseURL() OVERRIDE;
|
||||
virtual CefString GetFileName() OVERRIDE;
|
||||
virtual size_t GetFileContents(CefRefPtr<CefStreamWriter> writer) OVERRIDE;
|
||||
virtual bool GetFileNames(std::vector<CefString>& names) OVERRIDE;
|
||||
virtual void SetLinkURL(const CefString& url) OVERRIDE;
|
||||
virtual void SetLinkTitle(const CefString& title) OVERRIDE;
|
||||
virtual void SetLinkMetadata(const CefString& data) OVERRIDE;
|
||||
virtual void SetFragmentText(const CefString& text) OVERRIDE;
|
||||
virtual void SetFragmentHtml(const CefString& html) OVERRIDE;
|
||||
virtual void SetFragmentBaseURL(const CefString& base_url) OVERRIDE;
|
||||
virtual void ResetFileContents() OVERRIDE;
|
||||
virtual void AddFile(const CefString& path,
|
||||
const CefString& display_name) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
|
275
libcef_dll/ctocpp/render_handler_ctocpp.cc
Normal file
275
libcef_dll/ctocpp/render_handler_ctocpp.cc
Normal file
@@ -0,0 +1,275 @@
|
||||
// Copyright (c) 2014 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
bool CefRenderHandlerCToCpp::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_root_screen_rect))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->get_root_screen_rect(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
&rect);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefRenderHandlerCToCpp::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_view_rect))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->get_view_rect(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
&rect);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefRenderHandlerCToCpp::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||
int viewX, int viewY, int& screenX, int& screenY) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_screen_point))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->get_screen_point(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
viewX,
|
||||
viewY,
|
||||
&screenX,
|
||||
&screenY);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefRenderHandlerCToCpp::GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||
CefScreenInfo& screen_info) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_screen_info))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->get_screen_info(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
&screen_info);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
void CefRenderHandlerCToCpp::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
||||
bool show) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_popup_show))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->on_popup_show(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
show);
|
||||
}
|
||||
|
||||
void CefRenderHandlerCToCpp::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||
const CefRect& rect) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_popup_size))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->on_popup_size(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
&rect);
|
||||
}
|
||||
|
||||
void CefRenderHandlerCToCpp::OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type, const RectList& dirtyRects, const void* buffer,
|
||||
int width, int height) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_paint))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: buffer; type: simple_byaddr
|
||||
DCHECK(buffer);
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
// Translate param: dirtyRects; type: simple_vec_byref_const
|
||||
const size_t dirtyRectsCount = dirtyRects.size();
|
||||
cef_rect_t* dirtyRectsList = NULL;
|
||||
if (dirtyRectsCount > 0) {
|
||||
dirtyRectsList = new cef_rect_t[dirtyRectsCount];
|
||||
DCHECK(dirtyRectsList);
|
||||
if (dirtyRectsList) {
|
||||
for (size_t i = 0; i < dirtyRectsCount; ++i) {
|
||||
dirtyRectsList[i] = dirtyRects[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
struct_->on_paint(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
type,
|
||||
dirtyRectsCount,
|
||||
dirtyRectsList,
|
||||
buffer,
|
||||
width,
|
||||
height);
|
||||
|
||||
// Restore param:dirtyRects; type: simple_vec_byref_const
|
||||
if (dirtyRectsList)
|
||||
delete [] dirtyRectsList;
|
||||
}
|
||||
|
||||
void CefRenderHandlerCToCpp::OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||
CefCursorHandle cursor) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_cursor_change))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->on_cursor_change(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
cursor);
|
||||
}
|
||||
|
||||
bool CefRenderHandlerCToCpp::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data, DragOperationsMask allowed_ops, int x,
|
||||
int y) {
|
||||
if (CEF_MEMBER_MISSING(struct_, start_dragging))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: drag_data; type: refptr_diff
|
||||
DCHECK(drag_data.get());
|
||||
if (!drag_data.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->start_dragging(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
CefDragDataCppToC::Wrap(drag_data),
|
||||
allowed_ops,
|
||||
x,
|
||||
y);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
void CefRenderHandlerCToCpp::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||
DragOperation operation) {
|
||||
if (CEF_MEMBER_MISSING(struct_, update_drag_cursor))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->update_drag_cursor(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
operation);
|
||||
}
|
||||
|
||||
void CefRenderHandlerCToCpp::OnScrollOffsetChanged(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_scroll_offset_changed))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->on_scroll_offset_changed(struct_,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefRenderHandlerCToCpp, CefRenderHandler,
|
||||
cef_render_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
63
libcef_dll/ctocpp/render_handler_ctocpp.h
Normal file
63
libcef_dll/ctocpp/render_handler_ctocpp.h
Normal file
@@ -0,0 +1,63 @@
|
||||
// Copyright (c) 2014 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_RENDER_HANDLER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_RENDER_HANDLER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#ifndef BUILDING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||
#else // BUILDING_CEF_SHARED
|
||||
|
||||
#include "include/cef_render_handler.h"
|
||||
#include "include/capi/cef_render_handler_capi.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefRenderHandlerCToCpp
|
||||
: public CefCToCpp<CefRenderHandlerCToCpp, CefRenderHandler,
|
||||
cef_render_handler_t> {
|
||||
public:
|
||||
explicit CefRenderHandlerCToCpp(cef_render_handler_t* str)
|
||||
: CefCToCpp<CefRenderHandlerCToCpp, CefRenderHandler,
|
||||
cef_render_handler_t>(str) {}
|
||||
virtual ~CefRenderHandlerCToCpp() {}
|
||||
|
||||
// CefRenderHandler methods
|
||||
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) OVERRIDE;
|
||||
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) OVERRIDE;
|
||||
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser, int viewX,
|
||||
int viewY, int& screenX, int& screenY) OVERRIDE;
|
||||
virtual bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||
CefScreenInfo& screen_info) OVERRIDE;
|
||||
virtual void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) OVERRIDE;
|
||||
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||
const CefRect& rect) OVERRIDE;
|
||||
virtual void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type,
|
||||
const RectList& dirtyRects, const void* buffer, int width,
|
||||
int height) OVERRIDE;
|
||||
virtual void OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||
CefCursorHandle cursor) OVERRIDE;
|
||||
virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data, DragOperationsMask allowed_ops, int x,
|
||||
int y) OVERRIDE;
|
||||
virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||
DragOperation operation) OVERRIDE;
|
||||
virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_RENDER_HANDLER_CTOCPP_H_
|
||||
|
Reference in New Issue
Block a user