- Add CefFocusHandler::OnFocusedNodeChanged() notification (issue #379).

- Add CefDOMNode::IsFormControlElement() and CefDOMNode::GetFormControlElementType() methods (issue #379).
- Add space bar handling example to cefclient.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@318 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-10-14 12:40:40 +00:00
parent 06b7e9ab53
commit 9c6dcab73a
16 changed files with 267 additions and 12 deletions

View File

@@ -40,6 +40,9 @@ public:
// instance to the other side.
static StructName* Wrap(CefRefPtr<BaseName> c)
{
if (!c.get())
return NULL;
// Wrap our object with the CefCppToC class.
ClassName* wrapper = new ClassName(c);
// Add a reference to our wrapper object that will be released once our
@@ -53,6 +56,8 @@ public:
// our wrapper structure back from the other side.
static CefRefPtr<BaseName> Unwrap(StructName* s)
{
DCHECK(s);
// Cast our structure to the wrapper structure type.
Struct* wrapperStruct = reinterpret_cast<Struct*>(s);
// Add the underlying object instance to a smart pointer.

View File

@@ -46,6 +46,26 @@ int CEF_CALLBACK domnode_is_element(struct _cef_domnode_t* self)
return CefDOMNodeCppToC::Get(self)->IsElement();
}
int CEF_CALLBACK domnode_is_form_control_element(struct _cef_domnode_t* self)
{
DCHECK(self);
if (!self)
return 0;
return CefDOMNodeCppToC::Get(self)->IsFormControlElement();
}
cef_string_userfree_t CEF_CALLBACK domnode_get_form_control_element_type(
struct _cef_domnode_t* self)
{
DCHECK(self);
if (!self)
return NULL;
CefString str = CefDOMNodeCppToC::Get(self)->GetFormControlElementType();
return str.DetachToUserFree();
}
int CEF_CALLBACK domnode_is_same(struct _cef_domnode_t* self,
struct _cef_domnode_t* that)
{
@@ -292,6 +312,9 @@ CefDOMNodeCppToC::CefDOMNodeCppToC(CefDOMNode* cls)
struct_.struct_.get_type = domnode_get_type;
struct_.struct_.is_text = domnode_is_text;
struct_.struct_.is_element = domnode_is_element;
struct_.struct_.is_form_control_element = domnode_is_form_control_element;
struct_.struct_.get_form_control_element_type =
domnode_get_form_control_element_type;
struct_.struct_.is_same = domnode_is_same;
struct_.struct_.get_name = domnode_get_name;
struct_.struct_.get_value = domnode_get_value;

View File

@@ -12,6 +12,8 @@
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
#include "libcef_dll/ctocpp/frame_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
@@ -40,6 +42,21 @@ int CEF_CALLBACK focus_handler_on_set_focus(struct _cef_focus_handler_t* self,
CefBrowserCToCpp::Wrap(browser), source);
}
void CEF_CALLBACK focus_handler_on_focused_node_changed(
struct _cef_focus_handler_t* self, cef_browser_t* browser,
cef_frame_t* frame, struct _cef_domnode_t* node)
{
DCHECK(self);
DCHECK(browser);
DCHECK(frame);
if (!self || !browser || !frame)
return;
return CefFocusHandlerCppToC::Get(self)->OnFocusedNodeChanged(
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
CefDOMNodeCToCpp::Wrap(node));
}
// CONSTRUCTOR - Do not edit by hand.
@@ -49,6 +66,8 @@ CefFocusHandlerCppToC::CefFocusHandlerCppToC(CefFocusHandler* cls)
{
struct_.struct_.on_take_focus = focus_handler_on_take_focus;
struct_.struct_.on_set_focus = focus_handler_on_set_focus;
struct_.struct_.on_focused_node_changed =
focus_handler_on_focused_node_changed;
}
#ifndef NDEBUG