github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_browser_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_BROWSER_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
    39  #pragma once
    40  
    41  #ifdef __cplusplus
    42  extern "C" {
    43  #endif
    44  
    45  #include "include/capi/cef_base_capi.h"
    46  #include "include/capi/cef_frame_capi.h"
    47  #include "include/capi/cef_process_message_capi.h"
    48  #include "include/capi/cef_request_context_capi.h"
    49  
    50  struct _cef_browser_host_t;
    51  struct _cef_client_t;
    52  
    53  ///
    54  // Structure used to represent a browser window. When used in the browser
    55  // process the functions of this structure may be called on any thread unless
    56  // otherwise indicated in the comments. When used in the render process the
    57  // functions of this structure may only be called on the main thread.
    58  ///
    59  typedef struct _cef_browser_t {
    60    ///
    61    // Base structure.
    62    ///
    63    cef_base_t base;
    64  
    65    ///
    66    // Returns the browser host object. This function can only be called in the
    67    // browser process.
    68    ///
    69    struct _cef_browser_host_t* (CEF_CALLBACK *get_host)(
    70        struct _cef_browser_t* self);
    71  
    72    ///
    73    // Returns true (1) if the browser can navigate backwards.
    74    ///
    75    int (CEF_CALLBACK *can_go_back)(struct _cef_browser_t* self);
    76  
    77    ///
    78    // Navigate backwards.
    79    ///
    80    void (CEF_CALLBACK *go_back)(struct _cef_browser_t* self);
    81  
    82    ///
    83    // Returns true (1) if the browser can navigate forwards.
    84    ///
    85    int (CEF_CALLBACK *can_go_forward)(struct _cef_browser_t* self);
    86  
    87    ///
    88    // Navigate forwards.
    89    ///
    90    void (CEF_CALLBACK *go_forward)(struct _cef_browser_t* self);
    91  
    92    ///
    93    // Returns true (1) if the browser is currently loading.
    94    ///
    95    int (CEF_CALLBACK *is_loading)(struct _cef_browser_t* self);
    96  
    97    ///
    98    // Reload the current page.
    99    ///
   100    void (CEF_CALLBACK *reload)(struct _cef_browser_t* self);
   101  
   102    ///
   103    // Reload the current page ignoring any cached data.
   104    ///
   105    void (CEF_CALLBACK *reload_ignore_cache)(struct _cef_browser_t* self);
   106  
   107    ///
   108    // Stop loading the page.
   109    ///
   110    void (CEF_CALLBACK *stop_load)(struct _cef_browser_t* self);
   111  
   112    ///
   113    // Returns the globally unique identifier for this browser.
   114    ///
   115    int (CEF_CALLBACK *get_identifier)(struct _cef_browser_t* self);
   116  
   117    ///
   118    // Returns true (1) if this object is pointing to the same handle as |that|
   119    // object.
   120    ///
   121    int (CEF_CALLBACK *is_same)(struct _cef_browser_t* self,
   122        struct _cef_browser_t* that);
   123  
   124    ///
   125    // Returns true (1) if the window is a popup window.
   126    ///
   127    int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self);
   128  
   129    ///
   130    // Returns true (1) if a document has been loaded in the browser.
   131    ///
   132    int (CEF_CALLBACK *has_document)(struct _cef_browser_t* self);
   133  
   134    ///
   135    // Returns the main (top-level) frame for the browser window.
   136    ///
   137    struct _cef_frame_t* (CEF_CALLBACK *get_main_frame)(
   138        struct _cef_browser_t* self);
   139  
   140    ///
   141    // Returns the focused frame for the browser window.
   142    ///
   143    struct _cef_frame_t* (CEF_CALLBACK *get_focused_frame)(
   144        struct _cef_browser_t* self);
   145  
   146    ///
   147    // Returns the frame with the specified identifier, or NULL if not found.
   148    ///
   149    struct _cef_frame_t* (CEF_CALLBACK *get_frame_byident)(
   150        struct _cef_browser_t* self, int64 identifier);
   151  
   152    ///
   153    // Returns the frame with the specified name, or NULL if not found.
   154    ///
   155    struct _cef_frame_t* (CEF_CALLBACK *get_frame)(struct _cef_browser_t* self,
   156        const cef_string_t* name);
   157  
   158    ///
   159    // Returns the number of frames that currently exist.
   160    ///
   161    size_t (CEF_CALLBACK *get_frame_count)(struct _cef_browser_t* self);
   162  
   163    ///
   164    // Returns the identifiers of all existing frames.
   165    ///
   166    void (CEF_CALLBACK *get_frame_identifiers)(struct _cef_browser_t* self,
   167        size_t* identifiersCount, int64* identifiers);
   168  
   169    ///
   170    // Returns the names of all existing frames.
   171    ///
   172    void (CEF_CALLBACK *get_frame_names)(struct _cef_browser_t* self,
   173        cef_string_list_t names);
   174  
   175    //
   176    // Send a message to the specified |target_process|. Returns true (1) if the
   177    // message was sent successfully.
   178    ///
   179    int (CEF_CALLBACK *send_process_message)(struct _cef_browser_t* self,
   180        cef_process_id_t target_process,
   181        struct _cef_process_message_t* message);
   182  } cef_browser_t;
   183  
   184  
   185  ///
   186  // Callback structure for cef_browser_host_t::RunFileDialog. The functions of
   187  // this structure will be called on the browser process UI thread.
   188  ///
   189  typedef struct _cef_run_file_dialog_callback_t {
   190    ///
   191    // Base structure.
   192    ///
   193    cef_base_t base;
   194  
   195    ///
   196    // Called asynchronously after the file dialog is dismissed. If the selection
   197    // was successful |file_paths| will be a single value or a list of values
   198    // depending on the dialog mode. If the selection was cancelled |file_paths|
   199    // will be NULL.
   200    ///
   201    void (CEF_CALLBACK *cont)(struct _cef_run_file_dialog_callback_t* self,
   202        struct _cef_browser_host_t* browser_host, cef_string_list_t file_paths);
   203  } cef_run_file_dialog_callback_t;
   204  
   205  
   206  ///
   207  // Structure used to represent the browser process aspects of a browser window.
   208  // The functions of this structure can only be called in the browser process.
   209  // They may be called on any thread in that process unless otherwise indicated
   210  // in the comments.
   211  ///
   212  typedef struct _cef_browser_host_t {
   213    ///
   214    // Base structure.
   215    ///
   216    cef_base_t base;
   217  
   218    ///
   219    // Returns the hosted browser object.
   220    ///
   221    struct _cef_browser_t* (CEF_CALLBACK *get_browser)(
   222        struct _cef_browser_host_t* self);
   223  
   224    ///
   225    // Call this function before destroying a contained browser window. This
   226    // function performs any internal cleanup that may be needed before the
   227    // browser window is destroyed. See cef_life_span_handler_t::do_close()
   228    // documentation for additional usage information.
   229    ///
   230    void (CEF_CALLBACK *parent_window_will_close)(
   231        struct _cef_browser_host_t* self);
   232  
   233    ///
   234    // Request that the browser close. The JavaScript 'onbeforeunload' event will
   235    // be fired. If |force_close| is false (0) the event handler, if any, will be
   236    // allowed to prompt the user and the user can optionally cancel the close. If
   237    // |force_close| is true (1) the prompt will not be displayed and the close
   238    // will proceed. Results in a call to cef_life_span_handler_t::do_close() if
   239    // the event handler allows the close or if |force_close| is true (1). See
   240    // cef_life_span_handler_t::do_close() documentation for additional usage
   241    // information.
   242    ///
   243    void (CEF_CALLBACK *close_browser)(struct _cef_browser_host_t* self,
   244        int force_close);
   245  
   246    ///
   247    // Set focus for the browser window. If |enable| is true (1) focus will be set
   248    // to the window. Otherwise, focus will be removed.
   249    ///
   250    void (CEF_CALLBACK *set_focus)(struct _cef_browser_host_t* self, int enable);
   251  
   252    ///
   253    // Retrieve the window handle for this browser.
   254    ///
   255    cef_window_handle_t (CEF_CALLBACK *get_window_handle)(
   256        struct _cef_browser_host_t* self);
   257  
   258    ///
   259    // Retrieve the window handle of the browser that opened this browser. Will
   260    // return NULL for non-popup windows. This function can be used in combination
   261    // with custom handling of modal windows.
   262    ///
   263    cef_window_handle_t (CEF_CALLBACK *get_opener_window_handle)(
   264        struct _cef_browser_host_t* self);
   265  
   266    ///
   267    // Returns the client for this browser.
   268    ///
   269    struct _cef_client_t* (CEF_CALLBACK *get_client)(
   270        struct _cef_browser_host_t* self);
   271  
   272    ///
   273    // Returns the request context for this browser.
   274    ///
   275    struct _cef_request_context_t* (CEF_CALLBACK *get_request_context)(
   276        struct _cef_browser_host_t* self);
   277  
   278    ///
   279    // Get the current zoom level. The default zoom level is 0.0. This function
   280    // can only be called on the UI thread.
   281    ///
   282    double (CEF_CALLBACK *get_zoom_level)(struct _cef_browser_host_t* self);
   283  
   284    ///
   285    // Change the zoom level to the specified value. Specify 0.0 to reset the zoom
   286    // level. If called on the UI thread the change will be applied immediately.
   287    // Otherwise, the change will be applied asynchronously on the UI thread.
   288    ///
   289    void (CEF_CALLBACK *set_zoom_level)(struct _cef_browser_host_t* self,
   290        double zoomLevel);
   291  
   292    ///
   293    // Call to run a file chooser dialog. Only a single file chooser dialog may be
   294    // pending at any given time. |mode| represents the type of dialog to display.
   295    // |title| to the title to be used for the dialog and may be NULL to show the
   296    // default title ("Open" or "Save" depending on the mode). |default_file_name|
   297    // is the default file name to select in the dialog. |accept_types| is a list
   298    // of valid lower-cased MIME types or file extensions specified in an input
   299    // element and is used to restrict selectable files to such types. |callback|
   300    // will be executed after the dialog is dismissed or immediately if another
   301    // dialog is already pending. The dialog will be initiated asynchronously on
   302    // the UI thread.
   303    ///
   304    void (CEF_CALLBACK *run_file_dialog)(struct _cef_browser_host_t* self,
   305        cef_file_dialog_mode_t mode, const cef_string_t* title,
   306        const cef_string_t* default_file_name, cef_string_list_t accept_types,
   307        struct _cef_run_file_dialog_callback_t* callback);
   308  
   309    ///
   310    // Download the file at |url| using cef_download_handler_t.
   311    ///
   312    void (CEF_CALLBACK *start_download)(struct _cef_browser_host_t* self,
   313        const cef_string_t* url);
   314  
   315    ///
   316    // Print the current browser contents.
   317    ///
   318    void (CEF_CALLBACK *print)(struct _cef_browser_host_t* self);
   319  
   320    ///
   321    // Search for |searchText|. |identifier| can be used to have multiple searches
   322    // running simultaniously. |forward| indicates whether to search forward or
   323    // backward within the page. |matchCase| indicates whether the search should
   324    // be case-sensitive. |findNext| indicates whether this is the first request
   325    // or a follow-up.
   326    ///
   327    void (CEF_CALLBACK *find)(struct _cef_browser_host_t* self, int identifier,
   328        const cef_string_t* searchText, int forward, int matchCase,
   329        int findNext);
   330  
   331    ///
   332    // Cancel all searches that are currently going on.
   333    ///
   334    void (CEF_CALLBACK *stop_finding)(struct _cef_browser_host_t* self,
   335        int clearSelection);
   336  
   337    ///
   338    // Open developer tools in its own window.
   339    ///
   340    void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_host_t* self,
   341        const struct _cef_window_info_t* windowInfo,
   342        struct _cef_client_t* client,
   343        const struct _cef_browser_settings_t* settings);
   344  
   345    ///
   346    // Explicitly close the developer tools window if one exists for this browser
   347    // instance.
   348    ///
   349    void (CEF_CALLBACK *close_dev_tools)(struct _cef_browser_host_t* self);
   350  
   351    ///
   352    // Set whether mouse cursor change is disabled.
   353    ///
   354    void (CEF_CALLBACK *set_mouse_cursor_change_disabled)(
   355        struct _cef_browser_host_t* self, int disabled);
   356  
   357    ///
   358    // Returns true (1) if mouse cursor change is disabled.
   359    ///
   360    int (CEF_CALLBACK *is_mouse_cursor_change_disabled)(
   361        struct _cef_browser_host_t* self);
   362  
   363    ///
   364    // Returns true (1) if window rendering is disabled.
   365    ///
   366    int (CEF_CALLBACK *is_window_rendering_disabled)(
   367        struct _cef_browser_host_t* self);
   368  
   369    ///
   370    // Notify the browser that the widget has been resized. The browser will first
   371    // call cef_render_handler_t::GetViewRect to get the new size and then call
   372    // cef_render_handler_t::OnPaint asynchronously with the updated regions. This
   373    // function is only used when window rendering is disabled.
   374    ///
   375    void (CEF_CALLBACK *was_resized)(struct _cef_browser_host_t* self);
   376  
   377    ///
   378    // Notify the browser that it has been hidden or shown. Layouting and
   379    // cef_render_handler_t::OnPaint notification will stop when the browser is
   380    // hidden. This function is only used when window rendering is disabled.
   381    ///
   382    void (CEF_CALLBACK *was_hidden)(struct _cef_browser_host_t* self, int hidden);
   383  
   384    ///
   385    // Send a notification to the browser that the screen info has changed. The
   386    // browser will then call cef_render_handler_t::GetScreenInfo to update the
   387    // screen information with the new values. This simulates moving the webview
   388    // window from one display to another, or changing the properties of the
   389    // current display. This function is only used when window rendering is
   390    // disabled.
   391    ///
   392    void (CEF_CALLBACK *notify_screen_info_changed)(
   393        struct _cef_browser_host_t* self);
   394  
   395    ///
   396    // Invalidate the |dirtyRect| region of the view. The browser will call
   397    // cef_render_handler_t::OnPaint asynchronously with the updated regions. This
   398    // function is only used when window rendering is disabled.
   399    ///
   400    void (CEF_CALLBACK *invalidate)(struct _cef_browser_host_t* self,
   401        const cef_rect_t* dirtyRect, cef_paint_element_type_t type);
   402  
   403    ///
   404    // Send a key event to the browser.
   405    ///
   406    void (CEF_CALLBACK *send_key_event)(struct _cef_browser_host_t* self,
   407        const struct _cef_key_event_t* event);
   408  
   409    ///
   410    // Send a mouse click event to the browser. The |x| and |y| coordinates are
   411    // relative to the upper-left corner of the view.
   412    ///
   413    void (CEF_CALLBACK *send_mouse_click_event)(struct _cef_browser_host_t* self,
   414        const struct _cef_mouse_event_t* event, cef_mouse_button_type_t type,
   415        int mouseUp, int clickCount);
   416  
   417    ///
   418    // Send a mouse move event to the browser. The |x| and |y| coordinates are
   419    // relative to the upper-left corner of the view.
   420    ///
   421    void (CEF_CALLBACK *send_mouse_move_event)(struct _cef_browser_host_t* self,
   422        const struct _cef_mouse_event_t* event, int mouseLeave);
   423  
   424    ///
   425    // Send a mouse wheel event to the browser. The |x| and |y| coordinates are
   426    // relative to the upper-left corner of the view. The |deltaX| and |deltaY|
   427    // values represent the movement delta in the X and Y directions respectively.
   428    // In order to scroll inside select popups with window rendering disabled
   429    // cef_render_handler_t::GetScreenPoint should be implemented properly.
   430    ///
   431    void (CEF_CALLBACK *send_mouse_wheel_event)(struct _cef_browser_host_t* self,
   432        const struct _cef_mouse_event_t* event, int deltaX, int deltaY);
   433  
   434    ///
   435    // Send a focus event to the browser.
   436    ///
   437    void (CEF_CALLBACK *send_focus_event)(struct _cef_browser_host_t* self,
   438        int setFocus);
   439  
   440    ///
   441    // Send a capture lost event to the browser.
   442    ///
   443    void (CEF_CALLBACK *send_capture_lost_event)(
   444        struct _cef_browser_host_t* self);
   445  
   446    ///
   447    // Get the NSTextInputContext implementation for enabling IME on Mac when
   448    // window rendering is disabled.
   449    ///
   450    cef_text_input_context_t (CEF_CALLBACK *get_nstext_input_context)(
   451        struct _cef_browser_host_t* self);
   452  
   453    ///
   454    // Handles a keyDown event prior to passing it through the NSTextInputClient
   455    // machinery.
   456    ///
   457    void (CEF_CALLBACK *handle_key_event_before_text_input_client)(
   458        struct _cef_browser_host_t* self, cef_event_handle_t keyEvent);
   459  
   460    ///
   461    // Performs any additional actions after NSTextInputClient handles the event.
   462    ///
   463    void (CEF_CALLBACK *handle_key_event_after_text_input_client)(
   464        struct _cef_browser_host_t* self, cef_event_handle_t keyEvent);
   465  } cef_browser_host_t;
   466  
   467  
   468  ///
   469  // Create a new browser window using the window parameters specified by
   470  // |windowInfo|. All values will be copied internally and the actual window will
   471  // be created on the UI thread. If |request_context| is NULL the global request
   472  // context will be used. This function can be called on any browser process
   473  // thread and will not block.
   474  ///
   475  CEF_EXPORT int cef_browser_host_create_browser(
   476      const cef_window_info_t* windowInfo, struct _cef_client_t* client,
   477      const cef_string_t* url, const struct _cef_browser_settings_t* settings,
   478      struct _cef_request_context_t* request_context);
   479  
   480  ///
   481  // Create a new browser window using the window parameters specified by
   482  // |windowInfo|. If |request_context| is NULL the global request context will be
   483  // used. This function can only be called on the browser process UI thread.
   484  ///
   485  CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync(
   486      const cef_window_info_t* windowInfo, struct _cef_client_t* client,
   487      const cef_string_t* url, const struct _cef_browser_settings_t* settings,
   488      struct _cef_request_context_t* request_context);
   489  
   490  
   491  #ifdef __cplusplus
   492  }
   493  #endif
   494  
   495  #endif  // CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_