Add support for accessing and modifying the DOM (issue #60).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@191 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-02-23 03:45:13 +00:00
parent 04bce7acad
commit 60736ac4e0
47 changed files with 3996 additions and 3 deletions

View File

@@ -0,0 +1,242 @@
// Copyright (c) 2010 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/domdocument_cpptoc.h"
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
enum cef_dom_document_type_t CEF_CALLBACK domdocument_get_type(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return DOM_DOCUMENT_TYPE_UNKNOWN;
return CefDOMDocumentCppToC::Get(self)->GetType();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_document(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr =
CefDOMDocumentCppToC::Get(self)->GetDocument();
if (nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_body(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMDocumentCppToC::Get(self)->GetBody();
if (nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_head(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr = CefDOMDocumentCppToC::Get(self)->GetHead();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_title(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetTitle();
return str.DetachToUserFree();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_element_by_id(
struct _cef_domdocument_t* self, const cef_string_t* id)
{
DCHECK(self);
DCHECK(id);
if(!self || !id)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetElementById(CefString(id));
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_focused_node(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetFocusedNode();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
int CEF_CALLBACK domdocument_has_selection(struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
return CefDOMDocumentCppToC::Get(self)->HasSelection();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_start_node(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetSelectionStartNode();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
int CEF_CALLBACK domdocument_get_selection_start_offset(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
return CefDOMDocumentCppToC::Get(self)->GetSelectionStartOffset();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_end_node(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetSelectionEndNode();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
int CEF_CALLBACK domdocument_get_selection_end_offset(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
return CefDOMDocumentCppToC::Get(self)->GetSelectionEndOffset();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_markup(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetSelectionAsMarkup();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_text(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetSelectionAsText();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_base_url(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetBaseURL();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_complete_url(
struct _cef_domdocument_t* self, const cef_string_t* partialURL)
{
DCHECK(self);
if(!self)
return NULL;
CefString str =
CefDOMDocumentCppToC::Get(self)->GetCompleteURL(CefString(partialURL));
return str.DetachToUserFree();
}
// CONSTRUCTOR - Do not edit by hand.
CefDOMDocumentCppToC::CefDOMDocumentCppToC(CefDOMDocument* cls)
: CefCppToC<CefDOMDocumentCppToC, CefDOMDocument, cef_domdocument_t>(cls)
{
struct_.struct_.get_type = domdocument_get_type;
struct_.struct_.get_document = domdocument_get_document;
struct_.struct_.get_body = domdocument_get_body;
struct_.struct_.get_head = domdocument_get_head;
struct_.struct_.get_title = domdocument_get_title;
struct_.struct_.get_element_by_id = domdocument_get_element_by_id;
struct_.struct_.get_focused_node = domdocument_get_focused_node;
struct_.struct_.has_selection = domdocument_has_selection;
struct_.struct_.get_selection_start_node =
domdocument_get_selection_start_node;
struct_.struct_.get_selection_start_offset =
domdocument_get_selection_start_offset;
struct_.struct_.get_selection_end_node = domdocument_get_selection_end_node;
struct_.struct_.get_selection_end_offset =
domdocument_get_selection_end_offset;
struct_.struct_.get_selection_as_markup = domdocument_get_selection_as_markup;
struct_.struct_.get_selection_as_text = domdocument_get_selection_as_text;
struct_.struct_.get_base_url = domdocument_get_base_url;
struct_.struct_.get_complete_url = domdocument_get_complete_url;
}
#ifdef _DEBUG
template<> long CefCppToC<CefDOMDocumentCppToC, CefDOMDocument,
cef_domdocument_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2010 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 and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _DOMDOCUMENT_CPPTOC_H
#define _DOMDOCUMENT_CPPTOC_H
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefDOMDocumentCppToC
: public CefCppToC<CefDOMDocumentCppToC, CefDOMDocument, cef_domdocument_t>
{
public:
CefDOMDocumentCppToC(CefDOMDocument* cls);
virtual ~CefDOMDocumentCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // _DOMDOCUMENT_CPPTOC_H

View File

@@ -0,0 +1,129 @@
// Copyright (c) 2010 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/domdocument_cpptoc.h"
#include "libcef_dll/cpptoc/domevent_cpptoc.h"
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK domevent_get_type(
struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMEventCppToC::Get(self)->GetType();
return str.DetachToUserFree();
}
enum cef_dom_event_category_t CEF_CALLBACK domevent_get_category(
struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return DOM_EVENT_CATEGORY_UNKNOWN;
return CefDOMEventCppToC::Get(self)->GetCategory();
}
enum cef_dom_event_phase_t CEF_CALLBACK domevent_get_phase(
struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return DOM_EVENT_PHASE_UNKNOWN;
return CefDOMEventCppToC::Get(self)->GetPhase();
}
int CEF_CALLBACK domevent_can_bubble(struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefDOMEventCppToC::Get(self)->CanBubble();
}
int CEF_CALLBACK domevent_can_cancel(struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefDOMEventCppToC::Get(self)->CanCancel();
}
cef_domdocument_t* CEF_CALLBACK domevent_get_document(
struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMDocument> documentPtr =
CefDOMEventCppToC::Get(self)->GetDocument();
if (documentPtr.get())
return CefDOMDocumentCppToC::Wrap(documentPtr);
return NULL;
}
cef_domnode_t* CEF_CALLBACK domevent_get_target(struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMEventCppToC::Get(self)->GetTarget();
if (nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
cef_domnode_t* CEF_CALLBACK domevent_get_current_target(
struct _cef_domevent_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr =
CefDOMEventCppToC::Get(self)->GetCurrentTarget();
if (nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
// CONSTRUCTOR - Do not edit by hand.
CefDOMEventCppToC::CefDOMEventCppToC(CefDOMEvent* cls)
: CefCppToC<CefDOMEventCppToC, CefDOMEvent, cef_domevent_t>(cls)
{
struct_.struct_.get_type = domevent_get_type;
struct_.struct_.get_category = domevent_get_category;
struct_.struct_.get_phase = domevent_get_phase;
struct_.struct_.can_bubble = domevent_can_bubble;
struct_.struct_.can_cancel = domevent_can_cancel;
struct_.struct_.get_document = domevent_get_document;
struct_.struct_.get_target = domevent_get_target;
struct_.struct_.get_current_target = domevent_get_current_target;
}
#ifdef _DEBUG
template<> long CefCppToC<CefDOMEventCppToC, CefDOMEvent,
cef_domevent_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2010 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 and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _DOMEVENT_CPPTOC_H
#define _DOMEVENT_CPPTOC_H
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefDOMEventCppToC
: public CefCppToC<CefDOMEventCppToC, CefDOMEvent, cef_domevent_t>
{
public:
CefDOMEventCppToC(CefDOMEvent* cls);
virtual ~CefDOMEventCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // _DOMEVENT_CPPTOC_H

View File

@@ -0,0 +1,47 @@
// Copyright (c) 2010 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/domevent_listener_cpptoc.h"
#include "libcef_dll/ctocpp/domevent_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK domevent_listener_handle_event(
struct _cef_domevent_listener_t* self, cef_domevent_t* event)
{
DCHECK(self);
if(!self)
return;
CefRefPtr<CefDOMEvent> eventPtr;
if (event)
eventPtr = CefDOMEventCToCpp::Wrap(event);
CefDOMEventListenerCppToC::Get(self)->HandleEvent(eventPtr);
}
// CONSTRUCTOR - Do not edit by hand.
CefDOMEventListenerCppToC::CefDOMEventListenerCppToC(CefDOMEventListener* cls)
: CefCppToC<CefDOMEventListenerCppToC, CefDOMEventListener,
cef_domevent_listener_t>(cls)
{
struct_.struct_.handle_event = domevent_listener_handle_event;
}
#ifdef _DEBUG
template<> long CefCppToC<CefDOMEventListenerCppToC, CefDOMEventListener,
cef_domevent_listener_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2010 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 and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _DOMEVENTLISTENER_CPPTOC_H
#define _DOMEVENTLISTENER_CPPTOC_H
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefDOMEventListenerCppToC
: public CefCppToC<CefDOMEventListenerCppToC, CefDOMEventListener,
cef_domevent_listener_t>
{
public:
CefDOMEventListenerCppToC(CefDOMEventListener* cls);
virtual ~CefDOMEventListenerCppToC() {}
};
#endif // USING_CEF_SHARED
#endif // _DOMEVENTLISTENER_CPPTOC_H

View File

@@ -0,0 +1,309 @@
// Copyright (c) 2010 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/domdocument_cpptoc.h"
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
#include "libcef_dll/ctocpp/domevent_listener_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
enum cef_dom_node_type_t CEF_CALLBACK domnode_get_type(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return DOM_NODE_TYPE_UNSUPPORTED;
return CefDOMNodeCppToC::Get(self)->GetType();
}
int CEF_CALLBACK domnode_is_text(struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefDOMNodeCppToC::Get(self)->IsText();
}
int CEF_CALLBACK domnode_is_element(struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefDOMNodeCppToC::Get(self)->IsElement();
}
cef_string_userfree_t CEF_CALLBACK domnode_get_name(struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMNodeCppToC::Get(self)->GetName();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domnode_get_value(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMNodeCppToC::Get(self)->GetValue();
return str.DetachToUserFree();
}
int CEF_CALLBACK domnode_set_value(struct _cef_domnode_t* self,
const cef_string_t* value)
{
DCHECK(self);
DCHECK(value);
if(!self || !value)
return 0;
return CefDOMNodeCppToC::Get(self)->SetValue(CefString(value));
}
cef_string_userfree_t CEF_CALLBACK domnode_get_as_markup(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMNodeCppToC::Get(self)->GetAsMarkup();
return str.DetachToUserFree();
}
cef_domdocument_t* CEF_CALLBACK domnode_get_document(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMDocument> documentPtr =
CefDOMNodeCppToC::Get(self)->GetDocument();
if(documentPtr.get())
return CefDOMDocumentCppToC::Wrap(documentPtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domnode_get_parent(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMNodeCppToC::Get(self)->GetParent();
if(nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domnode_get_previous_sibling(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr =
CefDOMNodeCppToC::Get(self)->GetPreviousSibling();
if(nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domnode_get_next_sibling(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMNodeCppToC::Get(self)->GetNextSibling();
if(nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
int CEF_CALLBACK domnode_has_children(struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefDOMNodeCppToC::Get(self)->HasChildren();
}
struct _cef_domnode_t* CEF_CALLBACK domnode_get_first_child(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMNodeCppToC::Get(self)->GetFirstChild();
if(nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domnode_get_last_child(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMNodeCppToC::Get(self)->GetLastChild();
if(nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
void CEF_CALLBACK domnode_add_event_listener(struct _cef_domnode_t* self,
const cef_string_t* eventType, struct _cef_domevent_listener_t* listener,
int useCapture)
{
DCHECK(self);
DCHECK(eventType);
DCHECK(listener);
if(!self || !eventType || !listener)
return;
CefDOMNodeCppToC::Get(self)->AddEventListener(CefString(eventType),
CefDOMEventListenerCToCpp::Wrap(listener), useCapture?true:false);
}
cef_string_userfree_t CEF_CALLBACK domnode_get_element_tag_name(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMNodeCppToC::Get(self)->GetElementTagName();
return str.DetachToUserFree();
}
int CEF_CALLBACK domnode_has_element_attributes(struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefDOMNodeCppToC::Get(self)->HasElementAttributes();
}
int CEF_CALLBACK domnode_has_element_attribute(struct _cef_domnode_t* self,
const cef_string_t* attrName)
{
DCHECK(self);
DCHECK(attrName);
if(!self || !attrName)
return 0;
return CefDOMNodeCppToC::Get(self)->HasElementAttribute(CefString(attrName));
}
cef_string_userfree_t CEF_CALLBACK domnode_get_element_attribute(
struct _cef_domnode_t* self, const cef_string_t* attrName)
{
DCHECK(self);
DCHECK(attrName);
if(!self || !attrName)
return NULL;
CefString str =
CefDOMNodeCppToC::Get(self)->GetElementAttribute(CefString(attrName));
return str.DetachToUserFree();
}
void CEF_CALLBACK domnode_get_element_attributes(struct _cef_domnode_t* self,
cef_string_map_t attrMap)
{
DCHECK(self);
if(!self)
return;
CefDOMNode::AttributeMap map;
CefDOMNodeCppToC::Get(self)->GetElementAttributes(map);
transfer_string_map_contents(map, attrMap);
}
int CEF_CALLBACK domnode_set_element_attribute(struct _cef_domnode_t* self,
const cef_string_t* attrName, const cef_string_t* value)
{
DCHECK(self);
DCHECK(attrName);
DCHECK(value);
if(!self || !attrName || !value)
return 0;
return CefDOMNodeCppToC::Get(self)->SetElementAttribute(CefString(attrName),
CefString(value));
}
cef_string_userfree_t CEF_CALLBACK domnode_get_element_inner_text(
struct _cef_domnode_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMNodeCppToC::Get(self)->GetElementInnerText();
return str.DetachToUserFree();
}
// CONSTRUCTOR - Do not edit by hand.
CefDOMNodeCppToC::CefDOMNodeCppToC(CefDOMNode* cls)
: CefCppToC<CefDOMNodeCppToC, CefDOMNode, cef_domnode_t>(cls)
{
struct_.struct_.get_type = domnode_get_type;
struct_.struct_.is_text = domnode_is_text;
struct_.struct_.is_element = domnode_is_element;
struct_.struct_.get_name = domnode_get_name;
struct_.struct_.get_value = domnode_get_value;
struct_.struct_.set_value = domnode_set_value;
struct_.struct_.get_as_markup = domnode_get_as_markup;
struct_.struct_.get_document = domnode_get_document;
struct_.struct_.get_parent = domnode_get_parent;
struct_.struct_.get_previous_sibling = domnode_get_previous_sibling;
struct_.struct_.get_next_sibling = domnode_get_next_sibling;
struct_.struct_.has_children = domnode_has_children;
struct_.struct_.get_first_child = domnode_get_first_child;
struct_.struct_.get_last_child = domnode_get_last_child;
struct_.struct_.add_event_listener = domnode_add_event_listener;
struct_.struct_.get_element_tag_name = domnode_get_element_tag_name;
struct_.struct_.has_element_attributes = domnode_has_element_attributes;
struct_.struct_.has_element_attribute = domnode_has_element_attribute;
struct_.struct_.get_element_attribute = domnode_get_element_attribute;
struct_.struct_.get_element_attributes = domnode_get_element_attributes;
struct_.struct_.set_element_attribute = domnode_set_element_attribute;
struct_.struct_.get_element_inner_text = domnode_get_element_inner_text;
}
#ifdef _DEBUG
template<> long CefCppToC<CefDOMNodeCppToC, CefDOMNode,
cef_domnode_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2010 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 and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _DOMNODE_CPPTOC_H
#define _DOMNODE_CPPTOC_H
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefDOMNodeCppToC
: public CefCppToC<CefDOMNodeCppToC, CefDOMNode, cef_domnode_t>
{
public:
CefDOMNodeCppToC(CefDOMNode* cls);
virtual ~CefDOMNodeCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // _DOMNODE_CPPTOC_H

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2010 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/domvisitor_cpptoc.h"
#include "libcef_dll/ctocpp/domdocument_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK domvisitor_visit(struct _cef_domvisitor_t* self,
struct _cef_domdocument_t* document)
{
DCHECK(self);
if(!self)
return;
CefRefPtr<CefDOMDocument> documentPtr;
if (document)
documentPtr = CefDOMDocumentCToCpp::Wrap(document);
CefDOMVisitorCppToC::Get(self)->Visit(documentPtr);
}
// CONSTRUCTOR - Do not edit by hand.
CefDOMVisitorCppToC::CefDOMVisitorCppToC(CefDOMVisitor* cls)
: CefCppToC<CefDOMVisitorCppToC, CefDOMVisitor, cef_domvisitor_t>(cls)
{
struct_.struct_.visit = domvisitor_visit;
}
#ifdef _DEBUG
template<> long CefCppToC<CefDOMVisitorCppToC, CefDOMVisitor,
cef_domvisitor_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2010 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 and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _DOMVISITOR_CPPTOC_H
#define _DOMVISITOR_CPPTOC_H
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefDOMVisitorCppToC
: public CefCppToC<CefDOMVisitorCppToC, CefDOMVisitor, cef_domvisitor_t>
{
public:
CefDOMVisitorCppToC(CefDOMVisitor* cls);
virtual ~CefDOMVisitorCppToC() {}
};
#endif // USING_CEF_SHARED
#endif // _DOMVISITOR_CPPTOC_H

View File

@@ -14,6 +14,7 @@
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/request_cpptoc.h"
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
#include "libcef_dll/ctocpp/domvisitor_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
@@ -225,6 +226,17 @@ cef_browser_t* CEF_CALLBACK frame_get_browser(struct _cef_frame_t* self)
return NULL;
}
void CEF_CALLBACK frame_visit_dom(struct _cef_frame_t* self,
struct _cef_domvisitor_t* visitor)
{
DCHECK(self);
DCHECK(visitor);
if(!self || !visitor)
return;
CefFrameCppToC::Get(self)->VisitDOM(CefDOMVisitorCToCpp::Wrap(visitor));
}
// CONSTRUCTOR - Do not edit by hand.
@@ -252,6 +264,7 @@ CefFrameCppToC::CefFrameCppToC(CefFrame* cls)
struct_.struct_.get_name = frame_get_name;
struct_.struct_.get_url = frame_get_url;
struct_.struct_.get_browser = frame_get_browser;
struct_.struct_.visit_dom = frame_visit_dom;
}
#ifdef _DEBUG