github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_dom_capi.h (about)

     1  // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
     2  //
     3  // Redistribution and use in source and binary forms, with or without
     4  // modification, are permitted provided that the following conditions are
     5  // met:
     6  //
     7  //    * Redistributions of source code must retain the above copyright
     8  // notice, this list of conditions and the following disclaimer.
     9  //    * Redistributions in binary form must reproduce the above
    10  // copyright notice, this list of conditions and the following disclaimer
    11  // in the documentation and/or other materials provided with the
    12  // distribution.
    13  //    * Neither the name of Google Inc. nor the name Chromium Embedded
    14  // Framework nor the names of its contributors may be used to endorse
    15  // or promote products derived from this software without specific prior
    16  // written permission.
    17  //
    18  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29  //
    30  // ---------------------------------------------------------------------------
    31  //
    32  // This file was generated by the CEF translator tool and should not edited
    33  // by hand. See the translator.README.txt file in the tools directory for
    34  // more information.
    35  //
    36  
    37  #ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
    39  #pragma once
    40  
    41  #ifdef __cplusplus
    42  extern "C" {
    43  #endif
    44  
    45  #include "include/capi/cef_base_capi.h"
    46  
    47  struct _cef_domdocument_t;
    48  struct _cef_domevent_listener_t;
    49  struct _cef_domnode_t;
    50  
    51  ///
    52  // Structure to implement for visiting the DOM. The functions of this structure
    53  // will be called on the render process main thread.
    54  ///
    55  typedef struct _cef_domvisitor_t {
    56    ///
    57    // Base structure.
    58    ///
    59    cef_base_t base;
    60  
    61    ///
    62    // Method executed for visiting the DOM. The document object passed to this
    63    // function represents a snapshot of the DOM at the time this function is
    64    // executed. DOM objects are only valid for the scope of this function. Do not
    65    // keep references to or attempt to access any DOM objects outside the scope
    66    // of this function.
    67    ///
    68    void (CEF_CALLBACK *visit)(struct _cef_domvisitor_t* self,
    69        struct _cef_domdocument_t* document);
    70  } cef_domvisitor_t;
    71  
    72  
    73  ///
    74  // Structure used to represent a DOM document. The functions of this structure
    75  // should only be called on the render process main thread thread.
    76  ///
    77  typedef struct _cef_domdocument_t {
    78    ///
    79    // Base structure.
    80    ///
    81    cef_base_t base;
    82  
    83    ///
    84    // Returns the document type.
    85    ///
    86    cef_dom_document_type_t (CEF_CALLBACK *get_type)(
    87        struct _cef_domdocument_t* self);
    88  
    89    ///
    90    // Returns the root document node.
    91    ///
    92    struct _cef_domnode_t* (CEF_CALLBACK *get_document)(
    93        struct _cef_domdocument_t* self);
    94  
    95    ///
    96    // Returns the BODY node of an HTML document.
    97    ///
    98    struct _cef_domnode_t* (CEF_CALLBACK *get_body)(
    99        struct _cef_domdocument_t* self);
   100  
   101    ///
   102    // Returns the HEAD node of an HTML document.
   103    ///
   104    struct _cef_domnode_t* (CEF_CALLBACK *get_head)(
   105        struct _cef_domdocument_t* self);
   106  
   107    ///
   108    // Returns the title of an HTML document.
   109    ///
   110    // The resulting string must be freed by calling cef_string_userfree_free().
   111    cef_string_userfree_t (CEF_CALLBACK *get_title)(
   112        struct _cef_domdocument_t* self);
   113  
   114    ///
   115    // Returns the document element with the specified ID value.
   116    ///
   117    struct _cef_domnode_t* (CEF_CALLBACK *get_element_by_id)(
   118        struct _cef_domdocument_t* self, const cef_string_t* id);
   119  
   120    ///
   121    // Returns the node that currently has keyboard focus.
   122    ///
   123    struct _cef_domnode_t* (CEF_CALLBACK *get_focused_node)(
   124        struct _cef_domdocument_t* self);
   125  
   126    ///
   127    // Returns true (1) if a portion of the document is selected.
   128    ///
   129    int (CEF_CALLBACK *has_selection)(struct _cef_domdocument_t* self);
   130  
   131    ///
   132    // Returns the selection start node.
   133    ///
   134    struct _cef_domnode_t* (CEF_CALLBACK *get_selection_start_node)(
   135        struct _cef_domdocument_t* self);
   136  
   137    ///
   138    // Returns the selection offset within the start node.
   139    ///
   140    int (CEF_CALLBACK *get_selection_start_offset)(
   141        struct _cef_domdocument_t* self);
   142  
   143    ///
   144    // Returns the selection end node.
   145    ///
   146    struct _cef_domnode_t* (CEF_CALLBACK *get_selection_end_node)(
   147        struct _cef_domdocument_t* self);
   148  
   149    ///
   150    // Returns the selection offset within the end node.
   151    ///
   152    int (CEF_CALLBACK *get_selection_end_offset)(struct _cef_domdocument_t* self);
   153  
   154    ///
   155    // Returns the contents of this selection as markup.
   156    ///
   157    // The resulting string must be freed by calling cef_string_userfree_free().
   158    cef_string_userfree_t (CEF_CALLBACK *get_selection_as_markup)(
   159        struct _cef_domdocument_t* self);
   160  
   161    ///
   162    // Returns the contents of this selection as text.
   163    ///
   164    // The resulting string must be freed by calling cef_string_userfree_free().
   165    cef_string_userfree_t (CEF_CALLBACK *get_selection_as_text)(
   166        struct _cef_domdocument_t* self);
   167  
   168    ///
   169    // Returns the base URL for the document.
   170    ///
   171    // The resulting string must be freed by calling cef_string_userfree_free().
   172    cef_string_userfree_t (CEF_CALLBACK *get_base_url)(
   173        struct _cef_domdocument_t* self);
   174  
   175    ///
   176    // Returns a complete URL based on the document base URL and the specified
   177    // partial URL.
   178    ///
   179    // The resulting string must be freed by calling cef_string_userfree_free().
   180    cef_string_userfree_t (CEF_CALLBACK *get_complete_url)(
   181        struct _cef_domdocument_t* self, const cef_string_t* partialURL);
   182  } cef_domdocument_t;
   183  
   184  
   185  ///
   186  // Structure used to represent a DOM node. The functions of this structure
   187  // should only be called on the render process main thread.
   188  ///
   189  typedef struct _cef_domnode_t {
   190    ///
   191    // Base structure.
   192    ///
   193    cef_base_t base;
   194  
   195    ///
   196    // Returns the type for this node.
   197    ///
   198    cef_dom_node_type_t (CEF_CALLBACK *get_type)(struct _cef_domnode_t* self);
   199  
   200    ///
   201    // Returns true (1) if this is a text node.
   202    ///
   203    int (CEF_CALLBACK *is_text)(struct _cef_domnode_t* self);
   204  
   205    ///
   206    // Returns true (1) if this is an element node.
   207    ///
   208    int (CEF_CALLBACK *is_element)(struct _cef_domnode_t* self);
   209  
   210    ///
   211    // Returns true (1) if this is an editable node.
   212    ///
   213    int (CEF_CALLBACK *is_editable)(struct _cef_domnode_t* self);
   214  
   215    ///
   216    // Returns true (1) if this is a form control element node.
   217    ///
   218    int (CEF_CALLBACK *is_form_control_element)(struct _cef_domnode_t* self);
   219  
   220    ///
   221    // Returns the type of this form control element node.
   222    ///
   223    // The resulting string must be freed by calling cef_string_userfree_free().
   224    cef_string_userfree_t (CEF_CALLBACK *get_form_control_element_type)(
   225        struct _cef_domnode_t* self);
   226  
   227    ///
   228    // Returns true (1) if this object is pointing to the same handle as |that|
   229    // object.
   230    ///
   231    int (CEF_CALLBACK *is_same)(struct _cef_domnode_t* self,
   232        struct _cef_domnode_t* that);
   233  
   234    ///
   235    // Returns the name of this node.
   236    ///
   237    // The resulting string must be freed by calling cef_string_userfree_free().
   238    cef_string_userfree_t (CEF_CALLBACK *get_name)(struct _cef_domnode_t* self);
   239  
   240    ///
   241    // Returns the value of this node.
   242    ///
   243    // The resulting string must be freed by calling cef_string_userfree_free().
   244    cef_string_userfree_t (CEF_CALLBACK *get_value)(struct _cef_domnode_t* self);
   245  
   246    ///
   247    // Set the value of this node. Returns true (1) on success.
   248    ///
   249    int (CEF_CALLBACK *set_value)(struct _cef_domnode_t* self,
   250        const cef_string_t* value);
   251  
   252    ///
   253    // Returns the contents of this node as markup.
   254    ///
   255    // The resulting string must be freed by calling cef_string_userfree_free().
   256    cef_string_userfree_t (CEF_CALLBACK *get_as_markup)(
   257        struct _cef_domnode_t* self);
   258  
   259    ///
   260    // Returns the document associated with this node.
   261    ///
   262    struct _cef_domdocument_t* (CEF_CALLBACK *get_document)(
   263        struct _cef_domnode_t* self);
   264  
   265    ///
   266    // Returns the parent node.
   267    ///
   268    struct _cef_domnode_t* (CEF_CALLBACK *get_parent)(
   269        struct _cef_domnode_t* self);
   270  
   271    ///
   272    // Returns the previous sibling node.
   273    ///
   274    struct _cef_domnode_t* (CEF_CALLBACK *get_previous_sibling)(
   275        struct _cef_domnode_t* self);
   276  
   277    ///
   278    // Returns the next sibling node.
   279    ///
   280    struct _cef_domnode_t* (CEF_CALLBACK *get_next_sibling)(
   281        struct _cef_domnode_t* self);
   282  
   283    ///
   284    // Returns true (1) if this node has child nodes.
   285    ///
   286    int (CEF_CALLBACK *has_children)(struct _cef_domnode_t* self);
   287  
   288    ///
   289    // Return the first child node.
   290    ///
   291    struct _cef_domnode_t* (CEF_CALLBACK *get_first_child)(
   292        struct _cef_domnode_t* self);
   293  
   294    ///
   295    // Returns the last child node.
   296    ///
   297    struct _cef_domnode_t* (CEF_CALLBACK *get_last_child)(
   298        struct _cef_domnode_t* self);
   299  
   300    ///
   301    // Add an event listener to this node for the specified event type. If
   302    // |useCapture| is true (1) then this listener will be considered a capturing
   303    // listener. Capturing listeners will recieve all events of the specified type
   304    // before the events are dispatched to any other event targets beneath the
   305    // current node in the tree. Events which are bubbling upwards through the
   306    // tree will not trigger a capturing listener. Separate calls to this function
   307    // can be used to register the same listener with and without capture. See
   308    // WebCore/dom/EventNames.h for the list of supported event types.
   309    ///
   310    void (CEF_CALLBACK *add_event_listener)(struct _cef_domnode_t* self,
   311        const cef_string_t* eventType, struct _cef_domevent_listener_t* listener,
   312        int useCapture);
   313  
   314  
   315    // The following functions are valid only for element nodes.
   316  
   317    ///
   318    // Returns the tag name of this element.
   319    ///
   320    // The resulting string must be freed by calling cef_string_userfree_free().
   321    cef_string_userfree_t (CEF_CALLBACK *get_element_tag_name)(
   322        struct _cef_domnode_t* self);
   323  
   324    ///
   325    // Returns true (1) if this element has attributes.
   326    ///
   327    int (CEF_CALLBACK *has_element_attributes)(struct _cef_domnode_t* self);
   328  
   329    ///
   330    // Returns true (1) if this element has an attribute named |attrName|.
   331    ///
   332    int (CEF_CALLBACK *has_element_attribute)(struct _cef_domnode_t* self,
   333        const cef_string_t* attrName);
   334  
   335    ///
   336    // Returns the element attribute named |attrName|.
   337    ///
   338    // The resulting string must be freed by calling cef_string_userfree_free().
   339    cef_string_userfree_t (CEF_CALLBACK *get_element_attribute)(
   340        struct _cef_domnode_t* self, const cef_string_t* attrName);
   341  
   342    ///
   343    // Returns a map of all element attributes.
   344    ///
   345    void (CEF_CALLBACK *get_element_attributes)(struct _cef_domnode_t* self,
   346        cef_string_map_t attrMap);
   347  
   348    ///
   349    // Set the value for the element attribute named |attrName|. Returns true (1)
   350    // on success.
   351    ///
   352    int (CEF_CALLBACK *set_element_attribute)(struct _cef_domnode_t* self,
   353        const cef_string_t* attrName, const cef_string_t* value);
   354  
   355    ///
   356    // Returns the inner text of the element.
   357    ///
   358    // The resulting string must be freed by calling cef_string_userfree_free().
   359    cef_string_userfree_t (CEF_CALLBACK *get_element_inner_text)(
   360        struct _cef_domnode_t* self);
   361  } cef_domnode_t;
   362  
   363  
   364  ///
   365  // Structure used to represent a DOM event. The functions of this structure
   366  // should only be called on the render process main thread.
   367  ///
   368  typedef struct _cef_domevent_t {
   369    ///
   370    // Base structure.
   371    ///
   372    cef_base_t base;
   373  
   374    ///
   375    // Returns the event type.
   376    ///
   377    // The resulting string must be freed by calling cef_string_userfree_free().
   378    cef_string_userfree_t (CEF_CALLBACK *get_type)(struct _cef_domevent_t* self);
   379  
   380    ///
   381    // Returns the event category.
   382    ///
   383    cef_dom_event_category_t (CEF_CALLBACK *get_category)(
   384        struct _cef_domevent_t* self);
   385  
   386    ///
   387    // Returns the event processing phase.
   388    ///
   389    cef_dom_event_phase_t (CEF_CALLBACK *get_phase)(struct _cef_domevent_t* self);
   390  
   391    ///
   392    // Returns true (1) if the event can bubble up the tree.
   393    ///
   394    int (CEF_CALLBACK *can_bubble)(struct _cef_domevent_t* self);
   395  
   396    ///
   397    // Returns true (1) if the event can be canceled.
   398    ///
   399    int (CEF_CALLBACK *can_cancel)(struct _cef_domevent_t* self);
   400  
   401    ///
   402    // Returns the document associated with this event.
   403    ///
   404    struct _cef_domdocument_t* (CEF_CALLBACK *get_document)(
   405        struct _cef_domevent_t* self);
   406  
   407    ///
   408    // Returns the target of the event.
   409    ///
   410    struct _cef_domnode_t* (CEF_CALLBACK *get_target)(
   411        struct _cef_domevent_t* self);
   412  
   413    ///
   414    // Returns the current target of the event.
   415    ///
   416    struct _cef_domnode_t* (CEF_CALLBACK *get_current_target)(
   417        struct _cef_domevent_t* self);
   418  } cef_domevent_t;
   419  
   420  
   421  ///
   422  // Structure to implement for handling DOM events. The functions of this
   423  // structure will be called on the render process main thread.
   424  ///
   425  typedef struct _cef_domevent_listener_t {
   426    ///
   427    // Base structure.
   428    ///
   429    cef_base_t base;
   430  
   431    ///
   432    // Called when an event is received. The event object passed to this function
   433    // contains a snapshot of the DOM at the time this function is executed. DOM
   434    // objects are only valid for the scope of this function. Do not keep
   435    // references to or attempt to access any DOM objects outside the scope of
   436    // this function.
   437    ///
   438    void (CEF_CALLBACK *handle_event)(struct _cef_domevent_listener_t* self,
   439        struct _cef_domevent_t* event);
   440  } cef_domevent_listener_t;
   441  
   442  
   443  #ifdef __cplusplus
   444  }
   445  #endif
   446  
   447  #endif  // CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_