1 // Copyright (c) 2022 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 // $hash=b80e84c0039ab45d5c4562d64b67a84766c0dab3$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 #include "include/capi/cef_devtools_message_observer_capi.h" 45 #include "include/capi/cef_drag_data_capi.h" 46 #include "include/capi/cef_frame_capi.h" 47 #include "include/capi/cef_image_capi.h" 48 #include "include/capi/cef_navigation_entry_capi.h" 49 #include "include/capi/cef_registration_capi.h" 50 #include "include/capi/cef_request_context_capi.h" 51 52 #ifdef __cplusplus 53 extern "C" { 54 #endif 55 56 struct _cef_browser_host_t; 57 struct _cef_client_t; 58 59 /// 60 // Structure used to represent a browser. When used in the browser process the 61 // functions of this structure may be called on any thread unless otherwise 62 // indicated in the comments. When used in the render process the functions of 63 // this structure may only be called on the main thread. 64 /// 65 typedef struct _cef_browser_t { 66 /// 67 // Base structure. 68 /// 69 cef_base_ref_counted_t base; 70 71 /// 72 // True if this object is currently valid. This will return false (0) after 73 // cef_life_span_handler_t::OnBeforeClose is called. 74 /// 75 int(CEF_CALLBACK* is_valid)(struct _cef_browser_t* self); 76 77 /// 78 // Returns the browser host object. This function can only be called in the 79 // browser process. 80 /// 81 struct _cef_browser_host_t*(CEF_CALLBACK* get_host)( 82 struct _cef_browser_t* self); 83 84 /// 85 // Returns true (1) if the browser can navigate backwards. 86 /// 87 int(CEF_CALLBACK* can_go_back)(struct _cef_browser_t* self); 88 89 /// 90 // Navigate backwards. 91 /// 92 void(CEF_CALLBACK* go_back)(struct _cef_browser_t* self); 93 94 /// 95 // Returns true (1) if the browser can navigate forwards. 96 /// 97 int(CEF_CALLBACK* can_go_forward)(struct _cef_browser_t* self); 98 99 /// 100 // Navigate forwards. 101 /// 102 void(CEF_CALLBACK* go_forward)(struct _cef_browser_t* self); 103 104 /// 105 // Returns true (1) if the browser is currently loading. 106 /// 107 int(CEF_CALLBACK* is_loading)(struct _cef_browser_t* self); 108 109 /// 110 // Reload the current page. 111 /// 112 void(CEF_CALLBACK* reload)(struct _cef_browser_t* self); 113 114 /// 115 // Reload the current page ignoring any cached data. 116 /// 117 void(CEF_CALLBACK* reload_ignore_cache)(struct _cef_browser_t* self); 118 119 /// 120 // Stop loading the page. 121 /// 122 void(CEF_CALLBACK* stop_load)(struct _cef_browser_t* self); 123 124 /// 125 // Returns the globally unique identifier for this browser. This value is also 126 // used as the tabId for extension APIs. 127 /// 128 int(CEF_CALLBACK* get_identifier)(struct _cef_browser_t* self); 129 130 /// 131 // Returns true (1) if this object is pointing to the same handle as |that| 132 // object. 133 /// 134 int(CEF_CALLBACK* is_same)(struct _cef_browser_t* self, 135 struct _cef_browser_t* that); 136 137 /// 138 // Returns true (1) if the browser is a popup. 139 /// 140 int(CEF_CALLBACK* is_popup)(struct _cef_browser_t* self); 141 142 /// 143 // Returns true (1) if a document has been loaded in the browser. 144 /// 145 int(CEF_CALLBACK* has_document)(struct _cef_browser_t* self); 146 147 /// 148 // Returns the main (top-level) frame for the browser. In the browser process 149 // this will return a valid object until after 150 // cef_life_span_handler_t::OnBeforeClose is called. In the renderer process 151 // this will return NULL if the main frame is hosted in a different renderer 152 // process (e.g. for cross-origin sub-frames). The main frame object will 153 // change during cross-origin navigation or re-navigation after renderer 154 // process termination (due to crashes, etc). 155 /// 156 struct _cef_frame_t*(CEF_CALLBACK* get_main_frame)( 157 struct _cef_browser_t* self); 158 159 /// 160 // Returns the focused frame for the browser. 161 /// 162 struct _cef_frame_t*(CEF_CALLBACK* get_focused_frame)( 163 struct _cef_browser_t* self); 164 165 /// 166 // Returns the frame with the specified identifier, or NULL if not found. 167 /// 168 struct _cef_frame_t*(CEF_CALLBACK* get_frame_byident)( 169 struct _cef_browser_t* self, 170 int64 identifier); 171 172 /// 173 // Returns the frame with the specified name, or NULL if not found. 174 /// 175 struct _cef_frame_t*(CEF_CALLBACK* get_frame)(struct _cef_browser_t* self, 176 const cef_string_t* name); 177 178 /// 179 // Returns the number of frames that currently exist. 180 /// 181 size_t(CEF_CALLBACK* get_frame_count)(struct _cef_browser_t* self); 182 183 /// 184 // Returns the identifiers of all existing frames. 185 /// 186 void(CEF_CALLBACK* get_frame_identifiers)(struct _cef_browser_t* self, 187 size_t* identifiersCount, 188 int64* identifiers); 189 190 /// 191 // Returns the names of all existing frames. 192 /// 193 void(CEF_CALLBACK* get_frame_names)(struct _cef_browser_t* self, 194 cef_string_list_t names); 195 } cef_browser_t; 196 197 /// 198 // Callback structure for cef_browser_host_t::RunFileDialog. The functions of 199 // this structure will be called on the browser process UI thread. 200 /// 201 typedef struct _cef_run_file_dialog_callback_t { 202 /// 203 // Base structure. 204 /// 205 cef_base_ref_counted_t base; 206 207 /// 208 // Called asynchronously after the file dialog is dismissed. 209 // |selected_accept_filter| is the 0-based index of the value selected from 210 // the accept filters array passed to cef_browser_host_t::RunFileDialog. 211 // |file_paths| will be a single value or a list of values depending on the 212 // dialog mode. If the selection was cancelled |file_paths| will be NULL. 213 /// 214 void(CEF_CALLBACK* on_file_dialog_dismissed)( 215 struct _cef_run_file_dialog_callback_t* self, 216 int selected_accept_filter, 217 cef_string_list_t file_paths); 218 } cef_run_file_dialog_callback_t; 219 220 /// 221 // Callback structure for cef_browser_host_t::GetNavigationEntries. The 222 // functions of this structure will be called on the browser process UI thread. 223 /// 224 typedef struct _cef_navigation_entry_visitor_t { 225 /// 226 // Base structure. 227 /// 228 cef_base_ref_counted_t base; 229 230 /// 231 // Method that will be executed. Do not keep a reference to |entry| outside of 232 // this callback. Return true (1) to continue visiting entries or false (0) to 233 // stop. |current| is true (1) if this entry is the currently loaded 234 // navigation entry. |index| is the 0-based index of this entry and |total| is 235 // the total number of entries. 236 /// 237 int(CEF_CALLBACK* visit)(struct _cef_navigation_entry_visitor_t* self, 238 struct _cef_navigation_entry_t* entry, 239 int current, 240 int index, 241 int total); 242 } cef_navigation_entry_visitor_t; 243 244 /// 245 // Callback structure for cef_browser_host_t::PrintToPDF. The functions of this 246 // structure will be called on the browser process UI thread. 247 /// 248 typedef struct _cef_pdf_print_callback_t { 249 /// 250 // Base structure. 251 /// 252 cef_base_ref_counted_t base; 253 254 /// 255 // Method that will be executed when the PDF printing has completed. |path| is 256 // the output path. |ok| will be true (1) if the printing completed 257 // successfully or false (0) otherwise. 258 /// 259 void(CEF_CALLBACK* on_pdf_print_finished)( 260 struct _cef_pdf_print_callback_t* self, 261 const cef_string_t* path, 262 int ok); 263 } cef_pdf_print_callback_t; 264 265 /// 266 // Callback structure for cef_browser_host_t::DownloadImage. The functions of 267 // this structure will be called on the browser process UI thread. 268 /// 269 typedef struct _cef_download_image_callback_t { 270 /// 271 // Base structure. 272 /// 273 cef_base_ref_counted_t base; 274 275 /// 276 // Method that will be executed when the image download has completed. 277 // |image_url| is the URL that was downloaded and |http_status_code| is the 278 // resulting HTTP status code. |image| is the resulting image, possibly at 279 // multiple scale factors, or NULL if the download failed. 280 /// 281 void(CEF_CALLBACK* on_download_image_finished)( 282 struct _cef_download_image_callback_t* self, 283 const cef_string_t* image_url, 284 int http_status_code, 285 struct _cef_image_t* image); 286 } cef_download_image_callback_t; 287 288 /// 289 // Structure used to represent the browser process aspects of a browser. The 290 // functions of this structure can only be called in the browser process. They 291 // may be called on any thread in that process unless otherwise indicated in the 292 // comments. 293 /// 294 typedef struct _cef_browser_host_t { 295 /// 296 // Base structure. 297 /// 298 cef_base_ref_counted_t base; 299 300 /// 301 // Returns the hosted browser object. 302 /// 303 struct _cef_browser_t*(CEF_CALLBACK* get_browser)( 304 struct _cef_browser_host_t* self); 305 306 /// 307 // Request that the browser close. The JavaScript 'onbeforeunload' event will 308 // be fired. If |force_close| is false (0) the event handler, if any, will be 309 // allowed to prompt the user and the user can optionally cancel the close. If 310 // |force_close| is true (1) the prompt will not be displayed and the close 311 // will proceed. Results in a call to cef_life_span_handler_t::do_close() if 312 // the event handler allows the close or if |force_close| is true (1). See 313 // cef_life_span_handler_t::do_close() documentation for additional usage 314 // information. 315 /// 316 void(CEF_CALLBACK* close_browser)(struct _cef_browser_host_t* self, 317 int force_close); 318 319 /// 320 // Helper for closing a browser. Call this function from the top-level window 321 // close handler (if any). Internally this calls CloseBrowser(false (0)) if 322 // the close has not yet been initiated. This function returns false (0) while 323 // the close is pending and true (1) after the close has completed. See 324 // close_browser() and cef_life_span_handler_t::do_close() documentation for 325 // additional usage information. This function must be called on the browser 326 // process UI thread. 327 /// 328 int(CEF_CALLBACK* try_close_browser)(struct _cef_browser_host_t* self); 329 330 /// 331 // Set whether the browser is focused. 332 /// 333 void(CEF_CALLBACK* set_focus)(struct _cef_browser_host_t* self, int focus); 334 335 /// 336 // Retrieve the window handle (if any) for this browser. If this browser is 337 // wrapped in a cef_browser_view_t this function should be called on the 338 // browser process UI thread and it will return the handle for the top-level 339 // native window. 340 /// 341 cef_window_handle_t(CEF_CALLBACK* get_window_handle)( 342 struct _cef_browser_host_t* self); 343 344 /// 345 // Retrieve the window handle (if any) of the browser that opened this 346 // browser. Will return NULL for non-popup browsers or if this browser is 347 // wrapped in a cef_browser_view_t. This function can be used in combination 348 // with custom handling of modal windows. 349 /// 350 cef_window_handle_t(CEF_CALLBACK* get_opener_window_handle)( 351 struct _cef_browser_host_t* self); 352 353 /// 354 // Returns true (1) if this browser is wrapped in a cef_browser_view_t. 355 /// 356 int(CEF_CALLBACK* has_view)(struct _cef_browser_host_t* self); 357 358 /// 359 // Returns the client for this browser. 360 /// 361 struct _cef_client_t*(CEF_CALLBACK* get_client)( 362 struct _cef_browser_host_t* self); 363 364 /// 365 // Returns the request context for this browser. 366 /// 367 struct _cef_request_context_t*(CEF_CALLBACK* get_request_context)( 368 struct _cef_browser_host_t* self); 369 370 /// 371 // Get the current zoom level. The default zoom level is 0.0. This function 372 // can only be called on the UI thread. 373 /// 374 double(CEF_CALLBACK* get_zoom_level)(struct _cef_browser_host_t* self); 375 376 /// 377 // Change the zoom level to the specified value. Specify 0.0 to reset the zoom 378 // level. If called on the UI thread the change will be applied immediately. 379 // Otherwise, the change will be applied asynchronously on the UI thread. 380 /// 381 void(CEF_CALLBACK* set_zoom_level)(struct _cef_browser_host_t* self, 382 double zoomLevel); 383 384 /// 385 // Call to run a file chooser dialog. Only a single file chooser dialog may be 386 // pending at any given time. |mode| represents the type of dialog to display. 387 // |title| to the title to be used for the dialog and may be NULL to show the 388 // default title ("Open" or "Save" depending on the mode). |default_file_path| 389 // is the path with optional directory and/or file name component that will be 390 // initially selected in the dialog. |accept_filters| are used to restrict the 391 // selectable file types and may any combination of (a) valid lower-cased MIME 392 // types (e.g. "text/*" or "image/*"), (b) individual file extensions (e.g. 393 // ".txt" or ".png"), or (c) combined description and file extension delimited 394 // using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). 395 // |selected_accept_filter| is the 0-based index of the filter that will be 396 // selected by default. |callback| will be executed after the dialog is 397 // dismissed or immediately if another dialog is already pending. The dialog 398 // will be initiated asynchronously on the UI thread. 399 /// 400 void(CEF_CALLBACK* run_file_dialog)( 401 struct _cef_browser_host_t* self, 402 cef_file_dialog_mode_t mode, 403 const cef_string_t* title, 404 const cef_string_t* default_file_path, 405 cef_string_list_t accept_filters, 406 int selected_accept_filter, 407 struct _cef_run_file_dialog_callback_t* callback); 408 409 /// 410 // Download the file at |url| using cef_download_handler_t. 411 /// 412 void(CEF_CALLBACK* start_download)(struct _cef_browser_host_t* self, 413 const cef_string_t* url); 414 415 /// 416 // Download |image_url| and execute |callback| on completion with the images 417 // received from the renderer. If |is_favicon| is true (1) then cookies are 418 // not sent and not accepted during download. Images with density independent 419 // pixel (DIP) sizes larger than |max_image_size| are filtered out from the 420 // image results. Versions of the image at different scale factors may be 421 // downloaded up to the maximum scale factor supported by the system. If there 422 // are no image results <= |max_image_size| then the smallest image is resized 423 // to |max_image_size| and is the only result. A |max_image_size| of 0 means 424 // unlimited. If |bypass_cache| is true (1) then |image_url| is requested from 425 // the server even if it is present in the browser cache. 426 /// 427 void(CEF_CALLBACK* download_image)( 428 struct _cef_browser_host_t* self, 429 const cef_string_t* image_url, 430 int is_favicon, 431 uint32 max_image_size, 432 int bypass_cache, 433 struct _cef_download_image_callback_t* callback); 434 435 /// 436 // Print the current browser contents. 437 /// 438 void(CEF_CALLBACK* print)(struct _cef_browser_host_t* self); 439 440 /// 441 // Print the current browser contents to the PDF file specified by |path| and 442 // execute |callback| on completion. The caller is responsible for deleting 443 // |path| when done. For PDF printing to work on Linux you must implement the 444 // cef_print_handler_t::GetPdfPaperSize function. 445 /// 446 void(CEF_CALLBACK* print_to_pdf)( 447 struct _cef_browser_host_t* self, 448 const cef_string_t* path, 449 const struct _cef_pdf_print_settings_t* settings, 450 struct _cef_pdf_print_callback_t* callback); 451 452 /// 453 // Search for |searchText|. |forward| indicates whether to search forward or 454 // backward within the page. |matchCase| indicates whether the search should 455 // be case-sensitive. |findNext| indicates whether this is the first request 456 // or a follow-up. The search will be restarted if |searchText| or |matchCase| 457 // change. The search will be stopped if |searchText| is NULL. The 458 // cef_find_handler_t instance, if any, returned via 459 // cef_client_t::GetFindHandler will be called to report find results. 460 /// 461 void(CEF_CALLBACK* find)(struct _cef_browser_host_t* self, 462 const cef_string_t* searchText, 463 int forward, 464 int matchCase, 465 int findNext); 466 467 /// 468 // Cancel all searches that are currently going on. 469 /// 470 void(CEF_CALLBACK* stop_finding)(struct _cef_browser_host_t* self, 471 int clearSelection); 472 473 /// 474 // Open developer tools (DevTools) in its own browser. The DevTools browser 475 // will remain associated with this browser. If the DevTools browser is 476 // already open then it will be focused, in which case the |windowInfo|, 477 // |client| and |settings| parameters will be ignored. If |inspect_element_at| 478 // is non-NULL then the element at the specified (x,y) location will be 479 // inspected. The |windowInfo| parameter will be ignored if this browser is 480 // wrapped in a cef_browser_view_t. 481 /// 482 void(CEF_CALLBACK* show_dev_tools)( 483 struct _cef_browser_host_t* self, 484 const struct _cef_window_info_t* windowInfo, 485 struct _cef_client_t* client, 486 const struct _cef_browser_settings_t* settings, 487 const cef_point_t* inspect_element_at); 488 489 /// 490 // Explicitly close the associated DevTools browser, if any. 491 /// 492 void(CEF_CALLBACK* close_dev_tools)(struct _cef_browser_host_t* self); 493 494 /// 495 // Returns true (1) if this browser currently has an associated DevTools 496 // browser. Must be called on the browser process UI thread. 497 /// 498 int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self); 499 500 /// 501 // Send a function call message over the DevTools protocol. |message| must be 502 // a UTF8-encoded JSON dictionary that contains "id" (int), "function" 503 // (string) and "params" (dictionary, optional) values. See the DevTools 504 // protocol documentation at https://chromedevtools.github.io/devtools- 505 // protocol/ for details of supported functions and the expected "params" 506 // dictionary contents. |message| will be copied if necessary. This function 507 // will return true (1) if called on the UI thread and the message was 508 // successfully submitted for validation, otherwise false (0). Validation will 509 // be applied asynchronously and any messages that fail due to formatting 510 // errors or missing parameters may be discarded without notification. Prefer 511 // ExecuteDevToolsMethod if a more structured approach to message formatting 512 // is desired. 513 // 514 // Every valid function call will result in an asynchronous function result or 515 // error message that references the sent message "id". Event messages are 516 // received while notifications are enabled (for example, between function 517 // calls for "Page.enable" and "Page.disable"). All received messages will be 518 // delivered to the observer(s) registered with AddDevToolsMessageObserver. 519 // See cef_dev_tools_message_observer_t::OnDevToolsMessage documentation for 520 // details of received message contents. 521 // 522 // Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and 523 // AddDevToolsMessageObserver functions does not require an active DevTools 524 // front-end or remote-debugging session. Other active DevTools sessions will 525 // continue to function independently. However, any modification of global 526 // browser state by one session may not be reflected in the UI of other 527 // sessions. 528 // 529 // Communication with the DevTools front-end (when displayed) can be logged 530 // for development purposes by passing the `--devtools-protocol-log- 531 // file=<path>` command-line flag. 532 /// 533 int(CEF_CALLBACK* send_dev_tools_message)(struct _cef_browser_host_t* self, 534 const void* message, 535 size_t message_size); 536 537 /// 538 // Execute a function call over the DevTools protocol. This is a more 539 // structured version of SendDevToolsMessage. |message_id| is an incremental 540 // number that uniquely identifies the message (pass 0 to have the next number 541 // assigned automatically based on previous values). |function| is the 542 // function name. |params| are the function parameters, which may be NULL. See 543 // the DevTools protocol documentation (linked above) for details of supported 544 // functions and the expected |params| dictionary contents. This function will 545 // return the assigned message ID if called on the UI thread and the message 546 // was successfully submitted for validation, otherwise 0. See the 547 // SendDevToolsMessage documentation for additional usage information. 548 /// 549 int(CEF_CALLBACK* execute_dev_tools_method)( 550 struct _cef_browser_host_t* self, 551 int message_id, 552 const cef_string_t* method, 553 struct _cef_dictionary_value_t* params); 554 555 /// 556 // Add an observer for DevTools protocol messages (function results and 557 // events). The observer will remain registered until the returned 558 // Registration object is destroyed. See the SendDevToolsMessage documentation 559 // for additional usage information. 560 /// 561 struct _cef_registration_t*(CEF_CALLBACK* add_dev_tools_message_observer)( 562 struct _cef_browser_host_t* self, 563 struct _cef_dev_tools_message_observer_t* observer); 564 565 /// 566 // Retrieve a snapshot of current navigation entries as values sent to the 567 // specified visitor. If |current_only| is true (1) only the current 568 // navigation entry will be sent, otherwise all navigation entries will be 569 // sent. 570 /// 571 void(CEF_CALLBACK* get_navigation_entries)( 572 struct _cef_browser_host_t* self, 573 struct _cef_navigation_entry_visitor_t* visitor, 574 int current_only); 575 576 /// 577 // If a misspelled word is currently selected in an editable node calling this 578 // function will replace it with the specified |word|. 579 /// 580 void(CEF_CALLBACK* replace_misspelling)(struct _cef_browser_host_t* self, 581 const cef_string_t* word); 582 583 /// 584 // Add the specified |word| to the spelling dictionary. 585 /// 586 void(CEF_CALLBACK* add_word_to_dictionary)(struct _cef_browser_host_t* self, 587 const cef_string_t* word); 588 589 /// 590 // Returns true (1) if window rendering is disabled. 591 /// 592 int(CEF_CALLBACK* is_window_rendering_disabled)( 593 struct _cef_browser_host_t* self); 594 595 /// 596 // Notify the browser that the widget has been resized. The browser will first 597 // call cef_render_handler_t::GetViewRect to get the new size and then call 598 // cef_render_handler_t::OnPaint asynchronously with the updated regions. This 599 // function is only used when window rendering is disabled. 600 /// 601 void(CEF_CALLBACK* was_resized)(struct _cef_browser_host_t* self); 602 603 /// 604 // Notify the browser that it has been hidden or shown. Layouting and 605 // cef_render_handler_t::OnPaint notification will stop when the browser is 606 // hidden. This function is only used when window rendering is disabled. 607 /// 608 void(CEF_CALLBACK* was_hidden)(struct _cef_browser_host_t* self, int hidden); 609 610 /// 611 // Send a notification to the browser that the screen info has changed. The 612 // browser will then call cef_render_handler_t::GetScreenInfo to update the 613 // screen information with the new values. This simulates moving the webview 614 // window from one display to another, or changing the properties of the 615 // current display. This function is only used when window rendering is 616 // disabled. 617 /// 618 void(CEF_CALLBACK* notify_screen_info_changed)( 619 struct _cef_browser_host_t* self); 620 621 /// 622 // Invalidate the view. The browser will call cef_render_handler_t::OnPaint 623 // asynchronously. This function is only used when window rendering is 624 // disabled. 625 /// 626 void(CEF_CALLBACK* invalidate)(struct _cef_browser_host_t* self, 627 cef_paint_element_type_t type); 628 629 /// 630 // Issue a BeginFrame request to Chromium. Only valid when 631 // cef_window_tInfo::external_begin_frame_enabled is set to true (1). 632 /// 633 void(CEF_CALLBACK* send_external_begin_frame)( 634 struct _cef_browser_host_t* self); 635 636 /// 637 // Send a key event to the browser. 638 /// 639 void(CEF_CALLBACK* send_key_event)(struct _cef_browser_host_t* self, 640 const struct _cef_key_event_t* event); 641 642 /// 643 // Send a mouse click event to the browser. The |x| and |y| coordinates are 644 // relative to the upper-left corner of the view. 645 /// 646 void(CEF_CALLBACK* send_mouse_click_event)( 647 struct _cef_browser_host_t* self, 648 const struct _cef_mouse_event_t* event, 649 cef_mouse_button_type_t type, 650 int mouseUp, 651 int clickCount); 652 653 /// 654 // Send a mouse move event to the browser. The |x| and |y| coordinates are 655 // relative to the upper-left corner of the view. 656 /// 657 void(CEF_CALLBACK* send_mouse_move_event)( 658 struct _cef_browser_host_t* self, 659 const struct _cef_mouse_event_t* event, 660 int mouseLeave); 661 662 /// 663 // Send a mouse wheel event to the browser. The |x| and |y| coordinates are 664 // relative to the upper-left corner of the view. The |deltaX| and |deltaY| 665 // values represent the movement delta in the X and Y directions respectively. 666 // In order to scroll inside select popups with window rendering disabled 667 // cef_render_handler_t::GetScreenPoint should be implemented properly. 668 /// 669 void(CEF_CALLBACK* send_mouse_wheel_event)( 670 struct _cef_browser_host_t* self, 671 const struct _cef_mouse_event_t* event, 672 int deltaX, 673 int deltaY); 674 675 /// 676 // Send a touch event to the browser for a windowless browser. 677 /// 678 void(CEF_CALLBACK* send_touch_event)(struct _cef_browser_host_t* self, 679 const struct _cef_touch_event_t* event); 680 681 /// 682 // Send a capture lost event to the browser. 683 /// 684 void(CEF_CALLBACK* send_capture_lost_event)(struct _cef_browser_host_t* self); 685 686 /// 687 // Notify the browser that the window hosting it is about to be moved or 688 // resized. This function is only used on Windows and Linux. 689 /// 690 void(CEF_CALLBACK* notify_move_or_resize_started)( 691 struct _cef_browser_host_t* self); 692 693 /// 694 // Returns the maximum rate in frames per second (fps) that 695 // cef_render_handler_t:: OnPaint will be called for a windowless browser. The 696 // actual fps may be lower if the browser cannot generate frames at the 697 // requested rate. The minimum value is 1 and the maximum value is 60 (default 698 // 30). This function can only be called on the UI thread. 699 /// 700 int(CEF_CALLBACK* get_windowless_frame_rate)( 701 struct _cef_browser_host_t* self); 702 703 /// 704 // Set the maximum rate in frames per second (fps) that cef_render_handler_t:: 705 // OnPaint will be called for a windowless browser. The actual fps may be 706 // lower if the browser cannot generate frames at the requested rate. The 707 // minimum value is 1 and the maximum value is 60 (default 30). Can also be 708 // set at browser creation via cef_browser_tSettings.windowless_frame_rate. 709 /// 710 void(CEF_CALLBACK* set_windowless_frame_rate)( 711 struct _cef_browser_host_t* self, 712 int frame_rate); 713 714 /// 715 // Begins a new composition or updates the existing composition. Blink has a 716 // special node (a composition node) that allows the input function to change 717 // text without affecting other DOM nodes. |text| is the optional text that 718 // will be inserted into the composition node. |underlines| is an optional set 719 // of ranges that will be underlined in the resulting text. 720 // |replacement_range| is an optional range of the existing text that will be 721 // replaced. |selection_range| is an optional range of the resulting text that 722 // will be selected after insertion or replacement. The |replacement_range| 723 // value is only used on OS X. 724 // 725 // This function may be called multiple times as the composition changes. When 726 // the client is done making changes the composition should either be canceled 727 // or completed. To cancel the composition call ImeCancelComposition. To 728 // complete the composition call either ImeCommitText or 729 // ImeFinishComposingText. Completion is usually signaled when: 730 // A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR 731 // flag (on Windows), or; 732 // B. The client receives a "commit" signal of GtkIMContext (on Linux), or; 733 // C. insertText of NSTextInput is called (on Mac). 734 // 735 // This function is only used when window rendering is disabled. 736 /// 737 void(CEF_CALLBACK* ime_set_composition)( 738 struct _cef_browser_host_t* self, 739 const cef_string_t* text, 740 size_t underlinesCount, 741 cef_composition_underline_t const* underlines, 742 const cef_range_t* replacement_range, 743 const cef_range_t* selection_range); 744 745 /// 746 // Completes the existing composition by optionally inserting the specified 747 // |text| into the composition node. |replacement_range| is an optional range 748 // of the existing text that will be replaced. |relative_cursor_pos| is where 749 // the cursor will be positioned relative to the current cursor position. See 750 // comments on ImeSetComposition for usage. The |replacement_range| and 751 // |relative_cursor_pos| values are only used on OS X. This function is only 752 // used when window rendering is disabled. 753 /// 754 void(CEF_CALLBACK* ime_commit_text)(struct _cef_browser_host_t* self, 755 const cef_string_t* text, 756 const cef_range_t* replacement_range, 757 int relative_cursor_pos); 758 759 /// 760 // Completes the existing composition by applying the current composition node 761 // contents. If |keep_selection| is false (0) the current selection, if any, 762 // will be discarded. See comments on ImeSetComposition for usage. This 763 // function is only used when window rendering is disabled. 764 /// 765 void(CEF_CALLBACK* ime_finish_composing_text)( 766 struct _cef_browser_host_t* self, 767 int keep_selection); 768 769 /// 770 // Cancels the existing composition and discards the composition node contents 771 // without applying them. See comments on ImeSetComposition for usage. This 772 // function is only used when window rendering is disabled. 773 /// 774 void(CEF_CALLBACK* ime_cancel_composition)(struct _cef_browser_host_t* self); 775 776 /// 777 // Call this function when the user drags the mouse into the web view (before 778 // calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). |drag_data| 779 // should not contain file contents as this type of data is not allowed to be 780 // dragged into the web view. File contents can be removed using 781 // cef_drag_data_t::ResetFileContents (for example, if |drag_data| comes from 782 // cef_render_handler_t::StartDragging). This function is only used when 783 // window rendering is disabled. 784 /// 785 void(CEF_CALLBACK* drag_target_drag_enter)( 786 struct _cef_browser_host_t* self, 787 struct _cef_drag_data_t* drag_data, 788 const struct _cef_mouse_event_t* event, 789 cef_drag_operations_mask_t allowed_ops); 790 791 /// 792 // Call this function each time the mouse is moved across the web view during 793 // a drag operation (after calling DragTargetDragEnter and before calling 794 // DragTargetDragLeave/DragTargetDrop). This function is only used when window 795 // rendering is disabled. 796 /// 797 void(CEF_CALLBACK* drag_target_drag_over)( 798 struct _cef_browser_host_t* self, 799 const struct _cef_mouse_event_t* event, 800 cef_drag_operations_mask_t allowed_ops); 801 802 /// 803 // Call this function when the user drags the mouse out of the web view (after 804 // calling DragTargetDragEnter). This function is only used when window 805 // rendering is disabled. 806 /// 807 void(CEF_CALLBACK* drag_target_drag_leave)(struct _cef_browser_host_t* self); 808 809 /// 810 // Call this function when the user completes the drag operation by dropping 811 // the object onto the web view (after calling DragTargetDragEnter). The 812 // object being dropped is |drag_data|, given as an argument to the previous 813 // DragTargetDragEnter call. This function is only used when window rendering 814 // is disabled. 815 /// 816 void(CEF_CALLBACK* drag_target_drop)(struct _cef_browser_host_t* self, 817 const struct _cef_mouse_event_t* event); 818 819 /// 820 // Call this function when the drag operation started by a 821 // cef_render_handler_t::StartDragging call has ended either in a drop or by 822 // being cancelled. |x| and |y| are mouse coordinates relative to the upper- 823 // left corner of the view. If the web view is both the drag source and the 824 // drag target then all DragTarget* functions should be called before 825 // DragSource* mthods. This function is only used when window rendering is 826 // disabled. 827 /// 828 void(CEF_CALLBACK* drag_source_ended_at)(struct _cef_browser_host_t* self, 829 int x, 830 int y, 831 cef_drag_operations_mask_t op); 832 833 /// 834 // Call this function when the drag operation started by a 835 // cef_render_handler_t::StartDragging call has completed. This function may 836 // be called immediately without first calling DragSourceEndedAt to cancel a 837 // drag operation. If the web view is both the drag source and the drag target 838 // then all DragTarget* functions should be called before DragSource* mthods. 839 // This function is only used when window rendering is disabled. 840 /// 841 void(CEF_CALLBACK* drag_source_system_drag_ended)( 842 struct _cef_browser_host_t* self); 843 844 /// 845 // Returns the current visible navigation entry for this browser. This 846 // function can only be called on the UI thread. 847 /// 848 struct _cef_navigation_entry_t*(CEF_CALLBACK* get_visible_navigation_entry)( 849 struct _cef_browser_host_t* self); 850 851 /// 852 // Set accessibility state for all frames. |accessibility_state| may be 853 // default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT 854 // then accessibility will be disabled by default and the state may be further 855 // controlled with the "force-renderer-accessibility" and "disable-renderer- 856 // accessibility" command-line switches. If |accessibility_state| is 857 // STATE_ENABLED then accessibility will be enabled. If |accessibility_state| 858 // is STATE_DISABLED then accessibility will be completely disabled. 859 // 860 // For windowed browsers accessibility will be enabled in Complete mode (which 861 // corresponds to kAccessibilityModeComplete in Chromium). In this mode all 862 // platform accessibility objects will be created and managed by Chromium's 863 // internal implementation. The client needs only to detect the screen reader 864 // and call this function appropriately. For example, on macOS the client can 865 // handle the @"AXEnhancedUserStructure" accessibility attribute to detect 866 // VoiceOver state changes and on Windows the client can handle WM_GETOBJECT 867 // with OBJID_CLIENT to detect accessibility readers. 868 // 869 // For windowless browsers accessibility will be enabled in TreeOnly mode 870 // (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In 871 // this mode renderer accessibility is enabled, the full tree is computed, and 872 // events are passed to CefAccessibiltyHandler, but platform accessibility 873 // objects are not created. The client may implement platform accessibility 874 // objects using CefAccessibiltyHandler callbacks if desired. 875 /// 876 void(CEF_CALLBACK* set_accessibility_state)(struct _cef_browser_host_t* self, 877 cef_state_t accessibility_state); 878 879 /// 880 // Enable notifications of auto resize via 881 // cef_display_handler_t::OnAutoResize. Notifications are disabled by default. 882 // |min_size| and |max_size| define the range of allowed sizes. 883 /// 884 void(CEF_CALLBACK* set_auto_resize_enabled)(struct _cef_browser_host_t* self, 885 int enabled, 886 const cef_size_t* min_size, 887 const cef_size_t* max_size); 888 889 /// 890 // Returns the extension hosted in this browser or NULL if no extension is 891 // hosted. See cef_request_context_t::LoadExtension for details. 892 /// 893 struct _cef_extension_t*(CEF_CALLBACK* get_extension)( 894 struct _cef_browser_host_t* self); 895 896 /// 897 // Returns true (1) if this browser is hosting an extension background script. 898 // Background hosts do not have a window and are not displayable. See 899 // cef_request_context_t::LoadExtension for details. 900 /// 901 int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self); 902 903 /// 904 // Set whether the browser's audio is muted. 905 /// 906 void(CEF_CALLBACK* set_audio_muted)(struct _cef_browser_host_t* self, 907 int mute); 908 909 /// 910 // Returns true (1) if the browser's audio is muted. This function can only 911 // be called on the UI thread. 912 /// 913 int(CEF_CALLBACK* is_audio_muted)(struct _cef_browser_host_t* self); 914 } cef_browser_host_t; 915 916 /// 917 // Create a new browser using the window parameters specified by |windowInfo|. 918 // All values will be copied internally and the actual window (if any) will be 919 // created on the UI thread. If |request_context| is NULL the global request 920 // context will be used. This function can be called on any browser process 921 // thread and will not block. The optional |extra_info| parameter provides an 922 // opportunity to specify extra information specific to the created browser that 923 // will be passed to cef_render_process_handler_t::on_browser_created() in the 924 // render process. 925 /// 926 CEF_EXPORT int cef_browser_host_create_browser( 927 const cef_window_info_t* windowInfo, 928 struct _cef_client_t* client, 929 const cef_string_t* url, 930 const struct _cef_browser_settings_t* settings, 931 struct _cef_dictionary_value_t* extra_info, 932 struct _cef_request_context_t* request_context); 933 934 /// 935 // Create a new browser using the window parameters specified by |windowInfo|. 936 // If |request_context| is NULL the global request context will be used. This 937 // function can only be called on the browser process UI thread. The optional 938 // |extra_info| parameter provides an opportunity to specify extra information 939 // specific to the created browser that will be passed to 940 // cef_render_process_handler_t::on_browser_created() in the render process. 941 /// 942 CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( 943 const cef_window_info_t* windowInfo, 944 struct _cef_client_t* client, 945 const cef_string_t* url, 946 const struct _cef_browser_settings_t* settings, 947 struct _cef_dictionary_value_t* extra_info, 948 struct _cef_request_context_t* request_context); 949 950 #ifdef __cplusplus 951 } 952 #endif 953 954 #endif // CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ 955