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:
parent
04bce7acad
commit
60736ac4e0
27
cef.gyp
27
cef.gyp
|
@ -179,6 +179,7 @@
|
|||
'libcef_dll_wrapper',
|
||||
],
|
||||
'sources': [
|
||||
'tests/unittests/dom_unittest.cc',
|
||||
'tests/unittests/request_unittest.cc',
|
||||
'tests/unittests/run_all_unittests.cc',
|
||||
'tests/unittests/stream_unittest.cc',
|
||||
|
@ -302,6 +303,12 @@
|
|||
'libcef_dll/cpptoc/browser_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/browser_cpptoc.h',
|
||||
'libcef_dll/cpptoc/cpptoc.h',
|
||||
'libcef_dll/cpptoc/domdocument_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domdocument_cpptoc.h',
|
||||
'libcef_dll/cpptoc/domevent_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domevent_cpptoc.h',
|
||||
'libcef_dll/cpptoc/domnode_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domnode_cpptoc.h',
|
||||
'libcef_dll/cpptoc/frame_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/frame_cpptoc.h',
|
||||
'libcef_dll/cpptoc/post_data_cpptoc.cc',
|
||||
|
@ -327,6 +334,10 @@
|
|||
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/zip_reader_cpptoc.h',
|
||||
'libcef_dll/ctocpp/ctocpp.h',
|
||||
'libcef_dll/ctocpp/domevent_listener_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domevent_listener_ctocpp.h',
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/download_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/download_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/handler_ctocpp.cc',
|
||||
|
@ -390,6 +401,10 @@
|
|||
'include/cef_wrapper.h',
|
||||
'libcef_dll/cef_logging.h',
|
||||
'libcef_dll/cpptoc/cpptoc.h',
|
||||
'libcef_dll/cpptoc/domevent_listener_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domevent_listener_cpptoc.h',
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/download_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/download_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/handler_cpptoc.cc',
|
||||
|
@ -411,6 +426,12 @@
|
|||
'libcef_dll/ctocpp/browser_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/browser_ctocpp.h',
|
||||
'libcef_dll/ctocpp/ctocpp.h',
|
||||
'libcef_dll/ctocpp/domdocument_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domdocument_ctocpp.h',
|
||||
'libcef_dll/ctocpp/domevent_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domevent_ctocpp.h',
|
||||
'libcef_dll/ctocpp/domnode_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domnode_ctocpp.h',
|
||||
'libcef_dll/ctocpp/frame_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/frame_ctocpp.h',
|
||||
'libcef_dll/ctocpp/post_data_ctocpp.cc',
|
||||
|
@ -565,6 +586,12 @@
|
|||
'libcef/dom_storage_context.h',
|
||||
'libcef/dom_storage_namespace.cc',
|
||||
'libcef/dom_storage_namespace.h',
|
||||
'libcef/dom_document_impl.cc',
|
||||
'libcef/dom_document_impl.h',
|
||||
'libcef/dom_event_impl.cc',
|
||||
'libcef/dom_event_impl.h',
|
||||
'libcef/dom_node_impl.cc',
|
||||
'libcef/dom_node_impl.h',
|
||||
'libcef/external_protocol_handler.h',
|
||||
'libcef/http_header_utils.cc',
|
||||
'libcef/http_header_utils.h',
|
||||
|
|
272
include/cef.h
272
include/cef.h
|
@ -46,6 +46,11 @@
|
|||
|
||||
class CefBrowser;
|
||||
class CefBrowserSettings;
|
||||
class CefDOMDocument;
|
||||
class CefDOMEvent;
|
||||
class CefDOMEventListener;
|
||||
class CefDOMNode;
|
||||
class CefDOMVisitor;
|
||||
class CefDownloadHandler;
|
||||
class CefFrame;
|
||||
class CefHandler;
|
||||
|
@ -574,6 +579,10 @@ public:
|
|||
// Returns the browser that this frame belongs to.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser() =0;
|
||||
|
||||
// Visit the DOM document.
|
||||
/*--cef()--*/
|
||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) =0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1621,7 +1630,7 @@ public:
|
|||
// namespace URI.
|
||||
/*--cef(capi_name=get_attribute_bylname)--*/
|
||||
virtual CefString GetAttribute(const CefString& localName,
|
||||
const CefString& namespaceURI) =0;
|
||||
const CefString& namespaceURI) =0;
|
||||
|
||||
// Returns an XML representation of the current node's children.
|
||||
/*--cef()--*/
|
||||
|
@ -1746,6 +1755,267 @@ public:
|
|||
};
|
||||
|
||||
|
||||
// Interface to implement for visiting the DOM. The methods of this class will
|
||||
// be called on the UI thread.
|
||||
/*--cef(source=client)--*/
|
||||
class CefDOMVisitor : public CefBase
|
||||
{
|
||||
public:
|
||||
// Method executed for visiting the DOM. The document object passed to this
|
||||
// method represents a snapshot of the DOM at the time this method is
|
||||
// executed. DOM objects are only valid for the scope of this method. Do not
|
||||
// keep references to or attempt to access any DOM objects outside the scope
|
||||
// of this method.
|
||||
/*--cef()--*/
|
||||
virtual void Visit(CefRefPtr<CefDOMDocument> document) =0;
|
||||
};
|
||||
|
||||
|
||||
// Class used to represent a DOM document. The methods of this class should only
|
||||
// be called on the UI thread.
|
||||
/*--cef(source=library)--*/
|
||||
class CefDOMDocument : public CefBase
|
||||
{
|
||||
public:
|
||||
typedef cef_dom_document_type_t Type;
|
||||
|
||||
// Returns the document type.
|
||||
/*--cef()--*/
|
||||
virtual Type GetType() =0;
|
||||
|
||||
// Returns the root document node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetDocument() =0;
|
||||
|
||||
// Returns the BODY node of an HTML document.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetBody() =0;
|
||||
|
||||
// Returns the HEAD node of an HTML document.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetHead() =0;
|
||||
|
||||
// Returns the title of an HTML document.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetTitle() =0;
|
||||
|
||||
// Returns the document element with the specified ID value.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id) =0;
|
||||
|
||||
// Returns the node that currently has keyboard focus.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetFocusedNode() =0;
|
||||
|
||||
// Returns true if a portion of the document is selected.
|
||||
/*--cef()--*/
|
||||
virtual bool HasSelection() =0;
|
||||
|
||||
// Returns the selection start node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode() =0;
|
||||
|
||||
// Returns the selection offset within the start node.
|
||||
/*--cef()--*/
|
||||
virtual int GetSelectionStartOffset() =0;
|
||||
|
||||
// Returns the selection end node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode() =0;
|
||||
|
||||
// Returns the selection offset within the end node.
|
||||
/*--cef()--*/
|
||||
virtual int GetSelectionEndOffset() =0;
|
||||
|
||||
// Returns the contents of this selection as markup.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetSelectionAsMarkup() =0;
|
||||
|
||||
// Returns the contents of this selection as text.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetSelectionAsText() =0;
|
||||
|
||||
// Returns the base URL for the document.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetBaseURL() =0;
|
||||
|
||||
// Returns a complete URL based on the document base URL and the specified
|
||||
// partial URL.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetCompleteURL(const CefString& partialURL) =0;
|
||||
};
|
||||
|
||||
|
||||
// Class used to represent a DOM node. The methods of this class should only be
|
||||
// called on the UI thread.
|
||||
/*--cef(source=library)--*/
|
||||
class CefDOMNode : public CefBase
|
||||
{
|
||||
public:
|
||||
typedef std::map<CefString,CefString> AttributeMap;
|
||||
typedef cef_dom_node_type_t Type;
|
||||
|
||||
// Returns the type for this node.
|
||||
/*--cef()--*/
|
||||
virtual Type GetType() =0;
|
||||
|
||||
// Returns true if this is a text node.
|
||||
/*--cef()--*/
|
||||
virtual bool IsText() =0;
|
||||
|
||||
// Returns true if this is an element node.
|
||||
/*--cef()--*/
|
||||
virtual bool IsElement() =0;
|
||||
|
||||
// Returns the name of this node.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetName() =0;
|
||||
|
||||
// Returns the value of this node.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetValue() =0;
|
||||
|
||||
// Set the value of this node. Returns true on success.
|
||||
/*--cef()--*/
|
||||
virtual bool SetValue(const CefString& value) =0;
|
||||
|
||||
// Returns the contents of this node as markup.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetAsMarkup() =0;
|
||||
|
||||
// Returns the document associated with this node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument() =0;
|
||||
|
||||
// Returns the parent node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetParent() =0;
|
||||
|
||||
// Returns the previous sibling node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetPreviousSibling() =0;
|
||||
|
||||
// Returns the next sibling node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetNextSibling() =0;
|
||||
|
||||
// Returns true if this node has child nodes.
|
||||
/*--cef()--*/
|
||||
virtual bool HasChildren() =0;
|
||||
|
||||
// Return the first child node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetFirstChild() =0;
|
||||
|
||||
// Returns the last child node.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetLastChild() =0;
|
||||
|
||||
// Add an event listener to this node for the specified event type. If
|
||||
// |useCapture| is true then this listener will be considered a capturing
|
||||
// listener. Capturing listeners will recieve all events of the specified
|
||||
// type before the events are dispatched to any other event targets beneath
|
||||
// the current node in the tree. Events which are bubbling upwards through
|
||||
// the tree will not trigger a capturing listener. Separate calls to this
|
||||
// method can be used to register the same listener with and without capture.
|
||||
// See WebCore/dom/EventNames.h for the list of supported event types.
|
||||
/*--cef()--*/
|
||||
virtual void AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener,
|
||||
bool useCapture) =0;
|
||||
|
||||
// The following methods are valid only for element nodes.
|
||||
|
||||
// Returns the tag name of this element.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetElementTagName() =0;
|
||||
|
||||
// Returns true if this element has attributes.
|
||||
/*--cef()--*/
|
||||
virtual bool HasElementAttributes() =0;
|
||||
|
||||
// Returns true if this element has an attribute named |attrName|.
|
||||
/*--cef()--*/
|
||||
virtual bool HasElementAttribute(const CefString& attrName) =0;
|
||||
|
||||
// Returns the element attribute named |attrName|.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetElementAttribute(const CefString& attrName) =0;
|
||||
|
||||
// Returns a map of all element attributes.
|
||||
/*--cef()--*/
|
||||
virtual void GetElementAttributes(AttributeMap& attrMap) =0;
|
||||
|
||||
// Set the value for the element attribute named |attrName|. Returns true on
|
||||
// success.
|
||||
/*--cef()--*/
|
||||
virtual bool SetElementAttribute(const CefString& attrName,
|
||||
const CefString& value) =0;
|
||||
|
||||
// Returns the inner text of the element.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetElementInnerText() =0;
|
||||
};
|
||||
|
||||
|
||||
// Class used to represent a DOM event. The methods of this class should only
|
||||
// be called on the UI thread.
|
||||
/*--cef(source=library)--*/
|
||||
class CefDOMEvent : public CefBase
|
||||
{
|
||||
public:
|
||||
typedef cef_dom_event_category_t Category;
|
||||
typedef cef_dom_event_phase_t Phase;
|
||||
|
||||
// Returns the event type.
|
||||
/*--cef()--*/
|
||||
virtual CefString GetType() =0;
|
||||
|
||||
// Returns the event category.
|
||||
/*--cef()--*/
|
||||
virtual Category GetCategory() =0;
|
||||
|
||||
// Returns the event processing phase.
|
||||
/*--cef()--*/
|
||||
virtual Phase GetPhase() =0;
|
||||
|
||||
// Returns true if the event can bubble up the tree.
|
||||
/*--cef()--*/
|
||||
virtual bool CanBubble() =0;
|
||||
|
||||
// Returns true if the event can be canceled.
|
||||
/*--cef()--*/
|
||||
virtual bool CanCancel() =0;
|
||||
|
||||
// Returns the document associated with this event.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument() =0;
|
||||
|
||||
// Returns the target of the event.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetTarget() =0;
|
||||
|
||||
// Returns the current target of the event.
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget() =0;
|
||||
};
|
||||
|
||||
|
||||
// Interface to implement for handling DOM events. The methods of this class
|
||||
// will be called on the UI thread.
|
||||
/*--cef(source=client)--*/
|
||||
class CefDOMEventListener : public CefBase
|
||||
{
|
||||
public:
|
||||
// Called when an event is received. The event object passed to this method
|
||||
// contains a snapshot of the DOM at the time this method is executed. DOM
|
||||
// objects are only valid for the scope of this method. Do not keep references
|
||||
// to or attempt to access any DOM objects outside the scope of this method.
|
||||
/*--cef()--*/
|
||||
virtual void HandleEvent(CefRefPtr<CefDOMEvent> event) =0;
|
||||
};
|
||||
|
||||
|
||||
// Class representing popup window features.
|
||||
class CefPopupFeatures : public cef_popup_features_t
|
||||
{
|
||||
|
|
|
@ -398,6 +398,10 @@ typedef struct _cef_frame_t
|
|||
// Returns the browser that this frame belongs to.
|
||||
struct _cef_browser_t* (CEF_CALLBACK *get_browser)(struct _cef_frame_t* self);
|
||||
|
||||
// Visit the DOM document.
|
||||
void (CEF_CALLBACK *visit_dom)(struct _cef_frame_t* self,
|
||||
struct _cef_domvisitor_t* visitor);
|
||||
|
||||
} cef_frame_t;
|
||||
|
||||
|
||||
|
@ -1472,6 +1476,270 @@ typedef struct _cef_zip_reader_t
|
|||
CEF_EXPORT cef_zip_reader_t* cef_zip_reader_create(cef_stream_reader_t* stream);
|
||||
|
||||
|
||||
// Structure to implement for visiting the DOM. The functions of this structure
|
||||
// will be called on the UI thread.
|
||||
typedef struct _cef_domvisitor_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Method executed for visiting the DOM. The document object passed to this
|
||||
// function represents a snapshot of the DOM at the time this function is
|
||||
// executed. DOM objects are only valid for the scope of this function. Do not
|
||||
// keep references to or attempt to access any DOM objects outside the scope
|
||||
// of this function.
|
||||
void (CEF_CALLBACK *visit)(struct _cef_domvisitor_t* self,
|
||||
struct _cef_domdocument_t* document);
|
||||
|
||||
} cef_domvisitor_t;
|
||||
|
||||
|
||||
// Structure used to represent a DOM document. The functions of this structure
|
||||
// should only be called on the UI thread.
|
||||
typedef struct _cef_domdocument_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Returns the document type.
|
||||
enum cef_dom_document_type_t (CEF_CALLBACK *get_type)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the root document node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_document)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the BODY node of an HTML document.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_body)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the HEAD node of an HTML document.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_head)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the title of an HTML document.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_title)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the document element with the specified ID value.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_element_by_id)(
|
||||
struct _cef_domdocument_t* self, const cef_string_t* id);
|
||||
|
||||
// Returns the node that currently has keyboard focus.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_focused_node)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns true (1) if a portion of the document is selected.
|
||||
int (CEF_CALLBACK *has_selection)(struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the selection start node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_selection_start_node)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the selection offset within the start node.
|
||||
int (CEF_CALLBACK *get_selection_start_offset)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the selection end node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_selection_end_node)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the selection offset within the end node.
|
||||
int (CEF_CALLBACK *get_selection_end_offset)(struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the contents of this selection as markup.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_selection_as_markup)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the contents of this selection as text.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_selection_as_text)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns the base URL for the document.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_base_url)(
|
||||
struct _cef_domdocument_t* self);
|
||||
|
||||
// Returns a complete URL based on the document base URL and the specified
|
||||
// partial URL.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_complete_url)(
|
||||
struct _cef_domdocument_t* self, const cef_string_t* partialURL);
|
||||
|
||||
} cef_domdocument_t;
|
||||
|
||||
|
||||
// Structure used to represent a DOM node. The functions of this structure
|
||||
// should only be called on the UI thread.
|
||||
typedef struct _cef_domnode_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Returns the type for this node.
|
||||
enum cef_dom_node_type_t (CEF_CALLBACK *get_type)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns true (1) if this is a text node.
|
||||
int (CEF_CALLBACK *is_text)(struct _cef_domnode_t* self);
|
||||
|
||||
// Returns true (1) if this is an element node.
|
||||
int (CEF_CALLBACK *is_element)(struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the name of this node.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_name)(struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the value of this node.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_value)(struct _cef_domnode_t* self);
|
||||
|
||||
// Set the value of this node. Returns true (1) on success.
|
||||
int (CEF_CALLBACK *set_value)(struct _cef_domnode_t* self,
|
||||
const cef_string_t* value);
|
||||
|
||||
// Returns the contents of this node as markup.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_as_markup)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the document associated with this node.
|
||||
struct _cef_domdocument_t* (CEF_CALLBACK *get_document)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the parent node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_parent)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the previous sibling node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_previous_sibling)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the next sibling node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_next_sibling)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns true (1) if this node has child nodes.
|
||||
int (CEF_CALLBACK *has_children)(struct _cef_domnode_t* self);
|
||||
|
||||
// Return the first child node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_first_child)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns the last child node.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_last_child)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Add an event listener to this node for the specified event type. If
|
||||
// |useCapture| is true (1) then this listener will be considered a capturing
|
||||
// listener. Capturing listeners will recieve all events of the specified type
|
||||
// before the events are dispatched to any other event targets beneath the
|
||||
// current node in the tree. Events which are bubbling upwards through the
|
||||
// tree will not trigger a capturing listener. Separate calls to this function
|
||||
// can be used to register the same listener with and without capture. See
|
||||
// WebCore/dom/EventNames.h for the list of supported event types.
|
||||
void (CEF_CALLBACK *add_event_listener)(struct _cef_domnode_t* self,
|
||||
const cef_string_t* eventType, struct _cef_domevent_listener_t* listener,
|
||||
int useCapture);
|
||||
|
||||
|
||||
// The following functions are valid only for element nodes.
|
||||
|
||||
// Returns the tag name of this element.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_element_tag_name)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
// Returns true (1) if this element has attributes.
|
||||
int (CEF_CALLBACK *has_element_attributes)(struct _cef_domnode_t* self);
|
||||
|
||||
// Returns true (1) if this element has an attribute named |attrName|.
|
||||
int (CEF_CALLBACK *has_element_attribute)(struct _cef_domnode_t* self,
|
||||
const cef_string_t* attrName);
|
||||
|
||||
// Returns the element attribute named |attrName|.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_element_attribute)(
|
||||
struct _cef_domnode_t* self, const cef_string_t* attrName);
|
||||
|
||||
// Returns a map of all element attributes.
|
||||
void (CEF_CALLBACK *get_element_attributes)(struct _cef_domnode_t* self,
|
||||
cef_string_map_t attrMap);
|
||||
|
||||
// Set the value for the element attribute named |attrName|. Returns true (1)
|
||||
// on success.
|
||||
int (CEF_CALLBACK *set_element_attribute)(struct _cef_domnode_t* self,
|
||||
const cef_string_t* attrName, const cef_string_t* value);
|
||||
|
||||
// Returns the inner text of the element.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_element_inner_text)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
} cef_domnode_t;
|
||||
|
||||
|
||||
// Structure used to represent a DOM event. The functions of this structure
|
||||
// should only be called on the UI thread.
|
||||
typedef struct _cef_domevent_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Returns the event type.
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_type)(struct _cef_domevent_t* self);
|
||||
|
||||
// Returns the event category.
|
||||
enum cef_dom_event_category_t (CEF_CALLBACK *get_category)(
|
||||
struct _cef_domevent_t* self);
|
||||
|
||||
// Returns the event processing phase.
|
||||
enum cef_dom_event_phase_t (CEF_CALLBACK *get_phase)(
|
||||
struct _cef_domevent_t* self);
|
||||
|
||||
// Returns true (1) if the event can bubble up the tree.
|
||||
int (CEF_CALLBACK *can_bubble)(struct _cef_domevent_t* self);
|
||||
|
||||
// Returns true (1) if the event can be canceled.
|
||||
int (CEF_CALLBACK *can_cancel)(struct _cef_domevent_t* self);
|
||||
|
||||
// Returns the document associated with this event.
|
||||
struct _cef_domdocument_t* (CEF_CALLBACK *get_document)(
|
||||
struct _cef_domevent_t* self);
|
||||
|
||||
// Returns the target of the event.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_target)(
|
||||
struct _cef_domevent_t* self);
|
||||
|
||||
// Returns the current target of the event.
|
||||
struct _cef_domnode_t* (CEF_CALLBACK *get_current_target)(
|
||||
struct _cef_domevent_t* self);
|
||||
|
||||
} cef_domevent_t;
|
||||
|
||||
|
||||
// Structure to implement for handling DOM events. The functions of this
|
||||
// structure will be called on the UI thread.
|
||||
typedef struct _cef_domevent_listener_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Called when an event is received. The event object passed to this function
|
||||
// contains a snapshot of the DOM at the time this function is executed. DOM
|
||||
// objects are only valid for the scope of this function. Do not keep
|
||||
// references to or attempt to access any DOM objects outside the scope of
|
||||
// this function.
|
||||
void (CEF_CALLBACK *handle_event)(struct _cef_domevent_listener_t* self,
|
||||
struct _cef_domevent_t* event);
|
||||
|
||||
} cef_domevent_listener_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -600,6 +600,68 @@ typedef struct _cef_popup_features_t
|
|||
cef_string_list_t additionalFeatures;
|
||||
} cef_popup_features_t;
|
||||
|
||||
// DOM document types.
|
||||
enum cef_dom_document_type_t
|
||||
{
|
||||
DOM_DOCUMENT_TYPE_UNKNOWN = 0,
|
||||
DOM_DOCUMENT_TYPE_HTML,
|
||||
DOM_DOCUMENT_TYPE_XHTML,
|
||||
DOM_DOCUMENT_TYPE_PLUGIN,
|
||||
};
|
||||
|
||||
// DOM event category flags.
|
||||
enum cef_dom_event_category_t
|
||||
{
|
||||
DOM_EVENT_CATEGORY_UNKNOWN = 0x0,
|
||||
DOM_EVENT_CATEGORY_UI = 0x1,
|
||||
DOM_EVENT_CATEGORY_MOUSE = 0x2,
|
||||
DOM_EVENT_CATEGORY_MUTATION = 0x4,
|
||||
DOM_EVENT_CATEGORY_KEYBOARD = 0x8,
|
||||
DOM_EVENT_CATEGORY_TEXT = 0x10,
|
||||
DOM_EVENT_CATEGORY_COMPOSITION = 0x20,
|
||||
DOM_EVENT_CATEGORY_DRAG = 0x40,
|
||||
DOM_EVENT_CATEGORY_CLIPBOARD = 0x80,
|
||||
DOM_EVENT_CATEGORY_MESSAGE = 0x100,
|
||||
DOM_EVENT_CATEGORY_WHEEL = 0x200,
|
||||
DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = 0x400,
|
||||
DOM_EVENT_CATEGORY_OVERFLOW = 0x800,
|
||||
DOM_EVENT_CATEGORY_PAGE_TRANSITION = 0x1000,
|
||||
DOM_EVENT_CATEGORY_POPSTATE = 0x2000,
|
||||
DOM_EVENT_CATEGORY_PROGRESS = 0x4000,
|
||||
DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = 0x8000,
|
||||
DOM_EVENT_CATEGORY_WEBKIT_ANIMATION = 0x10000,
|
||||
DOM_EVENT_CATEGORY_WEBKIT_TRANSITION = 0x20000,
|
||||
DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000,
|
||||
};
|
||||
|
||||
// DOM event processing phases.
|
||||
enum cef_dom_event_phase_t
|
||||
{
|
||||
DOM_EVENT_PHASE_UNKNOWN = 0,
|
||||
DOM_EVENT_PHASE_CAPTURING,
|
||||
DOM_EVENT_PHASE_AT_TARGET,
|
||||
DOM_EVENT_PHASE_BUBBLING,
|
||||
};
|
||||
|
||||
// DOM node types.
|
||||
enum cef_dom_node_type_t
|
||||
{
|
||||
DOM_NODE_TYPE_UNSUPPORTED = 0,
|
||||
DOM_NODE_TYPE_ELEMENT,
|
||||
DOM_NODE_TYPE_ATTRIBUTE,
|
||||
DOM_NODE_TYPE_TEXT,
|
||||
DOM_NODE_TYPE_CDATA_SECTION,
|
||||
DOM_NODE_TYPE_ENTITY_REFERENCE,
|
||||
DOM_NODE_TYPE_ENTITY,
|
||||
DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS,
|
||||
DOM_NODE_TYPE_COMMENT,
|
||||
DOM_NODE_TYPE_DOCUMENT,
|
||||
DOM_NODE_TYPE_DOCUMENT_TYPE,
|
||||
DOM_NODE_TYPE_DOCUMENT_FRAGMENT,
|
||||
DOM_NODE_TYPE_NOTATION,
|
||||
DOM_NODE_TYPE_XPATH_NAMESPACE,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "browser_impl.h"
|
||||
#include "browser_webkit_glue.h"
|
||||
#include "browser_zoom_map.h"
|
||||
#include "dom_document_impl.h"
|
||||
#include "request_impl.h"
|
||||
#include "stream_impl.h"
|
||||
|
||||
|
@ -1127,6 +1128,61 @@ void CefBrowserImpl::UIT_CloseDevTools()
|
|||
client->browser()->UIT_CloseBrowser();
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_VisitDOM(CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMVisitor> visitor)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
WebKit::WebFrame* web_frame = UIT_GetWebFrame(frame);
|
||||
if (!web_frame)
|
||||
return;
|
||||
|
||||
// Create a CefDOMDocumentImpl object that is valid only for the scope of this
|
||||
// method.
|
||||
CefRefPtr<CefDOMDocumentImpl> documentImpl;
|
||||
const WebKit::WebDocument& document = web_frame->document();
|
||||
if (!document.isNull())
|
||||
documentImpl = new CefDOMDocumentImpl(this, web_frame);
|
||||
|
||||
visitor->Visit(documentImpl.get());
|
||||
|
||||
if (documentImpl.get())
|
||||
documentImpl->Detach();
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_AddFrameObject(WebKit::WebFrame* frame,
|
||||
CefTrackObject* tracked_object)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
CefRefPtr<CefTrackManager> manager;
|
||||
|
||||
if (!frame_objects_.empty()) {
|
||||
FrameObjectMap::const_iterator it = frame_objects_.find(frame);
|
||||
if (it != frame_objects_.end())
|
||||
manager = it->second;
|
||||
}
|
||||
|
||||
if (!manager.get()) {
|
||||
manager = new CefTrackManager();
|
||||
frame_objects_.insert(std::make_pair(frame, manager));
|
||||
}
|
||||
|
||||
manager->Add(tracked_object);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_BeforeFrameClosed(WebKit::WebFrame* frame)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
if (!frame_objects_.empty()) {
|
||||
// Remove any tracked objects associated with the frame.
|
||||
FrameObjectMap::iterator it = frame_objects_.find(frame);
|
||||
if (it != frame_objects_.end())
|
||||
frame_objects_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserImpl::set_zoom_level(double zoomLevel)
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
|
@ -1197,3 +1253,14 @@ bool CefFrameImpl::IsFocused()
|
|||
(browser_->UIT_GetWebFrame(this) ==
|
||||
browser_->UIT_GetWebView()->focusedFrame()));
|
||||
}
|
||||
|
||||
void CefFrameImpl::VisitDOM(CefRefPtr<CefDOMVisitor> visitor)
|
||||
{
|
||||
if(!visitor.get()) {
|
||||
NOTREACHED();
|
||||
return;
|
||||
}
|
||||
CefRefPtr<CefFrame> framePtr(this);
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(
|
||||
browser_.get(), &CefBrowserImpl::UIT_VisitDOM, framePtr, visitor));
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "browser_webview_delegate.h"
|
||||
#include "browser_navigation_controller.h"
|
||||
#include "cef_thread.h"
|
||||
#include "tracker.h"
|
||||
#if defined(OS_WIN)
|
||||
#include "printing/win_printing_context.h"
|
||||
#endif
|
||||
|
@ -254,6 +255,14 @@ public:
|
|||
void UIT_ShowDevTools();
|
||||
void UIT_CloseDevTools();
|
||||
|
||||
void UIT_VisitDOM(CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMVisitor> visitor);
|
||||
|
||||
// Frame objects will be deleted immediately before the frame is closed.
|
||||
void UIT_AddFrameObject(WebKit::WebFrame* frame,
|
||||
CefTrackObject* tracked_object);
|
||||
void UIT_BeforeFrameClosed(WebKit::WebFrame* frame);
|
||||
|
||||
// These variables are read-only.
|
||||
const CefBrowserSettings& settings() const { return settings_; }
|
||||
const FilePath& file_system_root() const { return file_system_root_.path(); }
|
||||
|
@ -304,6 +313,10 @@ protected:
|
|||
FrameMap frames_;
|
||||
CefFrame* main_frame_;
|
||||
|
||||
typedef std::map<WebKit::WebFrame*, CefRefPtr<CefTrackManager> >
|
||||
FrameObjectMap;
|
||||
FrameObjectMap frame_objects_;
|
||||
|
||||
// Unique browser ID assigned by the context.
|
||||
int unique_id_;
|
||||
|
||||
|
@ -350,6 +363,7 @@ public:
|
|||
virtual CefString GetName() { return name_; }
|
||||
virtual CefString GetURL() { return browser_->GetURL(this); }
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser() { return browser_.get(); }
|
||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor);
|
||||
|
||||
private:
|
||||
CefRefPtr<CefBrowserImpl> browser_;
|
||||
|
|
|
@ -579,6 +579,10 @@ WebApplicationCacheHost* BrowserWebViewDelegate::createApplicationCacheHost(
|
|||
return BrowserAppCacheSystem::CreateApplicationCacheHost(client);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::willClose(WebFrame* frame) {
|
||||
browser_->UIT_BeforeFrameClosed(frame);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::loadURLExternally(
|
||||
WebFrame* frame, const WebURLRequest& request,
|
||||
WebNavigationPolicy policy) {
|
||||
|
|
|
@ -138,6 +138,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*);
|
||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client);
|
||||
virtual void willClose(WebKit::WebFrame*);
|
||||
virtual void loadURLExternally(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||
WebKit::WebNavigationPolicy);
|
||||
|
|
|
@ -0,0 +1,275 @@
|
|||
// 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.
|
||||
|
||||
#include "dom_document_impl.h"
|
||||
#include "dom_node_impl.h"
|
||||
#include "cef_thread.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
|
||||
|
||||
using WebKit::WebDocument;
|
||||
using WebKit::WebElement;
|
||||
using WebKit::WebFrame;
|
||||
using WebKit::WebNode;
|
||||
using WebKit::WebRange;
|
||||
using WebKit::WebString;
|
||||
using WebKit::WebURL;
|
||||
|
||||
|
||||
CefDOMDocumentImpl::CefDOMDocumentImpl(CefBrowserImpl* browser,
|
||||
WebFrame* frame)
|
||||
: browser_(browser), frame_(frame)
|
||||
{
|
||||
const WebDocument& document = frame_->document();
|
||||
DCHECK(!document.isNull());
|
||||
}
|
||||
|
||||
CefDOMDocumentImpl::~CefDOMDocumentImpl()
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
// Verify that the Detach() method has been called.
|
||||
DCHECK(frame_ == NULL);
|
||||
}
|
||||
|
||||
CefDOMDocumentImpl::Type CefDOMDocumentImpl::GetType()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return DOM_DOCUMENT_TYPE_UNKNOWN;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
if (document.isHTMLDocument())
|
||||
return DOM_DOCUMENT_TYPE_HTML;
|
||||
if (document.isXHTMLDocument())
|
||||
return DOM_DOCUMENT_TYPE_XHTML;
|
||||
if (document.isPluginDocument())
|
||||
return DOM_DOCUMENT_TYPE_PLUGIN;
|
||||
return DOM_DOCUMENT_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetDocument()
|
||||
{
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.document());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetBody()
|
||||
{
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.body());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetHead()
|
||||
{
|
||||
WebDocument document = frame_->document();
|
||||
return GetOrCreateNode(document.head());
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetTitle()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
const WebString& title = document.title();
|
||||
if (!title.isNull())
|
||||
str = title;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetElementById(const CefString& id)
|
||||
{
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.getElementById(string16(id)));
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode()
|
||||
{
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.focusedNode());
|
||||
}
|
||||
|
||||
bool CefDOMDocumentImpl::HasSelection()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return frame_->hasSelection();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetSelectionStartNode()
|
||||
{
|
||||
if (!VerifyContext() || !frame_->hasSelection())
|
||||
return NULL;
|
||||
|
||||
const WebRange& range = frame_->selectionRange();
|
||||
if (range.isNull())
|
||||
return NULL;
|
||||
|
||||
int exceptionCode;
|
||||
return GetOrCreateNode(range.startContainer(exceptionCode));
|
||||
}
|
||||
|
||||
int CefDOMDocumentImpl::GetSelectionStartOffset()
|
||||
{
|
||||
if (!VerifyContext() || !frame_->hasSelection())
|
||||
return 0;
|
||||
|
||||
const WebRange& range = frame_->selectionRange();
|
||||
if (range.isNull())
|
||||
return 0;
|
||||
|
||||
return range.startOffset();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetSelectionEndNode()
|
||||
{
|
||||
if (!VerifyContext() || !frame_->hasSelection())
|
||||
return NULL;
|
||||
|
||||
const WebRange& range = frame_->selectionRange();
|
||||
if (range.isNull())
|
||||
return NULL;
|
||||
|
||||
int exceptionCode;
|
||||
return GetOrCreateNode(range.endContainer(exceptionCode));
|
||||
}
|
||||
|
||||
int CefDOMDocumentImpl::GetSelectionEndOffset()
|
||||
{
|
||||
if (!VerifyContext() || !frame_->hasSelection())
|
||||
return 0;
|
||||
|
||||
const WebRange& range = frame_->selectionRange();
|
||||
if (range.isNull())
|
||||
return 0;
|
||||
|
||||
return range.endOffset();
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetSelectionAsMarkup()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext() || !frame_->hasSelection())
|
||||
return str;
|
||||
|
||||
const WebString& markup = frame_->selectionAsMarkup();
|
||||
if (!markup.isNull())
|
||||
str = markup;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetSelectionAsText()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext() || !frame_->hasSelection())
|
||||
return str;
|
||||
|
||||
const WebString& text = frame_->selectionAsText();
|
||||
if (!text.isNull())
|
||||
str = text;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetBaseURL()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
const WebURL& url = document.baseURL();
|
||||
if (!url.isNull()) {
|
||||
GURL gurl = url;
|
||||
str = gurl.spec();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL)
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
const WebURL& url = document.completeURL(string16(partialURL));
|
||||
if (!url.isNull()) {
|
||||
GURL gurl = url;
|
||||
str = gurl.spec();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetOrCreateNode(
|
||||
const WebKit::WebNode& node)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
// Nodes may potentially be null.
|
||||
if (node.isNull())
|
||||
return NULL;
|
||||
|
||||
if (!node_map_.empty()) {
|
||||
// Locate the existing node, if any.
|
||||
NodeMap::const_iterator it = node_map_.find(node);
|
||||
if (it != node_map_.end())
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// Create the new node object.
|
||||
CefRefPtr<CefDOMNode> nodeImpl(new CefDOMNodeImpl(this, node));
|
||||
node_map_.insert(std::make_pair(node, nodeImpl));
|
||||
return nodeImpl;
|
||||
}
|
||||
|
||||
void CefDOMDocumentImpl::RemoveNode(const WebKit::WebNode& node)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
|
||||
if (!node_map_.empty()) {
|
||||
NodeMap::iterator it = node_map_.find(node);
|
||||
if (it != node_map_.end())
|
||||
node_map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void CefDOMDocumentImpl::Detach()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
|
||||
if (!node_map_.empty()) {
|
||||
NodeMap::const_iterator it = node_map_.begin();
|
||||
for (; it != node_map_.end(); ++it)
|
||||
static_cast<CefDOMNodeImpl*>(it->second)->Detach();
|
||||
node_map_.clear();
|
||||
}
|
||||
|
||||
frame_ = NULL;
|
||||
}
|
||||
|
||||
bool CefDOMDocumentImpl::VerifyContext()
|
||||
{
|
||||
if(!CefThread::CurrentlyOn(CefThread::UI) || frame_ == NULL) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _DOM_DOCUMENT_IMPL_H
|
||||
#define _DOM_DOCUMENT_IMPL_H
|
||||
|
||||
#include "include/cef.h"
|
||||
#include <map>
|
||||
|
||||
namespace WebKit {
|
||||
class WebFrame;
|
||||
class WebNode;
|
||||
};
|
||||
|
||||
class CefBrowserImpl;
|
||||
|
||||
class CefDOMDocumentImpl : public CefThreadSafeBase<CefDOMDocument>
|
||||
{
|
||||
public:
|
||||
CefDOMDocumentImpl(CefBrowserImpl* browser,
|
||||
WebKit::WebFrame* frame);
|
||||
virtual ~CefDOMDocumentImpl();
|
||||
|
||||
virtual Type GetType();
|
||||
virtual CefRefPtr<CefDOMNode> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetBody();
|
||||
virtual CefRefPtr<CefDOMNode> GetHead();
|
||||
virtual CefString GetTitle();
|
||||
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id);
|
||||
virtual CefRefPtr<CefDOMNode> GetFocusedNode();
|
||||
virtual bool HasSelection();
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode();
|
||||
virtual int GetSelectionStartOffset();
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode();
|
||||
virtual int GetSelectionEndOffset();
|
||||
virtual CefString GetSelectionAsMarkup();
|
||||
virtual CefString GetSelectionAsText();
|
||||
virtual CefString GetBaseURL();
|
||||
virtual CefString GetCompleteURL(const CefString& partialURL);
|
||||
|
||||
CefBrowserImpl* GetBrowser() { return browser_; }
|
||||
WebKit::WebFrame* GetFrame() { return frame_; }
|
||||
|
||||
// The document maintains a map of all existing node objects.
|
||||
CefRefPtr<CefDOMNode> GetOrCreateNode(const WebKit::WebNode& node);
|
||||
void RemoveNode(const WebKit::WebNode& node);
|
||||
|
||||
// Must be called before the object is destroyed.
|
||||
void Detach();
|
||||
|
||||
// Verify that the object exists and is being accessed on the UI thread.
|
||||
bool VerifyContext();
|
||||
|
||||
protected:
|
||||
CefBrowserImpl* browser_;
|
||||
WebKit::WebFrame* frame_;
|
||||
|
||||
typedef std::map<WebKit::WebNode,CefDOMNode*> NodeMap;
|
||||
NodeMap node_map_;
|
||||
};
|
||||
|
||||
#endif // _DOM_DOCUMENT_IMPL_H
|
|
@ -0,0 +1,167 @@
|
|||
// 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.
|
||||
|
||||
#include "dom_event_impl.h"
|
||||
#include "cef_thread.h"
|
||||
#include "dom_document_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
||||
|
||||
using WebKit::WebDOMEvent;
|
||||
using WebKit::WebString;
|
||||
|
||||
|
||||
CefDOMEventImpl::CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const WebKit::WebDOMEvent& event)
|
||||
: document_(document), event_(event)
|
||||
{
|
||||
DCHECK(!event_.isNull());
|
||||
}
|
||||
|
||||
CefDOMEventImpl::~CefDOMEventImpl()
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
DCHECK(event_.isNull());
|
||||
}
|
||||
|
||||
CefString CefDOMEventImpl::GetType()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebString& type = event_.type();
|
||||
if (!type.isNull())
|
||||
str = type;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefDOMEventImpl::Category CefDOMEventImpl::GetCategory()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return DOM_EVENT_CATEGORY_UNKNOWN;
|
||||
|
||||
int flags = 0;
|
||||
if (event_.isUIEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_UI;
|
||||
if (event_.isMouseEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_MOUSE;
|
||||
if (event_.isMutationEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_MUTATION;
|
||||
if (event_.isKeyboardEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_KEYBOARD;
|
||||
if (event_.isTextEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_TEXT;
|
||||
if (event_.isCompositionEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_COMPOSITION;
|
||||
if (event_.isDragEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_DRAG;
|
||||
if (event_.isClipboardEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_CLIPBOARD;
|
||||
if (event_.isMessageEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_MESSAGE;
|
||||
if (event_.isWheelEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_WHEEL;
|
||||
if (event_.isBeforeTextInsertedEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED;
|
||||
if (event_.isOverflowEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_OVERFLOW;
|
||||
if (event_.isPageTransitionEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_PAGE_TRANSITION;
|
||||
if (event_.isPopStateEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_POPSTATE;
|
||||
if (event_.isProgressEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_PROGRESS;
|
||||
if (event_.isXMLHttpRequestProgressEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS;
|
||||
if (event_.isWebKitAnimationEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_WEBKIT_ANIMATION;
|
||||
if (event_.isWebKitTransitionEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_WEBKIT_TRANSITION;
|
||||
if (event_.isBeforeLoadEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_BEFORE_LOAD;
|
||||
|
||||
return static_cast<Category>(flags);
|
||||
}
|
||||
|
||||
CefDOMEventImpl::Phase CefDOMEventImpl::GetPhase()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return DOM_EVENT_PHASE_UNKNOWN;
|
||||
|
||||
switch (event_.eventPhase()) {
|
||||
case WebDOMEvent::CapturingPhase:
|
||||
return DOM_EVENT_PHASE_CAPTURING;
|
||||
case WebDOMEvent::AtTarget:
|
||||
return DOM_EVENT_PHASE_AT_TARGET;
|
||||
case WebDOMEvent::BubblingPhase:
|
||||
return DOM_EVENT_PHASE_BUBBLING;
|
||||
}
|
||||
|
||||
return DOM_EVENT_PHASE_UNKNOWN;
|
||||
}
|
||||
|
||||
bool CefDOMEventImpl::CanBubble()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return event_.bubbles();
|
||||
}
|
||||
|
||||
bool CefDOMEventImpl::CanCancel()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return event_.cancelable();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMDocument> CefDOMEventImpl::GetDocument()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_.get();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMEventImpl::GetTarget()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(event_.target());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMEventImpl::GetCurrentTarget()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(event_.currentTarget());
|
||||
}
|
||||
|
||||
void CefDOMEventImpl::Detach()
|
||||
{
|
||||
document_ = NULL;
|
||||
event_.assign(WebDOMEvent());
|
||||
}
|
||||
|
||||
bool CefDOMEventImpl::VerifyContext()
|
||||
{
|
||||
if (!document_.get()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
if (!document_->VerifyContext())
|
||||
return false;
|
||||
if(event_.isNull()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _DOM_EVENT_IMPL_H
|
||||
#define _DOM_EVENT_IMPL_H
|
||||
|
||||
#include "include/cef.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h"
|
||||
|
||||
class CefDOMDocumentImpl;
|
||||
|
||||
class CefDOMEventImpl : public CefThreadSafeBase<CefDOMEvent>
|
||||
{
|
||||
public:
|
||||
CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const WebKit::WebDOMEvent& event);
|
||||
virtual ~CefDOMEventImpl();
|
||||
|
||||
virtual CefString GetType();
|
||||
virtual Category GetCategory();
|
||||
virtual Phase GetPhase();
|
||||
virtual bool CanBubble();
|
||||
virtual bool CanCancel();
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetTarget();
|
||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget();
|
||||
|
||||
// Will be called from CefDOMEventListenerWrapper::handleEvent().
|
||||
void Detach();
|
||||
|
||||
// Verify that the object exists and is being accessed on the UI thread.
|
||||
bool VerifyContext();
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||
WebKit::WebDOMEvent event_;
|
||||
};
|
||||
|
||||
#endif // _DOM_EVENT_IMPL_H
|
|
@ -0,0 +1,424 @@
|
|||
// 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.
|
||||
|
||||
#include "dom_node_impl.h"
|
||||
#include "browser_impl.h"
|
||||
#include "cef_thread.h"
|
||||
#include "dom_document_impl.h"
|
||||
#include "dom_event_impl.h"
|
||||
#include "tracker.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEventListener.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
||||
|
||||
using WebKit::WebAttribute;
|
||||
using WebKit::WebDocument;
|
||||
using WebKit::WebDOMEvent;
|
||||
using WebKit::WebDOMEventListener;
|
||||
using WebKit::WebElement;
|
||||
using WebKit::WebFrame;
|
||||
using WebKit::WebNamedNodeMap;
|
||||
using WebKit::WebNode;
|
||||
using WebKit::WebString;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// Wrapper implementation for WebDOMEventListener.
|
||||
class CefDOMEventListenerWrapper : public WebDOMEventListener,
|
||||
public CefTrackObject
|
||||
{
|
||||
public:
|
||||
CefDOMEventListenerWrapper(CefBrowserImpl* browser, WebFrame* frame,
|
||||
CefRefPtr<CefDOMEventListener> listener)
|
||||
: browser_(browser), frame_(frame), listener_(listener)
|
||||
{
|
||||
// Cause this object to be deleted immediately before the frame is closed.
|
||||
browser->UIT_AddFrameObject(frame, this);
|
||||
}
|
||||
virtual ~CefDOMEventListenerWrapper()
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
}
|
||||
|
||||
virtual void handleEvent(const WebDOMEvent& event)
|
||||
{
|
||||
CefRefPtr<CefDOMDocumentImpl> documentImpl;
|
||||
CefRefPtr<CefDOMEventImpl> eventImpl;
|
||||
|
||||
if (!event.isNull()) {
|
||||
// Create CefDOMDocumentImpl and CefDOMEventImpl objects that are valid
|
||||
// only for the scope of this method.
|
||||
const WebDocument& document = frame_->document();
|
||||
if (!document.isNull()) {
|
||||
documentImpl = new CefDOMDocumentImpl(browser_, frame_);
|
||||
eventImpl = new CefDOMEventImpl(documentImpl, event);
|
||||
}
|
||||
}
|
||||
|
||||
listener_->HandleEvent(eventImpl.get());
|
||||
|
||||
if(eventImpl.get())
|
||||
eventImpl->Detach();
|
||||
if (documentImpl.get())
|
||||
documentImpl->Detach();
|
||||
}
|
||||
|
||||
protected:
|
||||
CefBrowserImpl* browser_;
|
||||
WebFrame* frame_;
|
||||
CefRefPtr<CefDOMEventListener> listener_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
CefDOMNodeImpl::CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const WebKit::WebNode& node)
|
||||
: document_(document), node_(node)
|
||||
{
|
||||
}
|
||||
|
||||
CefDOMNodeImpl::~CefDOMNodeImpl()
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
if (document_.get() && !node_.isNull()) {
|
||||
// Remove the node from the document.
|
||||
document_->RemoveNode(node_);
|
||||
}
|
||||
}
|
||||
|
||||
CefDOMNodeImpl::Type CefDOMNodeImpl::GetType()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return DOM_NODE_TYPE_UNSUPPORTED;
|
||||
|
||||
switch (node_.nodeType()) {
|
||||
case WebNode::ElementNode:
|
||||
return DOM_NODE_TYPE_ELEMENT;
|
||||
case WebNode::AttributeNode:
|
||||
return DOM_NODE_TYPE_ATTRIBUTE;
|
||||
case WebNode::TextNode:
|
||||
return DOM_NODE_TYPE_TEXT;
|
||||
case WebNode::CDataSectionNode:
|
||||
return DOM_NODE_TYPE_CDATA_SECTION;
|
||||
case WebNode::EntityReferenceNode:
|
||||
return DOM_NODE_TYPE_ENTITY_REFERENCE;
|
||||
case WebNode::EntityNode:
|
||||
return DOM_NODE_TYPE_ENTITY;
|
||||
case WebNode::ProcessingInstructionsNode:
|
||||
return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS;
|
||||
case WebNode::CommentNode:
|
||||
return DOM_NODE_TYPE_COMMENT;
|
||||
case WebNode::DocumentNode:
|
||||
return DOM_NODE_TYPE_DOCUMENT;
|
||||
case WebNode::DocumentTypeNode:
|
||||
return DOM_NODE_TYPE_DOCUMENT_TYPE;
|
||||
case WebNode::DocumentFragmentNode:
|
||||
return DOM_NODE_TYPE_DOCUMENT_FRAGMENT;
|
||||
case WebNode::NotationNode:
|
||||
return DOM_NODE_TYPE_NOTATION;
|
||||
case WebNode::XPathNamespaceNode:
|
||||
return DOM_NODE_TYPE_XPATH_NAMESPACE;
|
||||
default:
|
||||
return DOM_NODE_TYPE_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::IsText()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return node_.isTextNode();
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::IsElement()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return node_.isElementNode();
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetName()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebString& name = node_.nodeName();
|
||||
if (!name.isNull())
|
||||
str = name;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetValue()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebString& value = node_.nodeValue();
|
||||
if (!value.isNull())
|
||||
str = value;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::SetValue(const CefString& value)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (node_.isElementNode())
|
||||
return false;
|
||||
|
||||
return node_.setNodeValue(string16(value));
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetAsMarkup()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebString& markup = node_.createMarkup();
|
||||
if (!markup.isNull())
|
||||
str = markup;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMDocument> CefDOMNodeImpl::GetDocument()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_.get();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetParent()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.parentNode());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetPreviousSibling()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.previousSibling());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetNextSibling()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.nextSibling());
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::HasChildren()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return node_.hasChildNodes();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetFirstChild()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.firstChild());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetLastChild()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.lastChild());
|
||||
}
|
||||
|
||||
void CefDOMNodeImpl::AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener,
|
||||
bool useCapture)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
|
||||
node_.addEventListener(string16(eventType),
|
||||
new CefDOMEventListenerWrapper(document_->GetBrowser(),
|
||||
document_->GetFrame(), listener),
|
||||
useCapture);
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetElementTagName()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return str;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||
const WebString& tagname = element.tagName();
|
||||
if (!tagname.isNull())
|
||||
str = tagname;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::HasElementAttributes()
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||
return (element.attributes().length() > 0);
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||
return element.hasAttribute(string16(attrName));
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName)
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return str;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||
const WebString& attr = element.getAttribute(string16(attrName));
|
||||
if (!attr.isNull())
|
||||
str = attr;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||
const WebNamedNodeMap& map = element.attributes();
|
||||
unsigned int len = map.length();
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
string16 nameStr, valueStr;
|
||||
|
||||
for (unsigned int i = 0; i < len; ++i) {
|
||||
const WebAttribute& attrib = map.attributeItem(i);
|
||||
string16 nameStr, valueStr;
|
||||
const WebString& name = attrib.localName();
|
||||
if (!name.isNull())
|
||||
nameStr = name;
|
||||
const WebString& value = attrib.value();
|
||||
if (!value.isNull())
|
||||
valueStr = value;
|
||||
|
||||
attrMap.insert(std::make_pair(nameStr, valueStr));
|
||||
}
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName,
|
||||
const CefString& value)
|
||||
{
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
WebElement element = node_.to<WebKit::WebElement>();
|
||||
return element.setAttribute(string16(attrName), string16(value));
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetElementInnerText()
|
||||
{
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
NOTREACHED();
|
||||
return str;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||
const WebString& text = element.innerText();
|
||||
if (!text.isNull())
|
||||
str = text;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefDOMNodeImpl::Detach()
|
||||
{
|
||||
document_ = NULL;
|
||||
node_.assign(WebNode());
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::VerifyContext()
|
||||
{
|
||||
if (!document_.get()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
if (!document_->VerifyContext())
|
||||
return false;
|
||||
if(node_.isNull()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// 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.
|
||||
|
||||
#ifndef _DOM_NODE_IMPL_H
|
||||
#define _DOM_NODE_IMPL_H
|
||||
|
||||
#include "include/cef.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
||||
|
||||
class CefDOMDocumentImpl;
|
||||
|
||||
class CefDOMNodeImpl : public CefThreadSafeBase<CefDOMNode>
|
||||
{
|
||||
public:
|
||||
CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const WebKit::WebNode& node);
|
||||
virtual ~CefDOMNodeImpl();
|
||||
|
||||
virtual Type GetType();
|
||||
virtual bool IsText();
|
||||
virtual bool IsElement();
|
||||
virtual CefString GetName();
|
||||
virtual CefString GetValue();
|
||||
virtual bool SetValue(const CefString& value);
|
||||
virtual CefString GetAsMarkup();
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetParent();
|
||||
virtual CefRefPtr<CefDOMNode> GetPreviousSibling();
|
||||
virtual CefRefPtr<CefDOMNode> GetNextSibling();
|
||||
virtual bool HasChildren();
|
||||
virtual CefRefPtr<CefDOMNode> GetFirstChild();
|
||||
virtual CefRefPtr<CefDOMNode> GetLastChild();
|
||||
virtual void AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener,
|
||||
bool useCapture);
|
||||
virtual CefString GetElementTagName();
|
||||
virtual bool HasElementAttributes();
|
||||
virtual bool HasElementAttribute(const CefString& attrName);
|
||||
virtual CefString GetElementAttribute(const CefString& attrName);
|
||||
virtual void GetElementAttributes(AttributeMap& attrMap);
|
||||
virtual bool SetElementAttribute(const CefString& attrName,
|
||||
const CefString& value);
|
||||
virtual CefString GetElementInnerText();
|
||||
|
||||
// Will be called from CefDOMDocumentImpl::Detach().
|
||||
void Detach();
|
||||
|
||||
// Verify that the object exists and is being accessed on the UI thread.
|
||||
bool VerifyContext();
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||
WebKit::WebNode node_;
|
||||
};
|
||||
|
||||
#endif // _DOM_NODE_IMPL_H
|
|
@ -33,8 +33,7 @@ std::string GenerateHeaders(const HeaderMap& map)
|
|||
return headers;
|
||||
}
|
||||
|
||||
void ParseHeaders(const std::string& header_str,
|
||||
HeaderMap& map)
|
||||
void ParseHeaders(const std::string& header_str, HeaderMap& map)
|
||||
{
|
||||
// Parse the request header values
|
||||
std::string headerStr = "HTTP/1.1 200 OK\n";
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,190 @@
|
|||
// 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 static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/domdocument_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
CefDOMDocument::Type CefDOMDocumentCToCpp::GetType()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_type))
|
||||
return DOM_DOCUMENT_TYPE_UNKNOWN;
|
||||
|
||||
return struct_->get_type(struct_);
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetDocument()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_document))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_document(struct_);
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetBody()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_body))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_body(struct_);
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetHead()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_head))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_head(struct_);
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentCToCpp::GetTitle()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_title))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_title(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetElementById(const CefString& id)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_element_by_id))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct =
|
||||
struct_->get_element_by_id(struct_, id.GetStruct());
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetFocusedNode()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_focused_node))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_focused_node(struct_);
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CefDOMDocumentCToCpp::HasSelection()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, has_selection))
|
||||
return false;
|
||||
|
||||
return struct_->has_selection(struct_) ? true : false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetSelectionStartNode()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_selection_start_node))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_selection_start_node(struct_);
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CefDOMDocumentCToCpp::GetSelectionStartOffset()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_selection_start_offset))
|
||||
return 0;
|
||||
|
||||
return struct_->get_selection_start_offset(struct_);
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentCToCpp::GetSelectionEndNode()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_selection_end_node))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_selection_end_node(struct_);
|
||||
if (nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CefDOMDocumentCToCpp::GetSelectionEndOffset()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_selection_end_offset))
|
||||
return 0;
|
||||
|
||||
return struct_->get_selection_end_offset(struct_);
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentCToCpp::GetSelectionAsMarkup()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_selection_as_markup))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_selection_as_markup(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentCToCpp::GetSelectionAsText()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_selection_as_text))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_selection_as_text(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentCToCpp::GetBaseURL()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_base_url))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_base_url(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentCToCpp::GetCompleteURL(const CefString& partialURL)
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_complete_url))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr =
|
||||
struct_->get_complete_url(struct_, partialURL.GetStruct());
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCToCpp<CefDOMDocumentCToCpp, CefDOMDocument,
|
||||
cef_domdocument_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
// 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_CTOCPP_H
|
||||
#define _DOMDOCUMENT_CTOCPP_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/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefDOMDocumentCToCpp
|
||||
: public CefCToCpp<CefDOMDocumentCToCpp, CefDOMDocument, cef_domdocument_t>
|
||||
{
|
||||
public:
|
||||
CefDOMDocumentCToCpp(cef_domdocument_t* str)
|
||||
: CefCToCpp<CefDOMDocumentCToCpp, CefDOMDocument, cef_domdocument_t>(
|
||||
str) {}
|
||||
virtual ~CefDOMDocumentCToCpp() {}
|
||||
|
||||
// CefDOMDocument methods
|
||||
virtual Type GetType();
|
||||
virtual CefRefPtr<CefDOMNode> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetBody();
|
||||
virtual CefRefPtr<CefDOMNode> GetHead();
|
||||
virtual CefString GetTitle();
|
||||
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id);
|
||||
virtual CefRefPtr<CefDOMNode> GetFocusedNode();
|
||||
virtual bool HasSelection();
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode();
|
||||
virtual int GetSelectionStartOffset();
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode();
|
||||
virtual int GetSelectionEndOffset();
|
||||
virtual CefString GetSelectionAsMarkup();
|
||||
virtual CefString GetSelectionAsText();
|
||||
virtual CefString GetBaseURL();
|
||||
virtual CefString GetCompleteURL(const CefString& partialURL);
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // _DOMDOCUMENT_CTOCPP_H
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
// 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 static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/domdocument_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domevent_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
CefString CefDOMEventCToCpp::GetType()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_type))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_type(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefDOMEvent::Category CefDOMEventCToCpp::GetCategory()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_category))
|
||||
return DOM_EVENT_CATEGORY_UNKNOWN;
|
||||
|
||||
return struct_->get_category(struct_);
|
||||
}
|
||||
|
||||
CefDOMEvent::Phase CefDOMEventCToCpp::GetPhase()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_phase))
|
||||
return DOM_EVENT_PHASE_UNKNOWN;
|
||||
|
||||
return struct_->get_phase(struct_);
|
||||
}
|
||||
|
||||
bool CefDOMEventCToCpp::CanBubble()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, can_bubble))
|
||||
return false;
|
||||
|
||||
return struct_->can_bubble(struct_) ? true : false;
|
||||
}
|
||||
|
||||
bool CefDOMEventCToCpp::CanCancel()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, can_cancel))
|
||||
return false;
|
||||
|
||||
return struct_->can_cancel(struct_) ? true : false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMDocument> CefDOMEventCToCpp::GetDocument()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_document))
|
||||
return NULL;
|
||||
|
||||
cef_domdocument_t* documentStruct = struct_->get_document(struct_);
|
||||
if(documentStruct)
|
||||
return CefDOMDocumentCToCpp::Wrap(documentStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMEventCToCpp::GetTarget()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_target))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_target(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMEventCToCpp::GetCurrentTarget()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_current_target))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_current_target(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCToCpp<CefDOMEventCToCpp, CefDOMEvent,
|
||||
cef_domevent_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
|
@ -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.
|
||||
//
|
||||
// -------------------------------------------------------------------------
|
||||
//
|
||||
// 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_CTOCPP_H
|
||||
#define _DOMEVENT_CTOCPP_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/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefDOMEventCToCpp
|
||||
: public CefCToCpp<CefDOMEventCToCpp, CefDOMEvent, cef_domevent_t>
|
||||
{
|
||||
public:
|
||||
CefDOMEventCToCpp(cef_domevent_t* str)
|
||||
: CefCToCpp<CefDOMEventCToCpp, CefDOMEvent, cef_domevent_t>(str) {}
|
||||
virtual ~CefDOMEventCToCpp() {}
|
||||
|
||||
// CefDOMEvent methods
|
||||
virtual CefString GetType();
|
||||
virtual Category GetCategory();
|
||||
virtual Phase GetPhase();
|
||||
virtual bool CanBubble();
|
||||
virtual bool CanCancel();
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetTarget();
|
||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget();
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // _DOMEVENT_CTOCPP_H
|
||||
|
|
@ -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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// 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 static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/domevent_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/domevent_listener_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefDOMEventListenerCToCpp::HandleEvent(CefRefPtr<CefDOMEvent> event)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_event))
|
||||
return;
|
||||
|
||||
cef_domevent_t* eventStruct = NULL;
|
||||
if (event.get())
|
||||
eventStruct = CefDOMEventCppToC::Wrap(event);
|
||||
struct_->handle_event(struct_, eventStruct);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCToCpp<CefDOMEventListenerCToCpp, CefDOMEventListener,
|
||||
cef_domevent_listener_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// 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_CTOCPP_H
|
||||
#define _DOMEVENTLISTENER_CTOCPP_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/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefDOMEventListenerCToCpp
|
||||
: public CefCToCpp<CefDOMEventListenerCToCpp, CefDOMEventListener,
|
||||
cef_domevent_listener_t>
|
||||
{
|
||||
public:
|
||||
CefDOMEventListenerCToCpp(cef_domevent_listener_t* str)
|
||||
: CefCToCpp<CefDOMEventListenerCToCpp, CefDOMEventListener,
|
||||
cef_domevent_listener_t>(str) {}
|
||||
virtual ~CefDOMEventListenerCToCpp() {}
|
||||
|
||||
// CefDOMEventListener methods
|
||||
virtual void HandleEvent(CefRefPtr<CefDOMEvent> event);
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif // _DOMEVENTLISTENER_CTOCPP_H
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
// 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 static and
|
||||
// virtual method 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/domdocument_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
CefDOMNode::Type CefDOMNodeCToCpp::GetType()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_type))
|
||||
return DOM_NODE_TYPE_UNSUPPORTED;
|
||||
|
||||
return struct_->get_type(struct_);
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::IsText()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, is_text))
|
||||
return false;
|
||||
|
||||
return struct_->is_text(struct_) ? true : false;
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::IsElement()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, is_element))
|
||||
return false;
|
||||
|
||||
return struct_->is_element(struct_) ? true : false;
|
||||
}
|
||||
|
||||
CefString CefDOMNodeCToCpp::GetName()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_name))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMNodeCToCpp::GetValue()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_value))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_value(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::SetValue(const CefString& value)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set_value))
|
||||
return false;
|
||||
|
||||
return struct_->set_value(struct_, value.GetStruct()) ? true : false;
|
||||
}
|
||||
|
||||
CefString CefDOMNodeCToCpp::GetAsMarkup()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_as_markup))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_as_markup(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMDocument> CefDOMNodeCToCpp::GetDocument()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_document))
|
||||
return NULL;
|
||||
|
||||
cef_domdocument_t* documentStruct = struct_->get_document(struct_);
|
||||
if(documentStruct)
|
||||
return CefDOMDocumentCToCpp::Wrap(documentStruct);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeCToCpp::GetParent()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_parent))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_parent(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeCToCpp::GetPreviousSibling()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_previous_sibling))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_previous_sibling(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeCToCpp::GetNextSibling()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_next_sibling))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_next_sibling(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::HasChildren()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, has_children))
|
||||
return false;
|
||||
|
||||
return struct_->has_children(struct_) ? true : false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeCToCpp::GetFirstChild()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_first_child))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_first_child(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeCToCpp::GetLastChild()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_last_child))
|
||||
return NULL;
|
||||
|
||||
cef_domnode_t* nodeStruct = struct_->get_last_child(struct_);
|
||||
if(nodeStruct)
|
||||
return CefDOMNodeCToCpp::Wrap(nodeStruct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CefDOMNodeCToCpp::AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener, bool useCapture)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, add_event_listener))
|
||||
return;
|
||||
|
||||
struct_->add_event_listener(struct_, eventType.GetStruct(),
|
||||
CefDOMEventListenerCppToC::Wrap(listener), useCapture);
|
||||
}
|
||||
|
||||
CefString CefDOMNodeCToCpp::GetElementTagName()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_element_tag_name))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_element_tag_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::HasElementAttributes()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, has_element_attributes))
|
||||
return false;
|
||||
|
||||
return struct_->has_element_attributes(struct_) ? true : false;
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::HasElementAttribute(const CefString& attrName)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, has_element_attribute))
|
||||
return false;
|
||||
|
||||
return struct_->has_element_attribute(struct_, attrName.GetStruct()) ?
|
||||
true : false;
|
||||
}
|
||||
|
||||
CefString CefDOMNodeCToCpp::GetElementAttribute(const CefString& attrName)
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_element_attribute))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr =
|
||||
struct_->get_element_attribute(struct_, attrName.GetStruct());
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefDOMNodeCToCpp::GetElementAttributes(AttributeMap& attrMap)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_element_attributes))
|
||||
return;
|
||||
|
||||
cef_string_map_t map = cef_string_map_alloc();
|
||||
if(!map)
|
||||
return;
|
||||
|
||||
struct_->get_element_attributes(struct_, map);
|
||||
transfer_string_map_contents(map, attrMap);
|
||||
cef_string_map_free(map);
|
||||
}
|
||||
|
||||
bool CefDOMNodeCToCpp::SetElementAttribute(const CefString& attrName,
|
||||
const CefString& value)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set_element_attribute))
|
||||
return false;
|
||||
|
||||
return struct_->set_element_attribute(struct_, attrName.GetStruct(),
|
||||
value.GetStruct()) ? true : false;
|
||||
}
|
||||
|
||||
CefString CefDOMNodeCToCpp::GetElementInnerText()
|
||||
{
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_element_inner_text))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_element_inner_text(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCToCpp<CefDOMNodeCToCpp, CefDOMNode,
|
||||
cef_domnode_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// 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_CTOCPP_H
|
||||
#define _DOMNODE_CTOCPP_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/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefDOMNodeCToCpp
|
||||
: public CefCToCpp<CefDOMNodeCToCpp, CefDOMNode, cef_domnode_t>
|
||||
{
|
||||
public:
|
||||
CefDOMNodeCToCpp(cef_domnode_t* str)
|
||||
: CefCToCpp<CefDOMNodeCToCpp, CefDOMNode, cef_domnode_t>(str) {}
|
||||
virtual ~CefDOMNodeCToCpp() {}
|
||||
|
||||
// CefDOMNode methods
|
||||
virtual Type GetType();
|
||||
virtual bool IsText();
|
||||
virtual bool IsElement();
|
||||
virtual CefString GetName();
|
||||
virtual CefString GetValue();
|
||||
virtual bool SetValue(const CefString& value);
|
||||
virtual CefString GetAsMarkup();
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetParent();
|
||||
virtual CefRefPtr<CefDOMNode> GetPreviousSibling();
|
||||
virtual CefRefPtr<CefDOMNode> GetNextSibling();
|
||||
virtual bool HasChildren();
|
||||
virtual CefRefPtr<CefDOMNode> GetFirstChild();
|
||||
virtual CefRefPtr<CefDOMNode> GetLastChild();
|
||||
virtual void AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener, bool useCapture);
|
||||
virtual CefString GetElementTagName();
|
||||
virtual bool HasElementAttributes();
|
||||
virtual bool HasElementAttribute(const CefString& attrName);
|
||||
virtual CefString GetElementAttribute(const CefString& attrName);
|
||||
virtual void GetElementAttributes(AttributeMap& attrMap);
|
||||
virtual bool SetElementAttribute(const CefString& attrName,
|
||||
const CefString& value);
|
||||
virtual CefString GetElementInnerText();
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // _DOMNODE_CTOCPP_H
|
||||
|
|
@ -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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// 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 static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/domdocument_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/domvisitor_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefDOMVisitorCToCpp::Visit(CefRefPtr<CefDOMDocument> document)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, visit))
|
||||
return;
|
||||
|
||||
cef_domdocument_t* documentStruct = NULL;
|
||||
if (document.get())
|
||||
documentStruct = CefDOMDocumentCppToC::Wrap(document);
|
||||
struct_->visit(struct_, documentStruct);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCToCpp<CefDOMVisitorCToCpp, CefDOMVisitor,
|
||||
cef_domvisitor_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// 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_CTOCPP_H
|
||||
#define _DOMVISITOR_CTOCPP_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/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefDOMVisitorCToCpp
|
||||
: public CefCToCpp<CefDOMVisitorCToCpp, CefDOMVisitor, cef_domvisitor_t>
|
||||
{
|
||||
public:
|
||||
CefDOMVisitorCToCpp(cef_domvisitor_t* str)
|
||||
: CefCToCpp<CefDOMVisitorCToCpp, CefDOMVisitor, cef_domvisitor_t>(str) {}
|
||||
virtual ~CefDOMVisitorCToCpp() {}
|
||||
|
||||
// CefDOMVisitor methods
|
||||
virtual void Visit(CefRefPtr<CefDOMDocument> document);
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif // _DOMVISITOR_CTOCPP_H
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/domvisitor_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||
|
@ -207,6 +208,14 @@ CefRefPtr<CefBrowser> CefFrameCToCpp::GetBrowser()
|
|||
return browser;
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::VisitDOM(CefRefPtr<CefDOMVisitor> visitor)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, visit_dom))
|
||||
return;
|
||||
|
||||
struct_->visit_dom(struct_, CefDOMVisitorCppToC::Wrap(visitor));
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCToCpp<CefFrameCToCpp, CefFrame, cef_frame_t>::DebugObjCt =
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
virtual CefString GetName();
|
||||
virtual CefString GetURL();
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser();
|
||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor);
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#include "include/cef_nplugin_capi.h"
|
||||
#include "cef_logging.h"
|
||||
#include "cpptoc/browser_cpptoc.h"
|
||||
#include "cpptoc/domdocument_cpptoc.h"
|
||||
#include "cpptoc/domevent_cpptoc.h"
|
||||
#include "cpptoc/domnode_cpptoc.h"
|
||||
#include "cpptoc/post_data_cpptoc.h"
|
||||
#include "cpptoc/post_data_element_cpptoc.h"
|
||||
#include "cpptoc/request_cpptoc.h"
|
||||
|
@ -17,6 +20,8 @@
|
|||
#include "cpptoc/web_urlrequest_cpptoc.h"
|
||||
#include "cpptoc/xml_reader_cpptoc.h"
|
||||
#include "cpptoc/zip_reader_cpptoc.h"
|
||||
#include "ctocpp/domevent_listener_ctocpp.h"
|
||||
#include "ctocpp/domvisitor_ctocpp.h"
|
||||
#include "ctocpp/download_handler_ctocpp.h"
|
||||
#include "ctocpp/handler_ctocpp.h"
|
||||
#include "ctocpp/read_handler_ctocpp.h"
|
||||
|
@ -57,6 +62,9 @@ CEF_EXPORT void cef_shutdown()
|
|||
#ifdef _DEBUG
|
||||
// Check that all wrapper objects have been destroyed
|
||||
DCHECK(CefBrowserCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefDOMDocumentCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefDOMEventCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefDOMNodeCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefRequestCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefPostDataCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefPostDataElementCppToC::DebugObjCt == 0);
|
||||
|
@ -66,6 +74,8 @@ CEF_EXPORT void cef_shutdown()
|
|||
DCHECK(CefWebURLRequestCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefXmlReaderCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefZipReaderCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefDOMEventListenerCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefDOMVisitorCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefDownloadHandlerCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefReadHandlerCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefSchemeHandlerCToCpp::DebugObjCt == 0);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "include/cef_capi.h"
|
||||
#include "include/cef_nplugin.h"
|
||||
#include "include/cef_nplugin_capi.h"
|
||||
#include "libcef_dll/cpptoc/domevent_listener_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/domvisitor_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/read_handler_cpptoc.h"
|
||||
|
@ -16,6 +18,9 @@
|
|||
#include "libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/write_handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domdocument_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domevent_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/post_data_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/post_data_element_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||
|
@ -40,6 +45,8 @@ void CefShutdown()
|
|||
|
||||
#ifdef _DEBUG
|
||||
// Check that all wrapper objects have been destroyed
|
||||
DCHECK(CefDOMEventListenerCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefDOMVisitorCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefDownloadHandlerCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefReadHandlerCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefSchemeHandlerCppToC::DebugObjCt == 0);
|
||||
|
@ -48,6 +55,9 @@ void CefShutdown()
|
|||
DCHECK(CefWebURLRequestClientCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefWriteHandlerCppToC::DebugObjCt == 0);
|
||||
DCHECK(CefBrowserCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefDOMDocumentCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefDOMEventCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefDOMNodeCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefRequestCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefPostDataCToCpp::DebugObjCt == 0);
|
||||
DCHECK(CefPostDataElementCToCpp::DebugObjCt == 0);
|
||||
|
|
|
@ -91,6 +91,11 @@ CefHandler::RetVal ClientHandler::HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
|||
m_bLoading = false;
|
||||
m_bCanGoBack = browser->CanGoBack();
|
||||
m_bCanGoForward = browser->CanGoForward();
|
||||
|
||||
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
|
||||
CefRefPtr<CefDOMVisitor> visitor = GetDOMVisitor(frame->GetURL());
|
||||
if(visitor.get())
|
||||
frame->VisitDOM(visitor);
|
||||
Unlock();
|
||||
}
|
||||
return RV_CONTINUE;
|
||||
|
@ -271,6 +276,26 @@ std::string ClientHandler::GetLastDownloadFile()
|
|||
return str;
|
||||
}
|
||||
|
||||
void ClientHandler::AddDOMVisitor(const std::string& path,
|
||||
CefRefPtr<CefDOMVisitor> visitor)
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
DOMVisitorMap::iterator it = m_DOMVisitors.find(path);
|
||||
if (it == m_DOMVisitors.end())
|
||||
m_DOMVisitors.insert(std::make_pair(path, visitor));
|
||||
else
|
||||
it->second = visitor;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMVisitor> ClientHandler::GetDOMVisitor(const std::string& path)
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
DOMVisitorMap::iterator it = m_DOMVisitors.find(path);
|
||||
if (it != m_DOMVisitors.end())
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Global functions
|
||||
|
||||
|
@ -471,3 +496,87 @@ void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser)
|
|||
CefRefPtr<CefWebURLRequest> requester(
|
||||
CefWebURLRequest::CreateWebURLRequest(request, client));
|
||||
}
|
||||
|
||||
void RunDOMAccessTest(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
class Listener : public CefThreadSafeBase<CefDOMEventListener>
|
||||
{
|
||||
public:
|
||||
Listener() {}
|
||||
virtual void HandleEvent(CefRefPtr<CefDOMEvent> event)
|
||||
{
|
||||
CefRefPtr<CefDOMDocument> document = event->GetDocument();
|
||||
ASSERT(document.get());
|
||||
|
||||
std::stringstream ss;
|
||||
|
||||
CefRefPtr<CefDOMNode> button = event->GetTarget();
|
||||
ASSERT(button.get());
|
||||
std::string buttonValue = button->GetElementAttribute("value");
|
||||
ss << "You clicked the " << buttonValue.c_str() << " button. ";
|
||||
|
||||
if (document->HasSelection()) {
|
||||
std::string startName, endName;
|
||||
|
||||
// Determine the start name by first trying to locate the "id" attribute
|
||||
// and then defaulting to the tag name.
|
||||
{
|
||||
CefRefPtr<CefDOMNode> node = document->GetSelectionStartNode();
|
||||
if (!node->IsElement())
|
||||
node = node->GetParent();
|
||||
if (node->IsElement() && node->HasElementAttribute("id"))
|
||||
startName = node->GetElementAttribute("id");
|
||||
else
|
||||
startName = node->GetName();
|
||||
}
|
||||
|
||||
// Determine the end name by first trying to locate the "id" attribute
|
||||
// and then defaulting to the tag name.
|
||||
{
|
||||
CefRefPtr<CefDOMNode> node = document->GetSelectionEndNode();
|
||||
if (!node->IsElement())
|
||||
node = node->GetParent();
|
||||
if (node->IsElement() && node->HasElementAttribute("id"))
|
||||
endName = node->GetElementAttribute("id");
|
||||
else
|
||||
endName = node->GetName();
|
||||
}
|
||||
|
||||
ss << "The selection is from " <<
|
||||
startName.c_str() << ":" << document->GetSelectionStartOffset() <<
|
||||
" to " <<
|
||||
endName.c_str() << ":" << document->GetSelectionEndOffset();
|
||||
} else {
|
||||
ss << "Nothing is selected.";
|
||||
}
|
||||
|
||||
// Update the description.
|
||||
CefRefPtr<CefDOMNode> desc = document->GetElementById("description");
|
||||
ASSERT(desc.get());
|
||||
CefRefPtr<CefDOMNode> text = desc->GetFirstChild();
|
||||
ASSERT(text.get());
|
||||
ASSERT(text->IsText());
|
||||
text->SetValue(ss.str());
|
||||
}
|
||||
};
|
||||
|
||||
class Visitor : public CefThreadSafeBase<CefDOMVisitor>
|
||||
{
|
||||
public:
|
||||
Visitor() {}
|
||||
virtual void Visit(CefRefPtr<CefDOMDocument> document)
|
||||
{
|
||||
// Register an click listener for the button.
|
||||
CefRefPtr<CefDOMNode> button = document->GetElementById("button");
|
||||
ASSERT(button.get());
|
||||
button->AddEventListener("click", new Listener(), false);
|
||||
}
|
||||
};
|
||||
|
||||
// The DOM visitor will be called after the path is loaded.
|
||||
CefRefPtr<CefHandler> handler = browser->GetHandler();
|
||||
static_cast<ClientHandler*>(handler.get())->AddDOMVisitor(
|
||||
"http://tests/domaccess", new Visitor());
|
||||
|
||||
browser->GetMainFrame()->LoadURL("http://tests/domaccess");
|
||||
}
|
||||
|
|
|
@ -379,6 +379,10 @@ public:
|
|||
void SetLastDownloadFile(const std::string& fileName);
|
||||
std::string GetLastDownloadFile();
|
||||
|
||||
// DOM visitors will be called after the associated path is loaded.
|
||||
void AddDOMVisitor(const std::string& path, CefRefPtr<CefDOMVisitor> visitor);
|
||||
CefRefPtr<CefDOMVisitor> GetDOMVisitor(const std::string& path);
|
||||
|
||||
// Send a notification to the application. Notifications should not block the
|
||||
// caller.
|
||||
enum NotificationType
|
||||
|
@ -414,6 +418,9 @@ protected:
|
|||
// Support for downloading files.
|
||||
CefRefPtr<DownloadListener> m_DownloadListener;
|
||||
std::string m_LastDownloadFile;
|
||||
|
||||
typedef std::map<std::string, CefRefPtr<CefDOMVisitor> > DOMVisitorMap;
|
||||
DOMVisitorMap m_DOMVisitors;
|
||||
};
|
||||
|
||||
|
||||
|
@ -439,5 +446,6 @@ void RunWebGLTest(CefRefPtr<CefBrowser> browser);
|
|||
void RunHTML5VideoTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunDOMAccessTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
#endif // _CEFCLIENT_H
|
||||
|
|
|
@ -33,6 +33,7 @@ IDS_UIPLUGIN BINARY "res\\uiplugin.html"
|
|||
IDS_LOGOBALL BINARY "res\\logoball.png"
|
||||
IDS_LOCALSTORAGE BINARY "res\\localstorage.html"
|
||||
IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html"
|
||||
IDS_DOMACCESS BINARY "res\\domaccess.html"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -78,6 +79,7 @@ BEGIN
|
|||
MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE
|
||||
MENUITEM "XMLHttpRequest", ID_TESTS_XMLHTTPREQUEST
|
||||
MENUITEM "WebURLRequest", ID_TESTS_WEBURLREQUEST
|
||||
MENUITEM "DOM Access", ID_TESTS_DOMACCESS
|
||||
MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS
|
||||
MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS
|
||||
MENUITEM "WebGL", ID_TESTS_WEBGL
|
||||
|
|
|
@ -511,6 +511,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
if(browser.get())
|
||||
RunUIPluginTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DOMACCESS: // Test DOM access
|
||||
if(browser.get())
|
||||
RunDOMAccessTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_LOCALSTORAGE: // Test localStorage
|
||||
if(browser.get())
|
||||
RunLocalStorageTest(browser);
|
||||
|
@ -709,6 +713,13 @@ CefHandler::RetVal ClientHandler::HandleBeforeResourceLoad(
|
|||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||
mimeType = "text/html";
|
||||
}
|
||||
} else if(url == "http://tests/domaccess") {
|
||||
// Show the domaccess HTML contents
|
||||
if(LoadBinaryResource(IDS_DOMACCESS, dwSize, pBytes)) {
|
||||
resourceStream = CefStreamReader::CreateForHandler(
|
||||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||
mimeType = "text/html";
|
||||
}
|
||||
} else if(strstr(url.c_str(), "/ps_logo2.png") != NULL) {
|
||||
// Any time we find "ps_logo2.png" in the URL substitute in our own image
|
||||
if(LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<html>
|
||||
<body>
|
||||
<p id="instructions">Select some portion of the below page content and click the "Describe Selection" button. The selected region will then be described below.</p>
|
||||
<p id="p1">This is p1</p>
|
||||
<p id="p2">This is p2</p>
|
||||
<p id="p3">This is p3</p>
|
||||
<p id="p4">This is p4</p>
|
||||
<form>
|
||||
<input type="button" id="button" value="Describe Selection">
|
||||
<p id="description">The description will appear here.</p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -48,12 +48,14 @@
|
|||
#define ID_TESTS_DEVTOOLS_SHOW 32788
|
||||
#define ID_TESTS_DEVTOOLS_CLOSE 32789
|
||||
#define ID_TESTS_WEBURLREQUEST 32790
|
||||
#define ID_TESTS_DOMACCESS 32791
|
||||
#define IDC_STATIC -1
|
||||
#define IDS_LOGO 1000
|
||||
#define IDS_UIPLUGIN 1001
|
||||
#define IDS_LOGOBALL 1002
|
||||
#define IDS_LOCALSTORAGE 1003
|
||||
#define IDS_XMLHTTPREQUEST 1004
|
||||
#define IDS_DOMACCESS 1005
|
||||
|
||||
// Avoid files associated with MacOS
|
||||
#define _X86_
|
||||
|
|
|
@ -0,0 +1,268 @@
|
|||
// 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.
|
||||
|
||||
#include "include/cef.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "test_handler.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class TestDOMHandler : public TestHandler
|
||||
{
|
||||
public:
|
||||
class Visitor : public CefThreadSafeBase<CefDOMVisitor>
|
||||
{
|
||||
public:
|
||||
Visitor(TestDOMHandler* handler) : handler_(handler) {}
|
||||
|
||||
void TestHeadNodeStructure(CefRefPtr<CefDOMNode> headNode)
|
||||
{
|
||||
EXPECT_TRUE(headNode.get());
|
||||
EXPECT_TRUE(headNode->IsElement());
|
||||
EXPECT_FALSE(headNode->IsText());
|
||||
EXPECT_EQ(headNode->GetName(), "HEAD");
|
||||
EXPECT_EQ(headNode->GetElementTagName(), "HEAD");
|
||||
|
||||
EXPECT_TRUE(headNode->HasChildren());
|
||||
EXPECT_FALSE(headNode->HasElementAttributes());
|
||||
|
||||
CefRefPtr<CefDOMNode> titleNode = headNode->GetFirstChild();
|
||||
EXPECT_TRUE(titleNode.get());
|
||||
EXPECT_TRUE(titleNode->IsElement());
|
||||
EXPECT_FALSE(titleNode->IsText());
|
||||
EXPECT_EQ(titleNode->GetName(), "TITLE");
|
||||
EXPECT_EQ(titleNode->GetElementTagName(), "TITLE");
|
||||
|
||||
EXPECT_FALSE(titleNode->GetNextSibling().get());
|
||||
EXPECT_FALSE(titleNode->GetPreviousSibling().get());
|
||||
EXPECT_TRUE(titleNode->HasChildren());
|
||||
EXPECT_FALSE(titleNode->HasElementAttributes());
|
||||
|
||||
CefRefPtr<CefDOMNode> textNode = titleNode->GetFirstChild();
|
||||
EXPECT_TRUE(textNode.get());
|
||||
EXPECT_FALSE(textNode->IsElement());
|
||||
EXPECT_TRUE(textNode->IsText());
|
||||
EXPECT_EQ(textNode->GetValue(), "The Title");
|
||||
|
||||
EXPECT_FALSE(textNode->GetNextSibling().get());
|
||||
EXPECT_FALSE(textNode->GetPreviousSibling().get());
|
||||
EXPECT_FALSE(textNode->HasChildren());
|
||||
}
|
||||
|
||||
void TestBodyNodeStructure(CefRefPtr<CefDOMNode> bodyNode)
|
||||
{
|
||||
EXPECT_TRUE(bodyNode.get());
|
||||
EXPECT_TRUE(bodyNode->IsElement());
|
||||
EXPECT_FALSE(bodyNode->IsText());
|
||||
EXPECT_EQ(bodyNode->GetName(), "BODY");
|
||||
EXPECT_EQ(bodyNode->GetElementTagName(), "BODY");
|
||||
|
||||
EXPECT_TRUE(bodyNode->HasChildren());
|
||||
EXPECT_FALSE(bodyNode->HasElementAttributes());
|
||||
|
||||
CefRefPtr<CefDOMNode> h1Node = bodyNode->GetFirstChild();
|
||||
EXPECT_TRUE(h1Node.get());
|
||||
EXPECT_TRUE(h1Node->IsElement());
|
||||
EXPECT_FALSE(h1Node->IsText());
|
||||
EXPECT_EQ(h1Node->GetName(), "H1");
|
||||
EXPECT_EQ(h1Node->GetElementTagName(), "H1");
|
||||
|
||||
EXPECT_FALSE(h1Node->GetNextSibling().get());
|
||||
EXPECT_FALSE(h1Node->GetPreviousSibling().get());
|
||||
EXPECT_TRUE(h1Node->HasChildren());
|
||||
EXPECT_FALSE(h1Node->HasElementAttributes());
|
||||
|
||||
CefRefPtr<CefDOMNode> textNode = h1Node->GetFirstChild();
|
||||
EXPECT_TRUE(textNode.get());
|
||||
EXPECT_FALSE(textNode->IsElement());
|
||||
EXPECT_TRUE(textNode->IsText());
|
||||
EXPECT_EQ(textNode->GetValue(), "Hello From");
|
||||
|
||||
EXPECT_FALSE(textNode->GetPreviousSibling().get());
|
||||
EXPECT_FALSE(textNode->HasChildren());
|
||||
|
||||
CefRefPtr<CefDOMNode> brNode = textNode->GetNextSibling();
|
||||
EXPECT_TRUE(brNode.get());
|
||||
EXPECT_TRUE(brNode->IsElement());
|
||||
EXPECT_FALSE(brNode->IsText());
|
||||
EXPECT_EQ(brNode->GetName(), "BR");
|
||||
EXPECT_EQ(brNode->GetElementTagName(), "BR");
|
||||
|
||||
EXPECT_FALSE(brNode->HasChildren());
|
||||
|
||||
EXPECT_TRUE(brNode->HasElementAttributes());
|
||||
EXPECT_TRUE(brNode->HasElementAttribute("class"));
|
||||
EXPECT_EQ(brNode->GetElementAttribute("class"), "some_class");
|
||||
EXPECT_TRUE(brNode->HasElementAttribute("id"));
|
||||
EXPECT_EQ(brNode->GetElementAttribute("id"), "some_id");
|
||||
EXPECT_FALSE(brNode->HasElementAttribute("no_existing"));
|
||||
|
||||
CefDOMNode::AttributeMap map;
|
||||
brNode->GetElementAttributes(map);
|
||||
ASSERT_EQ(map.size(), (size_t)2);
|
||||
EXPECT_EQ(map["class"], "some_class");
|
||||
EXPECT_EQ(map["id"], "some_id");
|
||||
|
||||
// Can also retrieve by ID.
|
||||
brNode = bodyNode->GetDocument()->GetElementById("some_id");
|
||||
EXPECT_TRUE(brNode.get());
|
||||
EXPECT_TRUE(brNode->IsElement());
|
||||
EXPECT_FALSE(brNode->IsText());
|
||||
EXPECT_EQ(brNode->GetName(), "BR");
|
||||
EXPECT_EQ(brNode->GetElementTagName(), "BR");
|
||||
|
||||
textNode = brNode->GetNextSibling();
|
||||
EXPECT_TRUE(textNode.get());
|
||||
EXPECT_FALSE(textNode->IsElement());
|
||||
EXPECT_TRUE(textNode->IsText());
|
||||
EXPECT_EQ(textNode->GetValue(), "Main Frame");
|
||||
|
||||
EXPECT_FALSE(textNode->GetNextSibling().get());
|
||||
EXPECT_FALSE(textNode->HasChildren());
|
||||
}
|
||||
|
||||
// Test document structure by iterating through the DOM tree.
|
||||
void TestStructure(CefRefPtr<CefDOMDocument> document)
|
||||
{
|
||||
EXPECT_EQ(document->GetTitle(), "The Title");
|
||||
EXPECT_EQ(document->GetBaseURL(), "http://tests/main.html");
|
||||
EXPECT_EQ(document->GetCompleteURL("foo.html"), "http://tests/foo.html");
|
||||
|
||||
// Navigate the complete document structure.
|
||||
CefRefPtr<CefDOMNode> docNode = document->GetDocument();
|
||||
EXPECT_TRUE(docNode.get());
|
||||
EXPECT_FALSE(docNode->IsElement());
|
||||
EXPECT_FALSE(docNode->IsText());
|
||||
|
||||
CefRefPtr<CefDOMNode> htmlNode = docNode->GetFirstChild();
|
||||
EXPECT_TRUE(htmlNode.get());
|
||||
EXPECT_TRUE(htmlNode->IsElement());
|
||||
EXPECT_FALSE(htmlNode->IsText());
|
||||
EXPECT_EQ(htmlNode->GetName(), "HTML");
|
||||
EXPECT_EQ(htmlNode->GetElementTagName(), "HTML");
|
||||
|
||||
EXPECT_TRUE(htmlNode->HasChildren());
|
||||
EXPECT_FALSE(htmlNode->HasElementAttributes());
|
||||
|
||||
CefRefPtr<CefDOMNode> headNode = htmlNode->GetFirstChild();
|
||||
TestHeadNodeStructure(headNode);
|
||||
|
||||
CefRefPtr<CefDOMNode> bodyNode = headNode->GetNextSibling();
|
||||
TestBodyNodeStructure(bodyNode);
|
||||
|
||||
// Retrieve the head node directly.
|
||||
headNode = document->GetHead();
|
||||
TestHeadNodeStructure(headNode);
|
||||
|
||||
// Retrieve the body node directly.
|
||||
bodyNode = document->GetBody();
|
||||
TestBodyNodeStructure(bodyNode);
|
||||
}
|
||||
|
||||
// Test document modification by changing the H1 tag.
|
||||
void TestModify(CefRefPtr<CefDOMDocument> document)
|
||||
{
|
||||
CefRefPtr<CefDOMNode> bodyNode = document->GetBody();
|
||||
CefRefPtr<CefDOMNode> h1Node = bodyNode->GetFirstChild();
|
||||
|
||||
ASSERT_EQ(h1Node->GetAsMarkup(),
|
||||
"<h1>Hello From<br class=\"some_class\" id=\"some_id\">Main Frame</h1>");
|
||||
|
||||
CefRefPtr<CefDOMNode> textNode = h1Node->GetFirstChild();
|
||||
ASSERT_EQ(textNode->GetValue(), "Hello From");
|
||||
ASSERT_TRUE(textNode->SetValue("A Different Message From"));
|
||||
ASSERT_EQ(textNode->GetValue(), "A Different Message From");
|
||||
|
||||
CefRefPtr<CefDOMNode> brNode = textNode->GetNextSibling();
|
||||
EXPECT_EQ(brNode->GetElementAttribute("class"), "some_class");
|
||||
EXPECT_TRUE(brNode->SetElementAttribute("class", "a_different_class"));
|
||||
EXPECT_EQ(brNode->GetElementAttribute("class"), "a_different_class");
|
||||
|
||||
ASSERT_EQ(h1Node->GetAsMarkup(),
|
||||
"<h1>A Different Message From<br class=\"a_different_class\" id=\"some_id\">Main Frame</h1>");
|
||||
|
||||
ASSERT_FALSE(h1Node->SetValue("Something Different"));
|
||||
}
|
||||
|
||||
virtual void Visit(CefRefPtr<CefDOMDocument> document)
|
||||
{
|
||||
handler_->got_visitor_called_.yes();
|
||||
|
||||
if (handler_->test_type_ == STRUCTURE)
|
||||
TestStructure(document);
|
||||
else if (handler_->test_type_ == MODIFY)
|
||||
TestModify(document);
|
||||
|
||||
handler_->DestroyTest();
|
||||
}
|
||||
|
||||
protected:
|
||||
TestDOMHandler* handler_;
|
||||
};
|
||||
|
||||
enum TestType {
|
||||
STRUCTURE,
|
||||
MODIFY,
|
||||
};
|
||||
|
||||
TestDOMHandler(TestType test) : test_type_(test)
|
||||
{
|
||||
visitor_ = new Visitor(this);
|
||||
}
|
||||
|
||||
virtual void RunTest()
|
||||
{
|
||||
std::stringstream mainHtml;
|
||||
mainHtml <<
|
||||
"<html>"
|
||||
"<head><title>The Title</title></head>"
|
||||
"<body>"
|
||||
"<h1>Hello From<br class=\"some_class\"/ id=\"some_id\"/>Main Frame</h1>"
|
||||
"</body>"
|
||||
"</html>";
|
||||
|
||||
AddResource("http://tests/main.html", mainHtml.str(), "text/html");
|
||||
CreateBrowser("http://tests/main.html");
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent,
|
||||
int httpStatusCode)
|
||||
{
|
||||
if(!frame.get()) {
|
||||
// The page is done loading so visit the DOM.
|
||||
browser->GetMainFrame()->VisitDOM(visitor_.get());
|
||||
}
|
||||
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
CefRefPtr<Visitor> visitor_;
|
||||
TestType test_type_;
|
||||
|
||||
TrackCallback got_visitor_called_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// Test DOM structure reading.
|
||||
TEST(DOMTest, Read)
|
||||
{
|
||||
CefRefPtr<TestDOMHandler> handler =
|
||||
new TestDOMHandler(TestDOMHandler::STRUCTURE);
|
||||
handler->ExecuteTest();
|
||||
|
||||
EXPECT_TRUE(handler->got_visitor_called_);
|
||||
}
|
||||
|
||||
// Test DOM modifications.
|
||||
TEST(DOMTest, Modify)
|
||||
{
|
||||
CefRefPtr<TestDOMHandler> handler =
|
||||
new TestDOMHandler(TestDOMHandler::MODIFY);
|
||||
handler->ExecuteTest();
|
||||
|
||||
EXPECT_TRUE(handler->got_visitor_called_);
|
||||
}
|
Loading…
Reference in New Issue