views: Add support for absolute positioned overlay views.

To test:
Run `cefclient.exe --use-views --hide-frame --hide-controls`
Add `--enable-chrome-runtime` for the same behavior using the Chrome location
bar instead of a text field.
This commit is contained in:
Marshall Greenblatt 2021-08-27 21:55:15 -04:00
parent 6f6072b857
commit 4a44e16a09
96 changed files with 3875 additions and 230 deletions

View File

@ -705,6 +705,7 @@ static_library("libcef_static") {
"libcef/common/file_util_impl.cc", "libcef/common/file_util_impl.cc",
"libcef/common/frame_util.cc", "libcef/common/frame_util.cc",
"libcef/common/frame_util.h", "libcef/common/frame_util.h",
"libcef/common/i18n_util_impl.cc",
"libcef/common/json_impl.cc", "libcef/common/json_impl.cc",
"libcef/common/main_runner_delegate.h", "libcef/common/main_runner_delegate.h",
"libcef/common/main_runner_handler.h", "libcef/common/main_runner_handler.h",
@ -1055,6 +1056,8 @@ static_library("libcef_static") {
"libcef/browser/chrome/views/chrome_browser_frame.h", "libcef/browser/chrome/views/chrome_browser_frame.h",
"libcef/browser/chrome/views/chrome_browser_view.cc", "libcef/browser/chrome/views/chrome_browser_view.cc",
"libcef/browser/chrome/views/chrome_browser_view.h", "libcef/browser/chrome/views/chrome_browser_view.h",
"libcef/browser/chrome/views/chrome_views_util.cc",
"libcef/browser/chrome/views/chrome_views_util.h",
"libcef/browser/chrome/views/toolbar_view_impl.cc", "libcef/browser/chrome/views/toolbar_view_impl.cc",
"libcef/browser/chrome/views/toolbar_view_impl.h", "libcef/browser/chrome/views/toolbar_view_impl.h",
"libcef/browser/chrome/views/toolbar_view_view.cc", "libcef/browser/chrome/views/toolbar_view_view.cc",
@ -1096,6 +1099,8 @@ static_library("libcef_static") {
"libcef/browser/views/menu_button_view.h", "libcef/browser/views/menu_button_view.h",
"libcef/browser/views/menu_runner_views.cc", "libcef/browser/views/menu_runner_views.cc",
"libcef/browser/views/menu_runner_views.h", "libcef/browser/views/menu_runner_views.h",
"libcef/browser/views/overlay_view_host.cc",
"libcef/browser/views/overlay_view_host.h",
"libcef/browser/views/panel_impl.h", "libcef/browser/views/panel_impl.h",
"libcef/browser/views/panel_view.h", "libcef/browser/views/panel_view.h",
"libcef/browser/views/scroll_view_impl.cc", "libcef/browser/views/scroll_view_impl.cc",

View File

@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for # by hand. See the translator.README.txt file in the tools directory for
# more information. # more information.
# #
# $hash=f6950d026a9c92fbb58da3fe0cbcf0050c12ecf0$ # $hash=216bf0511bdceca67cdbdcf30f8316db2d00e276$
# #
{ {
@ -41,6 +41,7 @@
'include/cef_focus_handler.h', 'include/cef_focus_handler.h',
'include/cef_frame.h', 'include/cef_frame.h',
'include/cef_frame_handler.h', 'include/cef_frame_handler.h',
'include/cef_i18n_util.h',
'include/cef_image.h', 'include/cef_image.h',
'include/cef_jsdialog_handler.h', 'include/cef_jsdialog_handler.h',
'include/cef_keyboard_handler.h', 'include/cef_keyboard_handler.h',
@ -101,6 +102,7 @@
'include/views/cef_layout.h', 'include/views/cef_layout.h',
'include/views/cef_menu_button.h', 'include/views/cef_menu_button.h',
'include/views/cef_menu_button_delegate.h', 'include/views/cef_menu_button_delegate.h',
'include/views/cef_overlay_controller.h',
'include/views/cef_panel.h', 'include/views/cef_panel.h',
'include/views/cef_panel_delegate.h', 'include/views/cef_panel_delegate.h',
'include/views/cef_scroll_view.h', 'include/views/cef_scroll_view.h',
@ -139,6 +141,7 @@
'include/capi/cef_focus_handler_capi.h', 'include/capi/cef_focus_handler_capi.h',
'include/capi/cef_frame_capi.h', 'include/capi/cef_frame_capi.h',
'include/capi/cef_frame_handler_capi.h', 'include/capi/cef_frame_handler_capi.h',
'include/capi/cef_i18n_util_capi.h',
'include/capi/cef_image_capi.h', 'include/capi/cef_image_capi.h',
'include/capi/cef_jsdialog_handler_capi.h', 'include/capi/cef_jsdialog_handler_capi.h',
'include/capi/cef_keyboard_handler_capi.h', 'include/capi/cef_keyboard_handler_capi.h',
@ -199,6 +202,7 @@
'include/capi/views/cef_layout_capi.h', 'include/capi/views/cef_layout_capi.h',
'include/capi/views/cef_menu_button_capi.h', 'include/capi/views/cef_menu_button_capi.h',
'include/capi/views/cef_menu_button_delegate_capi.h', 'include/capi/views/cef_menu_button_delegate_capi.h',
'include/capi/views/cef_overlay_controller_capi.h',
'include/capi/views/cef_panel_capi.h', 'include/capi/views/cef_panel_capi.h',
'include/capi/views/cef_panel_delegate_capi.h', 'include/capi/views/cef_panel_delegate_capi.h',
'include/capi/views/cef_scroll_view_capi.h', 'include/capi/views/cef_scroll_view_capi.h',
@ -352,6 +356,8 @@
'libcef_dll/cpptoc/navigation_entry_cpptoc.h', 'libcef_dll/cpptoc/navigation_entry_cpptoc.h',
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc', 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc',
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h', 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h',
'libcef_dll/cpptoc/views/overlay_controller_cpptoc.cc',
'libcef_dll/cpptoc/views/overlay_controller_cpptoc.h',
'libcef_dll/cpptoc/views/panel_cpptoc.cc', 'libcef_dll/cpptoc/views/panel_cpptoc.cc',
'libcef_dll/cpptoc/views/panel_cpptoc.h', 'libcef_dll/cpptoc/views/panel_cpptoc.h',
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc', 'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc',
@ -662,6 +668,8 @@
'libcef_dll/ctocpp/navigation_entry_ctocpp.h', 'libcef_dll/ctocpp/navigation_entry_ctocpp.h',
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc', 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc',
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h', 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h',
'libcef_dll/ctocpp/views/overlay_controller_ctocpp.cc',
'libcef_dll/ctocpp/views/overlay_controller_ctocpp.h',
'libcef_dll/ctocpp/views/panel_ctocpp.cc', 'libcef_dll/ctocpp/views/panel_ctocpp.cc',
'libcef_dll/ctocpp/views/panel_ctocpp.h', 'libcef_dll/ctocpp/views/panel_ctocpp.h',
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc', 'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc',

View File

@ -265,6 +265,8 @@
'tests/cefclient/browser/urlrequest_test.h', 'tests/cefclient/browser/urlrequest_test.h',
'tests/cefclient/browser/views_menu_bar.cc', 'tests/cefclient/browser/views_menu_bar.cc',
'tests/cefclient/browser/views_menu_bar.h', 'tests/cefclient/browser/views_menu_bar.h',
'tests/cefclient/browser/views_overlay_controls.cc',
'tests/cefclient/browser/views_overlay_controls.h',
'tests/cefclient/browser/views_style.cc', 'tests/cefclient/browser/views_style.cc',
'tests/cefclient/browser/views_style.h', 'tests/cefclient/browser/views_style.h',
'tests/cefclient/browser/views_window.cc', 'tests/cefclient/browser/views_window.cc',

View File

@ -0,0 +1,58 @@
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// 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.
//
// $hash=bf890f7b8e8edd423d71ad5a4d5bd43d81f1eb01$
//
#ifndef CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Returns true (1) if the application text direction is right-to-left.
///
CEF_EXPORT int cef_is_rtl();
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_

View File

@ -0,0 +1,216 @@
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// 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.
//
// $hash=60a15cb1c2e77544c20a3aafef1db736f07a5fb8$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_OVERLAY_CONTROLLER_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_OVERLAY_CONTROLLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_view_t;
struct _cef_window_t;
///
// Controller for an overlay that contains a contents View added via
// cef_window_t::AddOverlayView. Methods exposed by this controller should be
// called in preference to functions of the same name exposed by the contents
// View unless otherwise indicated. Methods must be called on the browser
// process UI thread unless otherwise indicated.
///
typedef struct _cef_overlay_controller_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns true (1) if this object is valid.
///
int(CEF_CALLBACK* is_valid)(struct _cef_overlay_controller_t* self);
///
// Returns true (1) if this object is the same as |that| object.
///
int(CEF_CALLBACK* is_same)(struct _cef_overlay_controller_t* self,
struct _cef_overlay_controller_t* that);
///
// Returns the contents View for this overlay.
///
struct _cef_view_t*(CEF_CALLBACK* get_contents_view)(
struct _cef_overlay_controller_t* self);
///
// Returns the top-level Window hosting this overlay. Use this function
// instead of calling get_window() on the contents View.
///
struct _cef_window_t*(CEF_CALLBACK* get_window)(
struct _cef_overlay_controller_t* self);
///
// Returns the docking mode for this overlay.
///
cef_docking_mode_t(CEF_CALLBACK* get_docking_mode)(
struct _cef_overlay_controller_t* self);
///
// Destroy this overlay.
///
void(CEF_CALLBACK* destroy)(struct _cef_overlay_controller_t* self);
///
// Sets the bounds (size and position) of this overlay. This will set the
// bounds of the contents View to match and trigger a re-layout if necessary.
// |bounds| is in parent coordinates and any insets configured on this overlay
// will be ignored. Use this function only for overlays created with a docking
// mode value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
// insets of this overlay and/or layout of the contents View and call
// size_to_preferred_size() instead to calculate the new size and re-position
// the overlay if necessary.
///
void(CEF_CALLBACK* set_bounds)(struct _cef_overlay_controller_t* self,
const cef_rect_t* bounds);
///
// Returns the bounds (size and position) of this overlay in parent
// coordinates.
///
cef_rect_t(CEF_CALLBACK* get_bounds)(struct _cef_overlay_controller_t* self);
///
// Returns the bounds (size and position) of this overlay in DIP screen
// coordinates.
///
cef_rect_t(CEF_CALLBACK* get_bounds_in_screen)(
struct _cef_overlay_controller_t* self);
///
// Sets the size of this overlay without changing the position. This will set
// the size of the contents View to match and trigger a re-layout if
// necessary. |size| is in parent coordinates and any insets configured on
// this overlay will be ignored. Use this function only for overlays created
// with a docking mode value of CEF_DOCKING_MODE_CUSTOM. With other docking
// modes modify the insets of this overlay and/or layout of the contents View
// and call size_to_preferred_size() instead to calculate the new size and re-
// position the overlay if necessary.
///
void(CEF_CALLBACK* set_size)(struct _cef_overlay_controller_t* self,
const cef_size_t* size);
///
// Returns the size of this overlay in parent coordinates.
///
cef_size_t(CEF_CALLBACK* get_size)(struct _cef_overlay_controller_t* self);
///
// Sets the position of this overlay without changing the size. |position| is
// in parent coordinates and any insets configured on this overlay will be
// ignored. Use this function only for overlays created with a docking mode
// value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
// insets of this overlay and/or layout of the contents View and call
// size_to_preferred_size() instead to calculate the new size and re-position
// the overlay if necessary.
///
void(CEF_CALLBACK* set_position)(struct _cef_overlay_controller_t* self,
const cef_point_t* position);
///
// Returns the position of this overlay in parent coordinates.
///
cef_point_t(CEF_CALLBACK* get_position)(
struct _cef_overlay_controller_t* self);
///
// Sets the insets for this overlay. |insets| is in parent coordinates. Use
// this function only for overlays created with a docking mode value other
// than CEF_DOCKING_MODE_CUSTOM.
///
void(CEF_CALLBACK* set_insets)(struct _cef_overlay_controller_t* self,
const cef_insets_t* insets);
///
// Returns the insets for this overlay in parent coordinates.
///
cef_insets_t(CEF_CALLBACK* get_insets)(
struct _cef_overlay_controller_t* self);
///
// Size this overlay to its preferred size and trigger a re-layout if
// necessary. The position of overlays created with a docking mode value of
// CEF_DOCKING_MODE_CUSTOM will not be modified by calling this function. With
// other docking modes this function may re-position the overlay if necessary
// to accommodate the new size and any insets configured on the contents View.
///
void(CEF_CALLBACK* size_to_preferred_size)(
struct _cef_overlay_controller_t* self);
///
// Sets whether this overlay is visible. Overlays are hidden by default. If
// this overlay is hidden then it and any child Views will not be drawn and,
// if any of those Views currently have focus, then focus will also be
// cleared. Painting is scheduled as needed.
///
void(CEF_CALLBACK* set_visible)(struct _cef_overlay_controller_t* self,
int visible);
///
// Returns whether this overlay is visible. A View may be visible but still
// not drawn in a Window if any parent Views are hidden. Call is_drawn() to
// determine whether this overlay and all parent Views are visible and will be
// drawn.
///
int(CEF_CALLBACK* is_visible)(struct _cef_overlay_controller_t* self);
///
// Returns whether this overlay is visible and drawn in a Window. A View is
// drawn if it and all parent Views are visible. To determine if the
// containing Window is visible to the user on-screen call is_visible() on the
// Window.
///
int(CEF_CALLBACK* is_drawn)(struct _cef_overlay_controller_t* self);
} cef_overlay_controller_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_OVERLAY_CONTROLLER_CAPI_H_

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=9881a00ef237b6972f14c071544387fc90fe18f1$ // $hash=84b29a8dcdadffae5466ac16e7aafd80471a0abd$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
@ -220,6 +220,19 @@ typedef struct _cef_view_t {
/// ///
cef_point_t(CEF_CALLBACK* get_position)(struct _cef_view_t* self); cef_point_t(CEF_CALLBACK* get_position)(struct _cef_view_t* self);
///
// Sets the insets for this View. |insets| is in parent coordinates, or DIP
// screen coordinates if there is no parent.
///
void(CEF_CALLBACK* set_insets)(struct _cef_view_t* self,
const cef_insets_t* insets);
///
// Returns the insets for this View in parent coordinates, or DIP screen
// coordinates if there is no parent.
///
cef_insets_t(CEF_CALLBACK* get_insets)(struct _cef_view_t* self);
/// ///
// Returns the size this View would like to be if enough space is available. // Returns the size this View would like to be if enough space is available.
// Size is in parent coordinates, or DIP screen coordinates if there is no // Size is in parent coordinates, or DIP screen coordinates if there is no

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=a060cb3c53317d758e7f6b4a275288cd08f086e7$ // $hash=c8707f30655dc83c5f329d1dc22b14e9e06f4e76$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
@ -121,6 +121,13 @@ typedef struct _cef_view_delegate_t {
struct _cef_view_t* view, struct _cef_view_t* view,
int added); int added);
///
// Called when the layout of |view| has changed.
///
void(CEF_CALLBACK* on_layout_changed)(struct _cef_view_delegate_t* self,
struct _cef_view_t* view,
const cef_rect_t* new_bounds);
/// ///
// Called when |view| gains focus. // Called when |view| gains focus.
/// ///

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=15f88e3521ca96947fe8b1f91f251eb3405fb293$ // $hash=0f5dad3572a20ee7395cb861b5c970cff382b61c$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
@ -43,6 +43,7 @@
#include "include/capi/cef_image_capi.h" #include "include/capi/cef_image_capi.h"
#include "include/capi/cef_menu_model_capi.h" #include "include/capi/cef_menu_model_capi.h"
#include "include/capi/views/cef_display_capi.h" #include "include/capi/views/cef_display_capi.h"
#include "include/capi/views/cef_overlay_controller_capi.h"
#include "include/capi/views/cef_panel_capi.h" #include "include/capi/views/cef_panel_capi.h"
#include "include/capi/views/cef_window_delegate_capi.h" #include "include/capi/views/cef_window_delegate_capi.h"
@ -197,6 +198,40 @@ typedef struct _cef_window_t {
struct _cef_image_t*(CEF_CALLBACK* get_window_app_icon)( struct _cef_image_t*(CEF_CALLBACK* get_window_app_icon)(
struct _cef_window_t* self); struct _cef_window_t* self);
///
// Add a View that will be overlayed on the Window contents with absolute
// positioning and high z-order. Positioning is controlled by |docking_mode|
// as described below. The returned cef_overlay_controller_t object is used to
// control the overlay. Overlays are hidden by default.
//
// With CEF_DOCKING_MODE_CUSTOM:
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
// positioned in the top-left corner.
// 2. Optionally change the overlay position and/or size by calling
// CefOverlayController methods.
// 3. Call CefOverlayController::SetVisible(true) to show the overlay.
// 4. The overlay will be automatically re-sized if |view|'s layout changes.
// Optionally change the overlay position and/or size when
// OnLayoutChanged is called on the Window's delegate to indicate a
// change in Window bounds.
//
// With other docking modes:
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
// positioned based on |docking_mode|.
// 2. Call CefOverlayController::SetVisible(true) to show the overlay.
// 3. The overlay will be automatically re-sized if |view|'s layout changes
// and re-positioned as appropriate when the Window resizes.
//
// Overlays created by this function will receive a higher z-order then any
// child Views added previously. It is therefore recommended to call this
// function last after all other child Views have been added so that the
// overlay displays as the top-most child of the Window.
///
struct _cef_overlay_controller_t*(CEF_CALLBACK* add_overlay_view)(
struct _cef_window_t* self,
struct _cef_view_t* view,
cef_docking_mode_t docking_mode);
/// ///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu // Show a menu with contents |menu_model|. |screen_point| specifies the menu
// position in screen coordinates. |anchor_position| specifies how the menu // position in screen coordinates. |anchor_position| specifies how the menu

View File

@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal // way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash // hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected. // values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "5625e3ce80d2bbf5b5a39f8655d96c215f7685ee" #define CEF_API_HASH_UNIVERSAL "e32fc367fb311d2d68f097d42a75357a3e339fdd"
#if defined(OS_WIN) #if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "c20e4ffc24e6267b61774f49237d0f30a581f370" #define CEF_API_HASH_PLATFORM "e40f20dc24610956c9e2768f4c9535502d68f70e"
#elif defined(OS_MAC) #elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "65731bc654ec6e1dbd48d6ff2336c4c8573f7d35" #define CEF_API_HASH_PLATFORM "cb578fa9c253d93944f63d9bdc7a8f9e0a417bae"
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "4e35b9cc9735c63ac9f16fbbb49a4b8e2307f23a" #define CEF_API_HASH_PLATFORM "10b47123ea31edcf4a978a36e4ee2aa5bc755b2d"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

49
include/cef_i18n_util.h Normal file
View File

@ -0,0 +1,49 @@
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_I18N_UTIL_H_
#define CEF_INCLUDE_CEF_I18N_UTIL_H_
#pragma once
#include "include/cef_base.h"
///
// Returns true if the application text direction is right-to-left.
///
/*--cef()--*/
bool CefIsRTL();
#endif // CEF_INCLUDE_CEF_I18N_UTIL_H_

View File

@ -3198,6 +3198,17 @@ typedef enum {
CEF_CTT_LOCATION, CEF_CTT_LOCATION,
} cef_chrome_toolbar_type_t; } cef_chrome_toolbar_type_t;
///
// Docking modes supported by CefWindow::AddOverlay.
///
typedef enum {
CEF_DOCKING_MODE_TOP_LEFT = 1,
CEF_DOCKING_MODE_TOP_RIGHT,
CEF_DOCKING_MODE_BOTTOM_LEFT,
CEF_DOCKING_MODE_BOTTOM_RIGHT,
CEF_DOCKING_MODE_CUSTOM,
} cef_docking_mode_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -0,0 +1,209 @@
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_OVERLAY_CONTROLLER_H_
#define CEF_INCLUDE_VIEWS_CEF_OVERLAY_CONTROLLER_H_
#pragma once
#include "include/cef_base.h"
class CefView;
class CefWindow;
///
// Controller for an overlay that contains a contents View added via
// CefWindow::AddOverlayView. Methods exposed by this controller should be
// called in preference to methods of the same name exposed by the contents View
// unless otherwise indicated. Methods must be called on the browser process UI
// thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefOverlayController : public CefBaseRefCounted {
public:
///
// Returns true if this object is valid.
///
/*--cef()--*/
virtual bool IsValid() = 0;
///
// Returns true if this object is the same as |that| object.
///
/*--cef()--*/
virtual bool IsSame(CefRefPtr<CefOverlayController> that) = 0;
///
// Returns the contents View for this overlay.
///
/*--cef()--*/
virtual CefRefPtr<CefView> GetContentsView() = 0;
///
// Returns the top-level Window hosting this overlay. Use this method instead
// of calling GetWindow() on the contents View.
///
/*--cef()--*/
virtual CefRefPtr<CefWindow> GetWindow() = 0;
///
// Returns the docking mode for this overlay.
///
/*--cef(default_retval=CEF_DOCKING_MODE_TOP_LEFT)--*/
virtual cef_docking_mode_t GetDockingMode() = 0;
///
// Destroy this overlay.
///
/*--cef()--*/
virtual void Destroy() = 0;
///
// Sets the bounds (size and position) of this overlay. This will set the
// bounds of the contents View to match and trigger a re-layout if necessary.
// |bounds| is in parent coordinates and any insets configured on this overlay
// will be ignored. Use this method only for overlays created with a docking
// mode value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
// insets of this overlay and/or layout of the contents View and call
// SizeToPreferredSize() instead to calculate the new size and re-position the
// overlay if necessary.
///
/*--cef()--*/
virtual void SetBounds(const CefRect& bounds) = 0;
///
// Returns the bounds (size and position) of this overlay in parent
// coordinates.
///
/*--cef()--*/
virtual CefRect GetBounds() = 0;
///
// Returns the bounds (size and position) of this overlay in DIP screen
// coordinates.
///
/*--cef()--*/
virtual CefRect GetBoundsInScreen() = 0;
///
// Sets the size of this overlay without changing the position. This will set
// the size of the contents View to match and trigger a re-layout if
// necessary. |size| is in parent coordinates and any insets configured on
// this overlay will be ignored. Use this method only for overlays created
// with a docking mode value of CEF_DOCKING_MODE_CUSTOM. With other docking
// modes modify the insets of this overlay and/or layout of the contents View
// and call SizeToPreferredSize() instead to calculate the new size and
// re-position the overlay if necessary.
///
/*--cef()--*/
virtual void SetSize(const CefSize& size) = 0;
///
// Returns the size of this overlay in parent coordinates.
///
/*--cef()--*/
virtual CefSize GetSize() = 0;
///
// Sets the position of this overlay without changing the size. |position| is
// in parent coordinates and any insets configured on this overlay will
// be ignored. Use this method only for overlays created with a docking mode
// value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
// insets of this overlay and/or layout of the contents View and call
// SizeToPreferredSize() instead to calculate the new size and re-position the
// overlay if necessary.
///
/*--cef()--*/
virtual void SetPosition(const CefPoint& position) = 0;
///
// Returns the position of this overlay in parent coordinates.
///
/*--cef()--*/
virtual CefPoint GetPosition() = 0;
///
// Sets the insets for this overlay. |insets| is in parent coordinates. Use
// this method only for overlays created with a docking mode value other than
// CEF_DOCKING_MODE_CUSTOM.
///
/*--cef()--*/
virtual void SetInsets(const CefInsets& insets) = 0;
///
// Returns the insets for this overlay in parent coordinates.
///
/*--cef()--*/
virtual CefInsets GetInsets() = 0;
///
// Size this overlay to its preferred size and trigger a re-layout if
// necessary. The position of overlays created with a docking mode value of
// CEF_DOCKING_MODE_CUSTOM will not be modified by calling this method. With
// other docking modes this method may re-position the overlay if necessary to
// accommodate the new size and any insets configured on the contents View.
///
/*--cef()--*/
virtual void SizeToPreferredSize() = 0;
///
// Sets whether this overlay is visible. Overlays are hidden by default. If
// this overlay is hidden then it and any child Views will not be drawn and,
// if any of those Views currently have focus, then focus will also be
// cleared. Painting is scheduled as needed.
///
/*--cef()--*/
virtual void SetVisible(bool visible) = 0;
///
// Returns whether this overlay is visible. A View may be visible but still
// not drawn in a Window if any parent Views are hidden. Call IsDrawn() to
// determine whether this overlay and all parent Views are visible and will be
// drawn.
///
/*--cef()--*/
virtual bool IsVisible() = 0;
///
// Returns whether this overlay is visible and drawn in a Window. A View is
// drawn if it and all parent Views are visible. To determine if the
// containing Window is visible to the user on-screen call IsVisible() on the
// Window.
///
/*--cef()--*/
virtual bool IsDrawn() = 0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_OVERLAY_CONTROLLER_H_

View File

@ -222,6 +222,20 @@ class CefView : public CefBaseRefCounted {
/*--cef()--*/ /*--cef()--*/
virtual CefPoint GetPosition() = 0; virtual CefPoint GetPosition() = 0;
///
// Sets the insets for this View. |insets| is in parent coordinates, or DIP
// screen coordinates if there is no parent.
///
/*--cef()--*/
virtual void SetInsets(const CefInsets& insets) = 0;
///
// Returns the insets for this View in parent coordinates, or DIP screen
// coordinates if there is no parent.
///
/*--cef()--*/
virtual CefInsets GetInsets() = 0;
/// ///
// Returns the size this View would like to be if enough space is available. // Returns the size this View would like to be if enough space is available.
// Size is in parent coordinates, or DIP screen coordinates if there is no // Size is in parent coordinates, or DIP screen coordinates if there is no

View File

@ -108,9 +108,16 @@ class CefViewDelegate : public virtual CefBaseRefCounted {
/// ///
// Called when |view| is added or removed from the CefWindow. // Called when |view| is added or removed from the CefWindow.
/// ///
/*--cef(optional_param=window)--*/ /*--cef()--*/
virtual void OnWindowChanged(CefRefPtr<CefView> view, bool added) {} virtual void OnWindowChanged(CefRefPtr<CefView> view, bool added) {}
///
// Called when the layout of |view| has changed.
///
/*--cef()--*/
virtual void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {}
/// ///
// Called when |view| gains focus. // Called when |view| gains focus.
/// ///

View File

@ -41,6 +41,7 @@
#include "include/cef_image.h" #include "include/cef_image.h"
#include "include/cef_menu_model.h" #include "include/cef_menu_model.h"
#include "include/views/cef_display.h" #include "include/views/cef_display.h"
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_panel.h" #include "include/views/cef_panel.h"
#include "include/views/cef_window_delegate.h" #include "include/views/cef_window_delegate.h"
@ -211,6 +212,40 @@ class CefWindow : public CefPanel {
/*--cef()--*/ /*--cef()--*/
virtual CefRefPtr<CefImage> GetWindowAppIcon() = 0; virtual CefRefPtr<CefImage> GetWindowAppIcon() = 0;
///
// Add a View that will be overlayed on the Window contents with absolute
// positioning and high z-order. Positioning is controlled by |docking_mode|
// as described below. The returned CefOverlayController object is used to
// control the overlay. Overlays are hidden by default.
//
// With CEF_DOCKING_MODE_CUSTOM:
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
// positioned in the top-left corner.
// 2. Optionally change the overlay position and/or size by calling
// CefOverlayController methods.
// 3. Call CefOverlayController::SetVisible(true) to show the overlay.
// 4. The overlay will be automatically re-sized if |view|'s layout changes.
// Optionally change the overlay position and/or size when
// OnLayoutChanged is called on the Window's delegate to indicate a
// change in Window bounds.
//
// With other docking modes:
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
// positioned based on |docking_mode|.
// 2. Call CefOverlayController::SetVisible(true) to show the overlay.
// 3. The overlay will be automatically re-sized if |view|'s layout changes
// and re-positioned as appropriate when the Window resizes.
//
// Overlays created by this method will receive a higher z-order then any
// child Views added previously. It is therefore recommended to call this
// method last after all other child Views have been added so that the overlay
// displays as the top-most child of the Window.
///
/*--cef()--*/
virtual CefRefPtr<CefOverlayController> AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode) = 0;
/// ///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu // Show a menu with contents |menu_model|. |screen_point| specifies the menu
// position in screen coordinates. |anchor_position| specifies how the menu // position in screen coordinates. |anchor_position| specifies how the menu

View File

@ -0,0 +1,15 @@
// Copyright 2021 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 "libcef/browser/chrome/views/chrome_views_util.h"
#include "libcef/browser/views/view_util.h"
namespace cef {
bool IsCefView(views::View* view) {
return view_util::GetFor(view, /*find_known_parent=*/false) != nullptr;
}
} // namespace cef

View File

@ -0,0 +1,20 @@
// Copyright 2021 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 CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_VIEWS_H_
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_VIEWS_H_
#pragma once
namespace views {
class View;
}
namespace cef {
// Returns true if |view| is a CefView.
bool IsCefView(views::View* view);
} // namespace cef
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_VIEWS_H_

View File

@ -0,0 +1,330 @@
// Copyright 2021 The Chromium Embedded Framework Authors. Portions copyright
// 2011 The Chromium 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 "libcef/browser/views/overlay_view_host.h"
#include "libcef/browser/views/view_util.h"
#include "libcef/browser/views/window_view.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/theme_copying_widget.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/compositor/layer.h"
#if defined(USE_AURA)
#include "ui/aura/window.h"
#include "ui/views/view_constants_aura.h"
#endif
namespace {
class CefOverlayControllerImpl : public CefOverlayController {
public:
CefOverlayControllerImpl(CefOverlayViewHost* host, CefRefPtr<CefView> view)
: host_(host), view_(view) {}
bool IsValid() override {
// View validity implies that CefOverlayViewHost is still valid, because the
// Widget that it owns (and that owns the View) is still valid.
return view_ && view_->IsValid();
}
bool IsSame(CefRefPtr<CefOverlayController> that) override {
return that && that->GetContentsView()->IsSame(view_);
}
CefRefPtr<CefView> GetContentsView() override { return view_; }
CefRefPtr<CefWindow> GetWindow() override {
if (IsValid()) {
return view_util::GetWindowFor(host_->window_view()->GetWidget());
}
return nullptr;
}
cef_docking_mode_t GetDockingMode() override {
if (IsValid()) {
return host_->docking_mode();
}
return CEF_DOCKING_MODE_TOP_LEFT;
}
void Destroy() override {
if (IsValid()) {
host_->Destroy();
view_ = nullptr;
}
}
void SetBounds(const CefRect& bounds) override {
if (IsValid() && host_->docking_mode() == CEF_DOCKING_MODE_CUSTOM) {
host_->SetOverlayBounds(
gfx::Rect(bounds.x, bounds.y, bounds.width, bounds.height));
}
}
CefRect GetBounds() override {
if (IsValid()) {
const auto& bounds = host_->bounds();
return CefRect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
}
return CefRect();
}
CefRect GetBoundsInScreen() override {
if (IsValid()) {
const auto& bounds = host_->widget()->GetWindowBoundsInScreen();
return CefRect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
}
return CefRect();
}
void SetSize(const CefSize& size) override {
if (IsValid() && host_->docking_mode() == CEF_DOCKING_MODE_CUSTOM) {
// Update the size without changing the origin.
const auto& origin = host_->bounds().origin();
host_->SetOverlayBounds(
gfx::Rect(origin, gfx::Size(size.width, size.height)));
}
}
CefSize GetSize() override {
const auto& bounds = GetBounds();
return CefSize(bounds.width, bounds.height);
}
void SetPosition(const CefPoint& position) override {
if (IsValid() && host_->docking_mode() == CEF_DOCKING_MODE_CUSTOM) {
// Update the origin without changing the size.
const auto& size = host_->bounds().size();
host_->SetOverlayBounds(
gfx::Rect(gfx::Point(position.x, position.y), size));
}
}
CefPoint GetPosition() override {
const auto& bounds = GetBounds();
return CefPoint(bounds.x, bounds.y);
}
void SetInsets(const CefInsets& insets) override {
if (IsValid() && host_->docking_mode() != CEF_DOCKING_MODE_CUSTOM) {
host_->SetOverlayInsets(insets);
}
}
CefInsets GetInsets() override {
if (IsValid()) {
return host_->insets();
}
return CefInsets();
}
void SizeToPreferredSize() override {
if (IsValid()) {
if (host_->docking_mode() == CEF_DOCKING_MODE_CUSTOM) {
// Update the size without changing the origin.
const auto& origin = host_->bounds().origin();
const auto& preferred_size = host_->view()->GetPreferredSize();
host_->SetOverlayBounds(gfx::Rect(origin, preferred_size));
} else {
host_->MoveIfNecessary();
}
}
}
void SetVisible(bool visible) override {
if (IsValid()) {
if (visible) {
host_->MoveIfNecessary();
host_->widget()->Show();
} else {
host_->widget()->Hide();
}
}
}
bool IsVisible() override {
if (IsValid()) {
return host_->widget()->IsVisible();
}
return false;
}
bool IsDrawn() override { return IsVisible(); }
private:
CefOverlayViewHost* const host_;
CefRefPtr<CefView> view_;
IMPLEMENT_REFCOUNTING(CefOverlayControllerImpl);
DISALLOW_COPY_AND_ASSIGN(CefOverlayControllerImpl);
};
} // namespace
CefOverlayViewHost::CefOverlayViewHost(CefWindowView* window_view,
cef_docking_mode_t docking_mode)
: window_view_(window_view), docking_mode_(docking_mode) {}
void CefOverlayViewHost::Init(views::View* widget_view,
CefRefPtr<CefView> view) {
DCHECK(view);
// Match the logic in CEF_PANEL_IMPL_D::AddChildView().
auto controls_view = view->IsAttached()
? base::WrapUnique(view_util::GetFor(view))
: view_util::PassOwnership(view);
DCHECK(controls_view.get());
cef_controller_ = new CefOverlayControllerImpl(this, view);
// Initialize the Widget.
widget_ = std::make_unique<ThemeCopyingWidget>(window_view_->GetWidget());
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
params.delegate = this;
params.name = "CefOverlayViewHost";
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = window_view_->GetWidget()->GetNativeView();
params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;
params.activatable = views::Widget::InitParams::Activatable::kNo;
widget_->Init(std::move(params));
view_ = widget_->GetContentsView()->AddChildView(std::move(controls_view));
// Make the Widget background transparent. The View might still be opaque.
if (widget_->GetCompositor()) {
widget_->GetCompositor()->SetBackgroundColor(SK_ColorTRANSPARENT);
}
#if defined(USE_AURA)
// See matching logic in view_util::GetWindowFor.
widget_->GetNativeView()->SetProperty(views::kHostViewKey, widget_view);
#endif
if (cef::IsChromeRuntimeEnabled()) {
// Some attributes associated with a Chrome toolbar are located via the
// Widget. See matching logic in BrowserView::AddedToWidget.
auto browser_view = BrowserView::GetBrowserViewForNativeWindow(
view_util::GetNativeWindow(window_view_->GetWidget()));
if (browser_view) {
widget_->SetNativeWindowProperty(BrowserView::kBrowserViewKey,
browser_view);
}
}
// Set the initial bounds after the View has been added to the Widget.
// Otherwise, preferred size won't calculate correctly.
gfx::Rect bounds;
if (docking_mode_ == CEF_DOCKING_MODE_CUSTOM) {
if (view_->size().IsEmpty()) {
// Size to the preferred size to start.
view_->SizeToPreferredSize();
}
// Top-left origin with existing size.
bounds = gfx::Rect(gfx::Point(), view_->size());
} else {
bounds = ComputeBounds();
}
SetOverlayBounds(bounds);
// Register for future bounds change notifications.
view_->AddObserver(this);
// Initially hidden.
widget_->Hide();
}
void CefOverlayViewHost::Destroy() {
if (widget_ && !widget_->IsClosed()) {
// Remove the child View immediately. It may be reused by the client.
auto view = view_util::GetFor(view_, /*find_known_parent=*/false);
widget_->GetContentsView()->RemoveChildView(view_);
if (view) {
view_util::ResumeOwnership(view);
}
widget_->Close();
}
}
void CefOverlayViewHost::MoveIfNecessary() {
if (bounds_changing_ || docking_mode_ == CEF_DOCKING_MODE_CUSTOM) {
return;
}
SetOverlayBounds(ComputeBounds());
}
void CefOverlayViewHost::SetOverlayBounds(const gfx::Rect& bounds) {
// Avoid re-entrancy of this method.
if (bounds_changing_)
return;
gfx::Rect new_bounds = bounds;
// Keep the result inside the widget.
new_bounds.Intersect(window_view_->bounds());
if (new_bounds == bounds_)
return;
bounds_changing_ = true;
bounds_ = new_bounds;
if (view_->size() != bounds_.size()) {
view_->SetSize(bounds_.size());
}
widget_->SetBounds(bounds_);
bounds_changing_ = false;
}
void CefOverlayViewHost::SetOverlayInsets(const CefInsets& insets) {
if (insets == insets_)
return;
insets_ = insets;
MoveIfNecessary();
}
void CefOverlayViewHost::OnViewBoundsChanged(views::View* observed_view) {
MoveIfNecessary();
}
gfx::Rect CefOverlayViewHost::ComputeBounds() const {
// This method is only used with corner docking.
DCHECK_NE(docking_mode_, CEF_DOCKING_MODE_CUSTOM);
// Find the area we have to work with.
const auto& widget_bounds = window_view_->bounds();
// Ask the view how large an area it needs to draw on.
const auto& prefsize = view_->GetPreferredSize();
// Swap left/right docking with RTL.
const bool is_rtl = base::i18n::IsRTL();
// Dock to the correct corner, considering insets in the docking corner only.
int x = widget_bounds.x();
int y = widget_bounds.y();
if (((docking_mode_ == CEF_DOCKING_MODE_TOP_RIGHT ||
docking_mode_ == CEF_DOCKING_MODE_BOTTOM_RIGHT) &&
!is_rtl) ||
((docking_mode_ == CEF_DOCKING_MODE_TOP_LEFT ||
docking_mode_ == CEF_DOCKING_MODE_BOTTOM_LEFT) &&
is_rtl)) {
x += widget_bounds.width() - prefsize.width() - insets_.right;
} else {
x += insets_.left;
}
if (docking_mode_ == CEF_DOCKING_MODE_BOTTOM_LEFT ||
docking_mode_ == CEF_DOCKING_MODE_BOTTOM_RIGHT) {
y += widget_bounds.height() - prefsize.height() - insets_.bottom;
} else {
y += insets_.top;
}
return gfx::Rect(x, y, prefsize.width(), prefsize.height());
}

View File

@ -0,0 +1,79 @@
// Copyright 2021 The Chromium Embedded Framework Authors. Portions copyright
// 2011 The Chromium 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 CEF_LIBCEF_BROWSER_VIEWS_OVERLAY_VIEW_HOST_H_
#define CEF_LIBCEF_BROWSER_VIEWS_OVERLAY_VIEW_HOST_H_
#pragma once
#include <memory>
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_view.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/views/view_observer.h"
#include "ui/views/widget/widget_delegate.h"
class CefWindowView;
// Host class for a child Widget that behaves as an overlay control. Based on
// Chrome's DropdownBarHost.
class CefOverlayViewHost : public views::WidgetDelegate,
public views::ViewObserver {
public:
// |window_view| is the top-level view that contains this overlay.
CefOverlayViewHost(CefWindowView* window_view,
cef_docking_mode_t docking_mode);
// Initializes the CefOverlayViewHost. This creates the Widget that |view|
// paints into. |host_view| is the view whose position in the |window_view_|
// view hierarchy determines the z-order of the widget relative to views with
// layers and views with associated NativeViews.
void Init(views::View* host_view, CefRefPtr<CefView> view);
void Destroy();
void MoveIfNecessary();
void SetOverlayBounds(const gfx::Rect& bounds);
void SetOverlayInsets(const CefInsets& insets);
// views::ViewObserver methods:
void OnViewBoundsChanged(views::View* observed_view) override;
cef_docking_mode_t docking_mode() const { return docking_mode_; }
CefRefPtr<CefOverlayController> controller() const { return cef_controller_; }
CefWindowView* window_view() const { return window_view_; }
views::Widget* widget() const { return widget_.get(); }
views::View* view() const { return view_; }
gfx::Rect bounds() const { return bounds_; }
CefInsets insets() const { return insets_; }
private:
gfx::Rect ComputeBounds() const;
// The CefWindowView that created us.
CefWindowView* const window_view_;
const cef_docking_mode_t docking_mode_;
// Our view, which is responsible for drawing the UI.
views::View* view_ = nullptr;
// The Widget implementation that is created and maintained by the overlay.
// It contains |view_|.
std::unique_ptr<views::Widget> widget_;
CefRefPtr<CefOverlayController> cef_controller_;
gfx::Rect bounds_;
bool bounds_changing_ = false;
CefInsets insets_;
DISALLOW_COPY_AND_ASSIGN(CefOverlayViewHost);
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_OVERLAY_VIEW_HOST_H_

View File

@ -299,6 +299,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/values.h" #include "base/values.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/view.h" #include "ui/views/view.h"
// Helpers for template boiler-plate. // Helpers for template boiler-plate.
@ -384,6 +385,8 @@ CEF_VIEW_IMPL_T class CefViewImpl : public CefViewAdapter, public CefViewClass {
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;
@ -571,6 +574,20 @@ CEF_VIEW_IMPL_T CefPoint CEF_VIEW_IMPL_D::GetPosition() {
return CefPoint(bounds.x, bounds.y); return CefPoint(bounds.x, bounds.y);
} }
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetInsets(const CefInsets& insets) {
CEF_REQUIRE_VALID_RETURN_VOID();
gfx::Insets gfx_insets(insets.top, insets.left, insets.bottom, insets.right);
root_view()->SetBorder(
gfx_insets.IsEmpty() ? nullptr : views::CreateEmptyBorder(gfx_insets));
}
CEF_VIEW_IMPL_T CefInsets CEF_VIEW_IMPL_D::GetInsets() {
CEF_REQUIRE_VALID_RETURN(CefInsets());
const auto insets = root_view()->GetInsets();
return CefInsets(insets.top(), insets.left(), insets.bottom(),
insets.right());
}
CEF_VIEW_IMPL_T CefSize CEF_VIEW_IMPL_D::GetPreferredSize() { CEF_VIEW_IMPL_T CefSize CEF_VIEW_IMPL_D::GetPreferredSize() {
CEF_REQUIRE_VALID_RETURN(CefSize()); CEF_REQUIRE_VALID_RETURN(CefSize());
const gfx::Size& size = root_view()->GetPreferredSize(); const gfx::Size& size = root_view()->GetPreferredSize();

View File

@ -20,6 +20,11 @@
#include "ui/display/win/screen_win.h" #include "ui/display/win/screen_win.h"
#endif #endif
#if defined(USE_AURA)
#include "ui/aura/window.h"
#include "ui/views/view_constants_aura.h"
#endif
namespace view_util { namespace view_util {
namespace { namespace {
@ -160,6 +165,18 @@ void ResumeOwnership(CefRefPtr<CefView> view) {
CefRefPtr<CefWindow> GetWindowFor(views::Widget* widget) { CefRefPtr<CefWindow> GetWindowFor(views::Widget* widget) {
CefRefPtr<CefWindow> window; CefRefPtr<CefWindow> window;
#if defined(USE_AURA)
// Retrieve the parent Widget for an overlay.
if (widget) {
// See matching logic in CefOverlayViewHost::Init.
auto widget_view =
widget->GetNativeView()->GetProperty(views::kHostViewKey);
if (widget_view) {
widget = widget_view->GetWidget();
}
}
#endif // defined(USE_AURA)
if (widget) { if (widget) {
// The views::WidgetDelegate should be a CefWindowView and |content_view| // The views::WidgetDelegate should be a CefWindowView and |content_view|
// should be the same CefWindowView. However, just in case the views::Widget // should be the same CefWindowView. However, just in case the views::Widget

View File

@ -156,6 +156,13 @@ CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::Layout() {
// If Layout() did not provide a size then use the preferred size. // If Layout() did not provide a size then use the preferred size.
if (ParentClass::size().IsEmpty()) if (ParentClass::size().IsEmpty())
ParentClass::SizeToPreferredSize(); ParentClass::SizeToPreferredSize();
if (cef_delegate()) {
const auto new_bounds = ParentClass::bounds();
CefRect new_rect(new_bounds.x(), new_bounds.y(), new_bounds.width(),
new_bounds.height());
cef_delegate()->OnLayoutChanged(GetCefView(), new_rect);
}
} }
CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::ViewHierarchyChanged( CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::ViewHierarchyChanged(
@ -202,9 +209,10 @@ CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::NotifyChildViewChanged(
// Only notify for children that have a known CEF root view. For example, // Only notify for children that have a known CEF root view. For example,
// don't notify when ScrollView adds child scroll bars. // don't notify when ScrollView adds child scroll bars.
CefRefPtr<CefView> child = view_util::GetFor(details.child, false); CefRefPtr<CefView> child = view_util::GetFor(details.child, false);
if (child) if (child) {
cef_delegate()->OnChildViewChanged(GetCefView(), details.is_add, child); cef_delegate()->OnChildViewChanged(GetCefView(), details.is_add, child);
} }
}
CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::NotifyParentViewChanged( CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::NotifyParentViewChanged(
const views::ViewHierarchyChangedDetails& details) { const views::ViewHierarchyChangedDetails& details) {
@ -217,10 +225,11 @@ CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::NotifyParentViewChanged(
return; return;
// The immediate parent might be an intermediate view so find the closest // The immediate parent might be an intermediate view so find the closest
// known CEF root view. // known CEF root view. |parent| might be nullptr for overlays.
CefRefPtr<CefView> parent = view_util::GetFor(details.parent, true); CefRefPtr<CefView> parent = view_util::GetFor(details.parent, true);
DCHECK(parent); if (parent) {
cef_delegate()->OnParentViewChanged(GetCefView(), details.is_add, parent); cef_delegate()->OnParentViewChanged(GetCefView(), details.is_add, parent);
} }
}
#endif // CEF_LIBCEF_BROWSER_VIEWS_VIEW_VIEW_H_ #endif // CEF_LIBCEF_BROWSER_VIEWS_VIEW_VIEW_H_

View File

@ -12,6 +12,7 @@
#include "libcef/browser/views/view_util.h" #include "libcef/browser/views/view_util.h"
#include "libcef/browser/views/window_view.h" #include "libcef/browser/views/window_view.h"
#include "base/i18n/rtl.h"
#include "ui/base/test/ui_controls.h" #include "ui/base/test/ui_controls.h"
#include "ui/compositor/compositor.h" #include "ui/compositor/compositor.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
@ -278,6 +279,15 @@ CefRefPtr<CefImage> CefWindowImpl::GetWindowAppIcon() {
return nullptr; return nullptr;
} }
CefRefPtr<CefOverlayController> CefWindowImpl::AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode) {
CEF_REQUIRE_VALID_RETURN(nullptr);
if (root_view())
return root_view()->AddOverlayView(view, docking_mode);
return nullptr;
}
void CefWindowImpl::GetDebugInfo(base::DictionaryValue* info, void CefWindowImpl::GetDebugInfo(base::DictionaryValue* info,
bool include_children) { bool include_children) {
ParentClass::GetDebugInfo(info, include_children); ParentClass::GetDebugInfo(info, include_children);

View File

@ -58,6 +58,9 @@ class CefWindowImpl
CefRefPtr<CefImage> GetWindowIcon() override; CefRefPtr<CefImage> GetWindowIcon() override;
void SetWindowAppIcon(CefRefPtr<CefImage> image) override; void SetWindowAppIcon(CefRefPtr<CefImage> image) override;
CefRefPtr<CefImage> GetWindowAppIcon() override; CefRefPtr<CefImage> GetWindowAppIcon() override;
CefRefPtr<CefOverlayController> AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode) override;
void ShowMenu(CefRefPtr<CefMenuModel> menu_model, void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point, const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position) override; cef_menu_anchor_position_t anchor_position) override;

View File

@ -312,6 +312,7 @@ void CefWindowView::CreateWidget() {
#endif #endif
widget->Init(std::move(params)); widget->Init(std::move(params));
widget->AddObserver(this);
// |widget| should now be associated with |this|. // |widget| should now be associated with |this|.
DCHECK_EQ(widget, GetWidget()); DCHECK_EQ(widget, GetWidget());
@ -465,6 +466,11 @@ void CefWindowView::ViewHierarchyChanged(
ParentClass::ViewHierarchyChanged(details); ParentClass::ViewHierarchyChanged(details);
} }
void CefWindowView::OnWidgetBoundsChanged(views::Widget* widget,
const gfx::Rect& new_bounds) {
MoveOverlaysIfNecessary();
}
display::Display CefWindowView::GetDisplay() const { display::Display CefWindowView::GetDisplay() const {
const views::Widget* widget = GetWidget(); const views::Widget* widget = GetWidget();
if (widget) { if (widget) {
@ -500,6 +506,39 @@ void CefWindowView::SetWindowAppIcon(CefRefPtr<CefImage> window_app_icon) {
widget->UpdateWindowIcon(); widget->UpdateWindowIcon();
} }
CefRefPtr<CefOverlayController> CefWindowView::AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode) {
DCHECK(view.get());
DCHECK(view->IsValid());
if (!view.get() || !view->IsValid())
return nullptr;
views::Widget* widget = GetWidget();
if (widget) {
// Owned by the View hierarchy. Acts as a z-order reference for the overlay.
auto overlay_host_view = AddChildView(std::make_unique<views::View>());
overlay_hosts_.push_back(
std::make_unique<CefOverlayViewHost>(this, docking_mode));
auto& overlay_host = overlay_hosts_.back();
overlay_host->Init(overlay_host_view, view);
return overlay_host->controller();
}
return nullptr;
}
void CefWindowView::MoveOverlaysIfNecessary() {
if (overlay_hosts_.empty())
return;
for (auto& overlay_host : overlay_hosts_) {
overlay_host->MoveIfNecessary();
}
}
void CefWindowView::SetDraggableRegions( void CefWindowView::SetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) { const std::vector<CefDraggableRegion>& regions) {
if (regions.empty()) { if (regions.empty()) {

View File

@ -6,19 +6,24 @@
#define CEF_LIBCEF_BROWSER_VIEWS_WINDOW_VIEW_H_ #define CEF_LIBCEF_BROWSER_VIEWS_WINDOW_VIEW_H_
#pragma once #pragma once
#include <vector>
#include "include/views/cef_window.h" #include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h" #include "include/views/cef_window_delegate.h"
#include "libcef/browser/views/overlay_view_host.h"
#include "libcef/browser/views/panel_view.h" #include "libcef/browser/views/panel_view.h"
#include "third_party/skia/include/core/SkRegion.h" #include "third_party/skia/include/core/SkRegion.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
#include "ui/views/widget/widget_observer.h"
// Manages the views-based root window. This object will be deleted // Manages the views-based root window. This object will be deleted
// automatically when the associated root window is destroyed. // automatically when the associated root window is destroyed.
class CefWindowView class CefWindowView
: public CefPanelView<views::WidgetDelegateView, CefWindowDelegate> { : public CefPanelView<views::WidgetDelegateView, CefWindowDelegate>,
public views::WidgetObserver {
public: public:
typedef CefPanelView<views::WidgetDelegateView, CefWindowDelegate> typedef CefPanelView<views::WidgetDelegateView, CefWindowDelegate>
ParentClass; ParentClass;
@ -70,6 +75,10 @@ class CefWindowView
void ViewHierarchyChanged( void ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) override; const views::ViewHierarchyChangedDetails& details) override;
// views::WidgetObserver methods:
void OnWidgetBoundsChanged(views::Widget* widget,
const gfx::Rect& new_bounds) override;
// Returns the Display containing this Window. // Returns the Display containing this Window.
display::Display GetDisplay() const; display::Display GetDisplay() const;
@ -89,6 +98,10 @@ class CefWindowView
void SetWindowAppIcon(CefRefPtr<CefImage> window_app_icon); void SetWindowAppIcon(CefRefPtr<CefImage> window_app_icon);
CefRefPtr<CefImage> window_app_icon() const { return window_app_icon_; } CefRefPtr<CefImage> window_app_icon() const { return window_app_icon_; }
CefRefPtr<CefOverlayController> AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode);
// Set/get the draggable regions. // Set/get the draggable regions.
void SetDraggableRegions(const std::vector<CefDraggableRegion>& regions); void SetDraggableRegions(const std::vector<CefDraggableRegion>& regions);
SkRegion* draggable_region() const { return draggable_region_.get(); } SkRegion* draggable_region() const { return draggable_region_.get(); }
@ -100,6 +113,8 @@ class CefWindowView
// Called when removed from the Widget and before |this| is deleted. // Called when removed from the Widget and before |this| is deleted.
void DeleteDelegate(); void DeleteDelegate();
void MoveOverlaysIfNecessary();
// Not owned by this object. // Not owned by this object.
Delegate* window_delegate_; Delegate* window_delegate_;
@ -112,6 +127,9 @@ class CefWindowView
std::unique_ptr<SkRegion> draggable_region_; std::unique_ptr<SkRegion> draggable_region_;
// Hosts for overlay widgets.
std::vector<std::unique_ptr<CefOverlayViewHost>> overlay_hosts_;
DISALLOW_COPY_AND_ASSIGN(CefWindowView); DISALLOW_COPY_AND_ASSIGN(CefWindowView);
}; };

View File

@ -0,0 +1,11 @@
// Copyright 2021 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_i18n_util.h"
#include "base/i18n/rtl.h"
bool CefIsRTL() {
return base::i18n::IsRTL();
}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=312985bb5cc971d1fe9d77af1f985f6a544e9db5$ // $hash=7cbe7d4732eae535d759b62e718f5ab2de570f0a$
// //
#include "libcef_dll/cpptoc/views/browser_view_cpptoc.h" #include "libcef_dll/cpptoc/views/browser_view_cpptoc.h"
@ -606,6 +606,46 @@ cef_point_t CEF_CALLBACK browser_view_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK browser_view_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefBrowserViewCppToC::Get(reinterpret_cast<cef_browser_view_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK browser_view_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefBrowserViewCppToC::Get(reinterpret_cast<cef_browser_view_t*>(self))
->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK cef_size_t CEF_CALLBACK
browser_view_get_preferred_size(struct _cef_view_t* self) { browser_view_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1120,6 +1160,8 @@ CefBrowserViewCppToC::CefBrowserViewCppToC() {
GetStruct()->base.get_size = browser_view_get_size; GetStruct()->base.get_size = browser_view_get_size;
GetStruct()->base.set_position = browser_view_set_position; GetStruct()->base.set_position = browser_view_set_position;
GetStruct()->base.get_position = browser_view_get_position; GetStruct()->base.get_position = browser_view_get_position;
GetStruct()->base.set_insets = browser_view_set_insets;
GetStruct()->base.get_insets = browser_view_get_insets;
GetStruct()->base.get_preferred_size = browser_view_get_preferred_size; GetStruct()->base.get_preferred_size = browser_view_get_preferred_size;
GetStruct()->base.size_to_preferred_size = GetStruct()->base.size_to_preferred_size =
browser_view_size_to_preferred_size; browser_view_size_to_preferred_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=8e8daae6a8ed718582045ea42e16906813b77337$ // $hash=3067f33d10bbd2f7555a6a809bad7ea8e97dbece$
// //
#include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
@ -343,6 +343,35 @@ browser_view_delegate_on_window_changed(struct _cef_view_delegate_t* self,
->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false); ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
} }
void CEF_CALLBACK
browser_view_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefBrowserViewDelegateCppToC::Get(
reinterpret_cast<cef_browser_view_delegate_t*>(self))
->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
}
void CEF_CALLBACK void CEF_CALLBACK
browser_view_delegate_on_focus(struct _cef_view_delegate_t* self, browser_view_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
@ -410,6 +439,7 @@ CefBrowserViewDelegateCppToC::CefBrowserViewDelegateCppToC() {
GetStruct()->base.on_child_view_changed = GetStruct()->base.on_child_view_changed =
browser_view_delegate_on_child_view_changed; browser_view_delegate_on_child_view_changed;
GetStruct()->base.on_window_changed = browser_view_delegate_on_window_changed; GetStruct()->base.on_window_changed = browser_view_delegate_on_window_changed;
GetStruct()->base.on_layout_changed = browser_view_delegate_on_layout_changed;
GetStruct()->base.on_focus = browser_view_delegate_on_focus; GetStruct()->base.on_focus = browser_view_delegate_on_focus;
GetStruct()->base.on_blur = browser_view_delegate_on_blur; GetStruct()->base.on_blur = browser_view_delegate_on_blur;
} }

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=a0060b09d6eb4bbeeb69e4b80dccccee394d600e$ // $hash=328f5caabb9eb92f668961216f9812b2a9bc3ee7$
// //
#include "libcef_dll/cpptoc/views/button_cpptoc.h" #include "libcef_dll/cpptoc/views/button_cpptoc.h"
@ -580,6 +580,45 @@ cef_point_t CEF_CALLBACK button_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK button_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefButtonCppToC::Get(reinterpret_cast<cef_button_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK button_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefButtonCppToC::Get(reinterpret_cast<cef_button_t*>(self))->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK button_get_preferred_size(struct _cef_view_t* self) { cef_size_t CEF_CALLBACK button_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1076,6 +1115,8 @@ CefButtonCppToC::CefButtonCppToC() {
GetStruct()->base.get_size = button_get_size; GetStruct()->base.get_size = button_get_size;
GetStruct()->base.set_position = button_set_position; GetStruct()->base.set_position = button_set_position;
GetStruct()->base.get_position = button_get_position; GetStruct()->base.get_position = button_get_position;
GetStruct()->base.set_insets = button_set_insets;
GetStruct()->base.get_insets = button_get_insets;
GetStruct()->base.get_preferred_size = button_get_preferred_size; GetStruct()->base.get_preferred_size = button_get_preferred_size;
GetStruct()->base.size_to_preferred_size = button_size_to_preferred_size; GetStruct()->base.size_to_preferred_size = button_size_to_preferred_size;
GetStruct()->base.get_minimum_size = button_get_minimum_size; GetStruct()->base.get_minimum_size = button_get_minimum_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=52a0deb8b7ae62e474acb1474cf922c3e9a04f14$ // $hash=ae5b6dce4c1840faa597c2dcb2b92772fa4f8de4$
// //
#include "libcef_dll/cpptoc/views/button_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/button_delegate_cpptoc.h"
@ -234,6 +234,34 @@ button_delegate_on_window_changed(struct _cef_view_delegate_t* self,
->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false); ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
} }
void CEF_CALLBACK
button_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
}
void CEF_CALLBACK button_delegate_on_focus(struct _cef_view_delegate_t* self, void CEF_CALLBACK button_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -289,6 +317,7 @@ CefButtonDelegateCppToC::CefButtonDelegateCppToC() {
GetStruct()->base.on_child_view_changed = GetStruct()->base.on_child_view_changed =
button_delegate_on_child_view_changed; button_delegate_on_child_view_changed;
GetStruct()->base.on_window_changed = button_delegate_on_window_changed; GetStruct()->base.on_window_changed = button_delegate_on_window_changed;
GetStruct()->base.on_layout_changed = button_delegate_on_layout_changed;
GetStruct()->base.on_focus = button_delegate_on_focus; GetStruct()->base.on_focus = button_delegate_on_focus;
GetStruct()->base.on_blur = button_delegate_on_blur; GetStruct()->base.on_blur = button_delegate_on_blur;
} }

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=f723bc389e8df80f926a3e1952d9ba0241fcb494$ // $hash=4831a878243309dc259eea8ac107a2654b0da9fd$
// //
#include "libcef_dll/cpptoc/views/label_button_cpptoc.h" #include "libcef_dll/cpptoc/views/label_button_cpptoc.h"
@ -826,6 +826,46 @@ cef_point_t CEF_CALLBACK label_button_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK label_button_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefLabelButtonCppToC::Get(reinterpret_cast<cef_label_button_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK label_button_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefLabelButtonCppToC::Get(reinterpret_cast<cef_label_button_t*>(self))
->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK cef_size_t CEF_CALLBACK
label_button_get_preferred_size(struct _cef_view_t* self) { label_button_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1355,6 +1395,8 @@ CefLabelButtonCppToC::CefLabelButtonCppToC() {
GetStruct()->base.base.get_size = label_button_get_size; GetStruct()->base.base.get_size = label_button_get_size;
GetStruct()->base.base.set_position = label_button_set_position; GetStruct()->base.base.set_position = label_button_set_position;
GetStruct()->base.base.get_position = label_button_get_position; GetStruct()->base.base.get_position = label_button_get_position;
GetStruct()->base.base.set_insets = label_button_set_insets;
GetStruct()->base.base.get_insets = label_button_get_insets;
GetStruct()->base.base.get_preferred_size = label_button_get_preferred_size; GetStruct()->base.base.get_preferred_size = label_button_get_preferred_size;
GetStruct()->base.base.size_to_preferred_size = GetStruct()->base.base.size_to_preferred_size =
label_button_size_to_preferred_size; label_button_size_to_preferred_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=97c8a26550af49abfe4a1fcf1d8d54193c5fb3b1$ // $hash=17a2490a2076439fca2ee7e6c2984f9307b880fc$
// //
#include "libcef_dll/cpptoc/views/menu_button_cpptoc.h" #include "libcef_dll/cpptoc/views/menu_button_cpptoc.h"
@ -878,6 +878,46 @@ cef_point_t CEF_CALLBACK menu_button_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK menu_button_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefMenuButtonCppToC::Get(reinterpret_cast<cef_menu_button_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK menu_button_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefMenuButtonCppToC::Get(reinterpret_cast<cef_menu_button_t*>(self))
->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK cef_size_t CEF_CALLBACK
menu_button_get_preferred_size(struct _cef_view_t* self) { menu_button_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1407,6 +1447,8 @@ CefMenuButtonCppToC::CefMenuButtonCppToC() {
GetStruct()->base.base.base.get_size = menu_button_get_size; GetStruct()->base.base.base.get_size = menu_button_get_size;
GetStruct()->base.base.base.set_position = menu_button_set_position; GetStruct()->base.base.base.set_position = menu_button_set_position;
GetStruct()->base.base.base.get_position = menu_button_get_position; GetStruct()->base.base.base.get_position = menu_button_get_position;
GetStruct()->base.base.base.set_insets = menu_button_set_insets;
GetStruct()->base.base.base.get_insets = menu_button_get_insets;
GetStruct()->base.base.base.get_preferred_size = GetStruct()->base.base.base.get_preferred_size =
menu_button_get_preferred_size; menu_button_get_preferred_size;
GetStruct()->base.base.base.size_to_preferred_size = GetStruct()->base.base.base.size_to_preferred_size =

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=2fcd1d4d2126285209e1fa782beccbb363693bf3$ // $hash=36a7761d47db5574fc6504b42a988e9f12ef234c$
// //
#include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h"
@ -274,6 +274,35 @@ menu_button_delegate_on_window_changed(struct _cef_view_delegate_t* self,
->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false); ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
} }
void CEF_CALLBACK
menu_button_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefMenuButtonDelegateCppToC::Get(
reinterpret_cast<cef_menu_button_delegate_t*>(self))
->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
}
void CEF_CALLBACK void CEF_CALLBACK
menu_button_delegate_on_focus(struct _cef_view_delegate_t* self, menu_button_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
@ -340,6 +369,8 @@ CefMenuButtonDelegateCppToC::CefMenuButtonDelegateCppToC() {
menu_button_delegate_on_child_view_changed; menu_button_delegate_on_child_view_changed;
GetStruct()->base.base.on_window_changed = GetStruct()->base.base.on_window_changed =
menu_button_delegate_on_window_changed; menu_button_delegate_on_window_changed;
GetStruct()->base.base.on_layout_changed =
menu_button_delegate_on_layout_changed;
GetStruct()->base.base.on_focus = menu_button_delegate_on_focus; GetStruct()->base.base.on_focus = menu_button_delegate_on_focus;
GetStruct()->base.base.on_blur = menu_button_delegate_on_blur; GetStruct()->base.base.on_blur = menu_button_delegate_on_blur;
} }

View File

@ -0,0 +1,416 @@
// Copyright (c) 2021 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=5f6f27874fc4e0ee698920fa734254eac9d14efa$
//
#include "libcef_dll/cpptoc/views/overlay_controller_cpptoc.h"
#include "libcef_dll/cpptoc/views/view_cpptoc.h"
#include "libcef_dll/cpptoc/views/window_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK
overlay_controller_is_valid(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefOverlayControllerCppToC::Get(self)->IsValid();
// Return type: bool
return _retval;
}
int CEF_CALLBACK
overlay_controller_is_same(struct _cef_overlay_controller_t* self,
struct _cef_overlay_controller_t* that) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: that; type: refptr_same
DCHECK(that);
if (!that)
return 0;
// Execute
bool _retval = CefOverlayControllerCppToC::Get(self)->IsSame(
CefOverlayControllerCppToC::Unwrap(that));
// Return type: bool
return _retval;
}
struct _cef_view_t* CEF_CALLBACK
overlay_controller_get_contents_view(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefView> _retval =
CefOverlayControllerCppToC::Get(self)->GetContentsView();
// Return type: refptr_same
return CefViewCppToC::Wrap(_retval);
}
struct _cef_window_t* CEF_CALLBACK
overlay_controller_get_window(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefWindow> _retval =
CefOverlayControllerCppToC::Get(self)->GetWindow();
// Return type: refptr_same
return CefWindowCppToC::Wrap(_retval);
}
cef_docking_mode_t CEF_CALLBACK
overlay_controller_get_docking_mode(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CEF_DOCKING_MODE_TOP_LEFT;
// Execute
cef_docking_mode_t _retval =
CefOverlayControllerCppToC::Get(self)->GetDockingMode();
// Return type: simple
return _retval;
}
void CEF_CALLBACK
overlay_controller_destroy(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefOverlayControllerCppToC::Get(self)->Destroy();
}
void CEF_CALLBACK
overlay_controller_set_bounds(struct _cef_overlay_controller_t* self,
const cef_rect_t* bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: bounds; type: simple_byref_const
DCHECK(bounds);
if (!bounds)
return;
// Translate param: bounds; type: simple_byref_const
CefRect boundsVal = bounds ? *bounds : CefRect();
// Execute
CefOverlayControllerCppToC::Get(self)->SetBounds(boundsVal);
}
cef_rect_t CEF_CALLBACK
overlay_controller_get_bounds(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefRect();
// Execute
cef_rect_t _retval = CefOverlayControllerCppToC::Get(self)->GetBounds();
// Return type: simple
return _retval;
}
cef_rect_t CEF_CALLBACK overlay_controller_get_bounds_in_screen(
struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefRect();
// Execute
cef_rect_t _retval =
CefOverlayControllerCppToC::Get(self)->GetBoundsInScreen();
// Return type: simple
return _retval;
}
void CEF_CALLBACK
overlay_controller_set_size(struct _cef_overlay_controller_t* self,
const cef_size_t* size) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: size; type: simple_byref_const
DCHECK(size);
if (!size)
return;
// Translate param: size; type: simple_byref_const
CefSize sizeVal = size ? *size : CefSize();
// Execute
CefOverlayControllerCppToC::Get(self)->SetSize(sizeVal);
}
cef_size_t CEF_CALLBACK
overlay_controller_get_size(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefSize();
// Execute
cef_size_t _retval = CefOverlayControllerCppToC::Get(self)->GetSize();
// Return type: simple
return _retval;
}
void CEF_CALLBACK
overlay_controller_set_position(struct _cef_overlay_controller_t* self,
const cef_point_t* position) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: position; type: simple_byref_const
DCHECK(position);
if (!position)
return;
// Translate param: position; type: simple_byref_const
CefPoint positionVal = position ? *position : CefPoint();
// Execute
CefOverlayControllerCppToC::Get(self)->SetPosition(positionVal);
}
cef_point_t CEF_CALLBACK
overlay_controller_get_position(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefPoint();
// Execute
cef_point_t _retval = CefOverlayControllerCppToC::Get(self)->GetPosition();
// Return type: simple
return _retval;
}
void CEF_CALLBACK
overlay_controller_set_insets(struct _cef_overlay_controller_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefOverlayControllerCppToC::Get(self)->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK
overlay_controller_get_insets(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval = CefOverlayControllerCppToC::Get(self)->GetInsets();
// Return type: simple
return _retval;
}
void CEF_CALLBACK overlay_controller_size_to_preferred_size(
struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefOverlayControllerCppToC::Get(self)->SizeToPreferredSize();
}
void CEF_CALLBACK
overlay_controller_set_visible(struct _cef_overlay_controller_t* self,
int visible) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefOverlayControllerCppToC::Get(self)->SetVisible(visible ? true : false);
}
int CEF_CALLBACK
overlay_controller_is_visible(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefOverlayControllerCppToC::Get(self)->IsVisible();
// Return type: bool
return _retval;
}
int CEF_CALLBACK
overlay_controller_is_drawn(struct _cef_overlay_controller_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefOverlayControllerCppToC::Get(self)->IsDrawn();
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefOverlayControllerCppToC::CefOverlayControllerCppToC() {
GetStruct()->is_valid = overlay_controller_is_valid;
GetStruct()->is_same = overlay_controller_is_same;
GetStruct()->get_contents_view = overlay_controller_get_contents_view;
GetStruct()->get_window = overlay_controller_get_window;
GetStruct()->get_docking_mode = overlay_controller_get_docking_mode;
GetStruct()->destroy = overlay_controller_destroy;
GetStruct()->set_bounds = overlay_controller_set_bounds;
GetStruct()->get_bounds = overlay_controller_get_bounds;
GetStruct()->get_bounds_in_screen = overlay_controller_get_bounds_in_screen;
GetStruct()->set_size = overlay_controller_set_size;
GetStruct()->get_size = overlay_controller_get_size;
GetStruct()->set_position = overlay_controller_set_position;
GetStruct()->get_position = overlay_controller_get_position;
GetStruct()->set_insets = overlay_controller_set_insets;
GetStruct()->get_insets = overlay_controller_get_insets;
GetStruct()->size_to_preferred_size =
overlay_controller_size_to_preferred_size;
GetStruct()->set_visible = overlay_controller_set_visible;
GetStruct()->is_visible = overlay_controller_is_visible;
GetStruct()->is_drawn = overlay_controller_is_drawn;
}
// DESTRUCTOR - Do not edit by hand.
CefOverlayControllerCppToC::~CefOverlayControllerCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefOverlayController> CefCppToCRefCounted<
CefOverlayControllerCppToC,
CefOverlayController,
cef_overlay_controller_t>::UnwrapDerived(CefWrapperType type,
cef_overlay_controller_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefOverlayControllerCppToC,
CefOverlayController,
cef_overlay_controller_t>::kWrapperType =
WT_OVERLAY_CONTROLLER;

View File

@ -0,0 +1,42 @@
// Copyright (c) 2021 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=a35c34c93f38c7db53ddd261a1631ef52d0f5ab5$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_VIEWS_OVERLAY_CONTROLLER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_VIEWS_OVERLAY_CONTROLLER_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/views/cef_overlay_controller_capi.h"
#include "include/capi/views/cef_view_capi.h"
#include "include/capi/views/cef_window_capi.h"
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_view.h"
#include "include/views/cef_window.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefOverlayControllerCppToC
: public CefCppToCRefCounted<CefOverlayControllerCppToC,
CefOverlayController,
cef_overlay_controller_t> {
public:
CefOverlayControllerCppToC();
virtual ~CefOverlayControllerCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_VIEWS_OVERLAY_CONTROLLER_CPPTOC_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=46ba2afdb3ede88d0eb37df2726ab5ff33fb6983$ // $hash=6a2e3823506ccfeeff53ac719edf6e912056e3a3$
// //
#include "libcef_dll/cpptoc/views/panel_cpptoc.h" #include "libcef_dll/cpptoc/views/panel_cpptoc.h"
@ -713,6 +713,45 @@ cef_point_t CEF_CALLBACK panel_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK panel_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefPanelCppToC::Get(reinterpret_cast<cef_panel_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK panel_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefPanelCppToC::Get(reinterpret_cast<cef_panel_t*>(self))->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK panel_get_preferred_size(struct _cef_view_t* self) { cef_size_t CEF_CALLBACK panel_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1210,6 +1249,8 @@ CefPanelCppToC::CefPanelCppToC() {
GetStruct()->base.get_size = panel_get_size; GetStruct()->base.get_size = panel_get_size;
GetStruct()->base.set_position = panel_set_position; GetStruct()->base.set_position = panel_set_position;
GetStruct()->base.get_position = panel_get_position; GetStruct()->base.get_position = panel_get_position;
GetStruct()->base.set_insets = panel_set_insets;
GetStruct()->base.get_insets = panel_get_insets;
GetStruct()->base.get_preferred_size = panel_get_preferred_size; GetStruct()->base.get_preferred_size = panel_get_preferred_size;
GetStruct()->base.size_to_preferred_size = panel_size_to_preferred_size; GetStruct()->base.size_to_preferred_size = panel_size_to_preferred_size;
GetStruct()->base.get_minimum_size = panel_get_minimum_size; GetStruct()->base.get_minimum_size = panel_get_minimum_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=dd29f2990766a766a27dece7e39501eb11a296fd$ // $hash=d212d26c4fdb8c0b24a9f1ea12d0a402b8466995$
// //
#include "libcef_dll/cpptoc/views/panel_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/panel_delegate_cpptoc.h"
@ -193,6 +193,34 @@ panel_delegate_on_window_changed(struct _cef_view_delegate_t* self,
->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false); ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
} }
void CEF_CALLBACK
panel_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
}
void CEF_CALLBACK panel_delegate_on_focus(struct _cef_view_delegate_t* self, void CEF_CALLBACK panel_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -245,6 +273,7 @@ CefPanelDelegateCppToC::CefPanelDelegateCppToC() {
GetStruct()->base.on_child_view_changed = GetStruct()->base.on_child_view_changed =
panel_delegate_on_child_view_changed; panel_delegate_on_child_view_changed;
GetStruct()->base.on_window_changed = panel_delegate_on_window_changed; GetStruct()->base.on_window_changed = panel_delegate_on_window_changed;
GetStruct()->base.on_layout_changed = panel_delegate_on_layout_changed;
GetStruct()->base.on_focus = panel_delegate_on_focus; GetStruct()->base.on_focus = panel_delegate_on_focus;
GetStruct()->base.on_blur = panel_delegate_on_blur; GetStruct()->base.on_blur = panel_delegate_on_blur;
} }

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=88d6df521d18ef28e9e2e7cbe31ecf6c96351430$ // $hash=1b422791d4b286e5113f4867aa8da38e21e2a2ed$
// //
#include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h" #include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h"
@ -634,6 +634,46 @@ cef_point_t CEF_CALLBACK scroll_view_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK scroll_view_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefScrollViewCppToC::Get(reinterpret_cast<cef_scroll_view_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK scroll_view_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefScrollViewCppToC::Get(reinterpret_cast<cef_scroll_view_t*>(self))
->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK cef_size_t CEF_CALLBACK
scroll_view_get_preferred_size(struct _cef_view_t* self) { scroll_view_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1149,6 +1189,8 @@ CefScrollViewCppToC::CefScrollViewCppToC() {
GetStruct()->base.get_size = scroll_view_get_size; GetStruct()->base.get_size = scroll_view_get_size;
GetStruct()->base.set_position = scroll_view_set_position; GetStruct()->base.set_position = scroll_view_set_position;
GetStruct()->base.get_position = scroll_view_get_position; GetStruct()->base.get_position = scroll_view_get_position;
GetStruct()->base.set_insets = scroll_view_set_insets;
GetStruct()->base.get_insets = scroll_view_get_insets;
GetStruct()->base.get_preferred_size = scroll_view_get_preferred_size; GetStruct()->base.get_preferred_size = scroll_view_get_preferred_size;
GetStruct()->base.size_to_preferred_size = scroll_view_size_to_preferred_size; GetStruct()->base.size_to_preferred_size = scroll_view_size_to_preferred_size;
GetStruct()->base.get_minimum_size = scroll_view_get_minimum_size; GetStruct()->base.get_minimum_size = scroll_view_get_minimum_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=fd6b1cf787b563525dac101a765b7c399356e00c$ // $hash=41aa4a08d59759dd53429976da36299374a554d7$
// //
#include "libcef_dll/cpptoc/views/textfield_cpptoc.h" #include "libcef_dll/cpptoc/views/textfield_cpptoc.h"
@ -1035,6 +1035,46 @@ cef_point_t CEF_CALLBACK textfield_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK textfield_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefTextfieldCppToC::Get(reinterpret_cast<cef_textfield_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK textfield_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefTextfieldCppToC::Get(reinterpret_cast<cef_textfield_t*>(self))
->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK textfield_get_preferred_size(struct _cef_view_t* self) { cef_size_t CEF_CALLBACK textfield_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1572,6 +1612,8 @@ CefTextfieldCppToC::CefTextfieldCppToC() {
GetStruct()->base.get_size = textfield_get_size; GetStruct()->base.get_size = textfield_get_size;
GetStruct()->base.set_position = textfield_set_position; GetStruct()->base.set_position = textfield_set_position;
GetStruct()->base.get_position = textfield_get_position; GetStruct()->base.get_position = textfield_get_position;
GetStruct()->base.set_insets = textfield_set_insets;
GetStruct()->base.get_insets = textfield_get_insets;
GetStruct()->base.get_preferred_size = textfield_get_preferred_size; GetStruct()->base.get_preferred_size = textfield_get_preferred_size;
GetStruct()->base.size_to_preferred_size = textfield_size_to_preferred_size; GetStruct()->base.size_to_preferred_size = textfield_size_to_preferred_size;
GetStruct()->base.get_minimum_size = textfield_get_minimum_size; GetStruct()->base.get_minimum_size = textfield_get_minimum_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=e35b635ec442c8910b02aca64d48760b1360c868$ // $hash=9c22ccd70661c2c23bc5bbb6f80f4b04d42c90fe$
// //
#include "libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h"
@ -249,6 +249,35 @@ textfield_delegate_on_window_changed(struct _cef_view_delegate_t* self,
->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false); ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
} }
void CEF_CALLBACK
textfield_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefTextfieldDelegateCppToC::Get(
reinterpret_cast<cef_textfield_delegate_t*>(self))
->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
}
void CEF_CALLBACK textfield_delegate_on_focus(struct _cef_view_delegate_t* self, void CEF_CALLBACK textfield_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -306,6 +335,7 @@ CefTextfieldDelegateCppToC::CefTextfieldDelegateCppToC() {
GetStruct()->base.on_child_view_changed = GetStruct()->base.on_child_view_changed =
textfield_delegate_on_child_view_changed; textfield_delegate_on_child_view_changed;
GetStruct()->base.on_window_changed = textfield_delegate_on_window_changed; GetStruct()->base.on_window_changed = textfield_delegate_on_window_changed;
GetStruct()->base.on_layout_changed = textfield_delegate_on_layout_changed;
GetStruct()->base.on_focus = textfield_delegate_on_focus; GetStruct()->base.on_focus = textfield_delegate_on_focus;
GetStruct()->base.on_blur = textfield_delegate_on_blur; GetStruct()->base.on_blur = textfield_delegate_on_blur;
} }

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=0884539e94e09316a9e516d93d77743c6287fe9a$ // $hash=df095c7377045f70561ee276a15fd0c13769851c$
// //
#include "libcef_dll/cpptoc/views/view_cpptoc.h" #include "libcef_dll/cpptoc/views/view_cpptoc.h"
@ -449,6 +449,43 @@ cef_point_t CEF_CALLBACK view_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK view_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefViewCppToC::Get(self)->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK view_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval = CefViewCppToC::Get(self)->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK view_get_preferred_size(struct _cef_view_t* self) { cef_size_t CEF_CALLBACK view_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -912,6 +949,8 @@ CefViewCppToC::CefViewCppToC() {
GetStruct()->get_size = view_get_size; GetStruct()->get_size = view_get_size;
GetStruct()->set_position = view_set_position; GetStruct()->set_position = view_set_position;
GetStruct()->get_position = view_get_position; GetStruct()->get_position = view_get_position;
GetStruct()->set_insets = view_set_insets;
GetStruct()->get_insets = view_get_insets;
GetStruct()->get_preferred_size = view_get_preferred_size; GetStruct()->get_preferred_size = view_get_preferred_size;
GetStruct()->size_to_preferred_size = view_size_to_preferred_size; GetStruct()->size_to_preferred_size = view_size_to_preferred_size;
GetStruct()->get_minimum_size = view_get_minimum_size; GetStruct()->get_minimum_size = view_get_minimum_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=7c6283658d49420281d02b4793f65f478f261461$ // $hash=fd17603645550a551edbab0248dbe75afa074c19$
// //
#include "libcef_dll/cpptoc/views/view_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/view_delegate_cpptoc.h"
@ -194,6 +194,34 @@ view_delegate_on_window_changed(struct _cef_view_delegate_t* self,
added ? true : false); added ? true : false);
} }
void CEF_CALLBACK
view_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefViewDelegateCppToC::Get(self)->OnLayoutChanged(CefViewCToCpp::Wrap(view),
new_boundsVal);
}
void CEF_CALLBACK view_delegate_on_focus(struct _cef_view_delegate_t* self, void CEF_CALLBACK view_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -242,6 +270,7 @@ CefViewDelegateCppToC::CefViewDelegateCppToC() {
GetStruct()->on_parent_view_changed = view_delegate_on_parent_view_changed; GetStruct()->on_parent_view_changed = view_delegate_on_parent_view_changed;
GetStruct()->on_child_view_changed = view_delegate_on_child_view_changed; GetStruct()->on_child_view_changed = view_delegate_on_child_view_changed;
GetStruct()->on_window_changed = view_delegate_on_window_changed; GetStruct()->on_window_changed = view_delegate_on_window_changed;
GetStruct()->on_layout_changed = view_delegate_on_layout_changed;
GetStruct()->on_focus = view_delegate_on_focus; GetStruct()->on_focus = view_delegate_on_focus;
GetStruct()->on_blur = view_delegate_on_blur; GetStruct()->on_blur = view_delegate_on_blur;
} }

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=1d17ae751431af3baf83b3386f1cab410964a17f$ // $hash=180f352b0c01effd2e61c3879b81dcd3b0989d0a$
// //
#include "libcef_dll/cpptoc/views/window_cpptoc.h" #include "libcef_dll/cpptoc/views/window_cpptoc.h"
@ -21,6 +21,7 @@
#include "libcef_dll/cpptoc/views/display_cpptoc.h" #include "libcef_dll/cpptoc/views/display_cpptoc.h"
#include "libcef_dll/cpptoc/views/fill_layout_cpptoc.h" #include "libcef_dll/cpptoc/views/fill_layout_cpptoc.h"
#include "libcef_dll/cpptoc/views/layout_cpptoc.h" #include "libcef_dll/cpptoc/views/layout_cpptoc.h"
#include "libcef_dll/cpptoc/views/overlay_controller_cpptoc.h"
#include "libcef_dll/cpptoc/views/panel_cpptoc.h" #include "libcef_dll/cpptoc/views/panel_cpptoc.h"
#include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h" #include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h"
#include "libcef_dll/cpptoc/views/textfield_cpptoc.h" #include "libcef_dll/cpptoc/views/textfield_cpptoc.h"
@ -414,6 +415,31 @@ window_get_window_app_icon(struct _cef_window_t* self) {
return CefImageCppToC::Wrap(_retval); return CefImageCppToC::Wrap(_retval);
} }
cef_overlay_controller_t* CEF_CALLBACK
window_add_overlay_view(struct _cef_window_t* self,
cef_view_t* view,
cef_docking_mode_t docking_mode) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: view; type: refptr_same
DCHECK(view);
if (!view)
return NULL;
// Execute
CefRefPtr<CefOverlayController> _retval =
CefWindowCppToC::Get(self)->AddOverlayView(CefViewCppToC::Unwrap(view),
docking_mode);
// Return type: refptr_same
return CefOverlayControllerCppToC::Wrap(_retval);
}
void CEF_CALLBACK window_show_menu(struct _cef_window_t* self, void CEF_CALLBACK window_show_menu(struct _cef_window_t* self,
cef_menu_model_t* menu_model, cef_menu_model_t* menu_model,
const cef_point_t* screen_point, const cef_point_t* screen_point,
@ -1309,6 +1335,45 @@ cef_point_t CEF_CALLBACK window_get_position(struct _cef_view_t* self) {
return _retval; return _retval;
} }
void CEF_CALLBACK window_set_insets(struct _cef_view_t* self,
const cef_insets_t* insets) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: insets; type: simple_byref_const
DCHECK(insets);
if (!insets)
return;
// Translate param: insets; type: simple_byref_const
CefInsets insetsVal = insets ? *insets : CefInsets();
// Execute
CefWindowCppToC::Get(reinterpret_cast<cef_window_t*>(self))
->SetInsets(insetsVal);
}
cef_insets_t CEF_CALLBACK window_get_insets(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefInsets();
// Execute
cef_insets_t _retval =
CefWindowCppToC::Get(reinterpret_cast<cef_window_t*>(self))->GetInsets();
// Return type: simple
return _retval;
}
cef_size_t CEF_CALLBACK window_get_preferred_size(struct _cef_view_t* self) { cef_size_t CEF_CALLBACK window_get_preferred_size(struct _cef_view_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -1798,6 +1863,7 @@ CefWindowCppToC::CefWindowCppToC() {
GetStruct()->get_window_icon = window_get_window_icon; GetStruct()->get_window_icon = window_get_window_icon;
GetStruct()->set_window_app_icon = window_set_window_app_icon; GetStruct()->set_window_app_icon = window_set_window_app_icon;
GetStruct()->get_window_app_icon = window_get_window_app_icon; GetStruct()->get_window_app_icon = window_get_window_app_icon;
GetStruct()->add_overlay_view = window_add_overlay_view;
GetStruct()->show_menu = window_show_menu; GetStruct()->show_menu = window_show_menu;
GetStruct()->cancel_menu = window_cancel_menu; GetStruct()->cancel_menu = window_cancel_menu;
GetStruct()->get_display = window_get_display; GetStruct()->get_display = window_get_display;
@ -1848,6 +1914,8 @@ CefWindowCppToC::CefWindowCppToC() {
GetStruct()->base.base.get_size = window_get_size; GetStruct()->base.base.get_size = window_get_size;
GetStruct()->base.base.set_position = window_set_position; GetStruct()->base.base.set_position = window_set_position;
GetStruct()->base.base.get_position = window_get_position; GetStruct()->base.base.get_position = window_get_position;
GetStruct()->base.base.set_insets = window_set_insets;
GetStruct()->base.base.get_insets = window_get_insets;
GetStruct()->base.base.get_preferred_size = window_get_preferred_size; GetStruct()->base.base.get_preferred_size = window_get_preferred_size;
GetStruct()->base.base.size_to_preferred_size = window_size_to_preferred_size; GetStruct()->base.base.size_to_preferred_size = window_size_to_preferred_size;
GetStruct()->base.base.get_minimum_size = window_get_minimum_size; GetStruct()->base.base.get_minimum_size = window_get_minimum_size;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=a201b988556a825fffe39f58e378664b93795c72$ // $hash=d6a40fcd6be6297224b573ac1600701ff6818680$
// //
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
@ -473,6 +473,34 @@ window_delegate_on_window_changed(struct _cef_view_delegate_t* self,
->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false); ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
} }
void CEF_CALLBACK
window_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
cef_view_t* view,
const cef_rect_t* new_bounds) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: view; type: refptr_diff
DCHECK(view);
if (!view)
return;
// Verify param: new_bounds; type: simple_byref_const
DCHECK(new_bounds);
if (!new_bounds)
return;
// Translate param: new_bounds; type: simple_byref_const
CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
// Execute
CefWindowDelegateCppToC::Get(reinterpret_cast<cef_window_delegate_t*>(self))
->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
}
void CEF_CALLBACK window_delegate_on_focus(struct _cef_view_delegate_t* self, void CEF_CALLBACK window_delegate_on_focus(struct _cef_view_delegate_t* self,
cef_view_t* view) { cef_view_t* view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -538,6 +566,7 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
GetStruct()->base.base.on_child_view_changed = GetStruct()->base.base.on_child_view_changed =
window_delegate_on_child_view_changed; window_delegate_on_child_view_changed;
GetStruct()->base.base.on_window_changed = window_delegate_on_window_changed; GetStruct()->base.base.on_window_changed = window_delegate_on_window_changed;
GetStruct()->base.base.on_layout_changed = window_delegate_on_layout_changed;
GetStruct()->base.base.on_focus = window_delegate_on_focus; GetStruct()->base.base.on_focus = window_delegate_on_focus;
GetStruct()->base.base.on_blur = window_delegate_on_blur; GetStruct()->base.base.on_blur = window_delegate_on_blur;
} }

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=912a0807db8bc1405188d61961545cc8e540aacf$ // $hash=fc8a176aa84aa99ad132a5d3853c8ea16ce6660f$
// //
#include "libcef_dll/ctocpp/views/browser_view_ctocpp.h" #include "libcef_dll/ctocpp/views/browser_view_ctocpp.h"
@ -530,6 +530,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefBrowserViewCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefBrowserViewCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefBrowserViewCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefBrowserViewCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefBrowserViewCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=1c713db1e73d434b6bce3aea8e3a6dddbc547b61$ // $hash=93f91329a1d2db5d20805cb10ee30e1fcd6c3185$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_CTOCPP_H_
@ -64,6 +64,8 @@ class CefBrowserViewCToCpp : public CefCToCppRefCounted<CefBrowserViewCToCpp,
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=9aed01b6014f1c22815e7847eba321d75dbfa45d$ // $hash=8116871f028f4c3426e87298fcd20480f8094726$
// //
#include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h"
@ -332,6 +332,27 @@ void CefBrowserViewDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefBrowserViewDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct =
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefBrowserViewDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefBrowserViewDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=20b067cabc4baa4c9edecaffb38a2ebb28524ccc$ // $hash=13f61ebbe80de396a56f2dd894c8137031133c83$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_DELEGATE_CTOCPP_H_
@ -65,6 +65,8 @@ class CefBrowserViewDelegateCToCpp
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=b359b8f9e2c70946ed9831869100e82774a5ea2d$ // $hash=d7b21b37439e1b87e9b9c61fbd86b6cfdb4d3c8d$
// //
#include "libcef_dll/ctocpp/views/button_ctocpp.h" #include "libcef_dll/ctocpp/views/button_ctocpp.h"
@ -526,6 +526,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefButtonCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefButtonCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefButtonCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefButtonCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefButtonCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=b543831782043e1651b8adfa907a60b553267ca7$ // $hash=bc6f35f85cc77030a7e36e1ebbb97cb9091cf976$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_CTOCPP_H_
@ -68,6 +68,8 @@ class CefButtonCToCpp
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=fc962d2832eeb3dee99e9a201f234d4a4b4d6f0f$ // $hash=10978e1021326cd0f21f84c0b35350e846b47fe9$
// //
#include "libcef_dll/ctocpp/views/button_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/button_delegate_ctocpp.h"
@ -231,6 +231,27 @@ void CefButtonDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefButtonDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct =
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefButtonDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefButtonDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=6a72a71a9becd6103d44719ed88b000d576d95eb$ // $hash=1120cbc3b78c41223e94493bf4416899f1b936ed$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_DELEGATE_CTOCPP_H_
@ -52,6 +52,8 @@ class CefButtonDelegateCToCpp
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=7e8ef08cc7510dc0ca0b580ae4d8031cb7acc268$ // $hash=21aa8991b400583b47f7cc29fb55334ff07b1eb4$
// //
#include "libcef_dll/ctocpp/views/label_button_ctocpp.h" #include "libcef_dll/ctocpp/views/label_button_ctocpp.h"
@ -737,6 +737,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefLabelButtonCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefLabelButtonCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefLabelButtonCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefLabelButtonCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefLabelButtonCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=ef0338428bd0261ccfc0235718d8d1bd81e30315$ // $hash=bb881cc52836308013fb9737d645077b623d55df$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_LABEL_BUTTON_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_LABEL_BUTTON_CTOCPP_H_
@ -83,6 +83,8 @@ class CefLabelButtonCToCpp : public CefCToCppRefCounted<CefLabelButtonCToCpp,
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=8f766b8f5a014054dcc79f504d34d0df27f75f9d$ // $hash=7bdcfa2babc3a05789f73a5105aed80e11efe592$
// //
#include "libcef_dll/ctocpp/views/menu_button_ctocpp.h" #include "libcef_dll/ctocpp/views/menu_button_ctocpp.h"
@ -783,6 +783,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefMenuButtonCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefMenuButtonCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefMenuButtonCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefMenuButtonCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefMenuButtonCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=90b4b0b803eaeef6873d455a2686dfd9f56a9fc3$ // $hash=3b4a2266f93b3c3623b0f29831a7a7d57c52a628$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_CTOCPP_H_
@ -87,6 +87,8 @@ class CefMenuButtonCToCpp : public CefCToCppRefCounted<CefMenuButtonCToCpp,
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=9ecd07954f90dc14ddf36072285c942f2ee8082f$ // $hash=db120a17dcd7382617f6a6245a8c719c6159d615$
// //
#include "libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h"
@ -263,6 +263,27 @@ void CefMenuButtonDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefMenuButtonDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct =
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefMenuButtonDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefMenuButtonDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=7836ec7b53349057b1d1d75c6ba8506620bed53d$ // $hash=34037ec75b18dacfafd978da854131cfa0560d7d$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_DELEGATE_CTOCPP_H_
@ -58,6 +58,8 @@ class CefMenuButtonDelegateCToCpp
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -0,0 +1,346 @@
// Copyright (c) 2021 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=275cb37282252c06bd4fe5ad21291924d37937c0$
//
#include "libcef_dll/ctocpp/views/overlay_controller_ctocpp.h"
#include "libcef_dll/ctocpp/views/view_ctocpp.h"
#include "libcef_dll/ctocpp/views/window_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall") bool CefOverlayControllerCToCpp::IsValid() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_valid))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_valid(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefOverlayControllerCToCpp::IsSame(CefRefPtr<CefOverlayController> that) {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_same))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: that; type: refptr_same
DCHECK(that.get());
if (!that.get())
return false;
// Execute
int _retval =
_struct->is_same(_struct, CefOverlayControllerCToCpp::Unwrap(that));
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefView> CefOverlayControllerCToCpp::GetContentsView() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_contents_view))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_view_t* _retval = _struct->get_contents_view(_struct);
// Return type: refptr_same
return CefViewCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefWindow> CefOverlayControllerCToCpp::GetWindow() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_window))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_window_t* _retval = _struct->get_window(_struct);
// Return type: refptr_same
return CefWindowCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
cef_docking_mode_t CefOverlayControllerCToCpp::GetDockingMode() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_docking_mode))
return CEF_DOCKING_MODE_TOP_LEFT;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_docking_mode_t _retval = _struct->get_docking_mode(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") void CefOverlayControllerCToCpp::Destroy() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, destroy))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->destroy(_struct);
}
NO_SANITIZE("cfi-icall")
void CefOverlayControllerCToCpp::SetBounds(const CefRect& bounds) {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_bounds))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_bounds(_struct, &bounds);
}
NO_SANITIZE("cfi-icall") CefRect CefOverlayControllerCToCpp::GetBounds() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_bounds))
return CefRect();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_rect_t _retval = _struct->get_bounds(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
CefRect CefOverlayControllerCToCpp::GetBoundsInScreen() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_bounds_in_screen))
return CefRect();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_rect_t _retval = _struct->get_bounds_in_screen(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
void CefOverlayControllerCToCpp::SetSize(const CefSize& size) {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_size))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_size(_struct, &size);
}
NO_SANITIZE("cfi-icall") CefSize CefOverlayControllerCToCpp::GetSize() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_size))
return CefSize();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_size_t _retval = _struct->get_size(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
void CefOverlayControllerCToCpp::SetPosition(const CefPoint& position) {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_position))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_position(_struct, &position);
}
NO_SANITIZE("cfi-icall") CefPoint CefOverlayControllerCToCpp::GetPosition() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_position))
return CefPoint();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_point_t _retval = _struct->get_position(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
void CefOverlayControllerCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefOverlayControllerCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
void CefOverlayControllerCToCpp::SizeToPreferredSize() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, size_to_preferred_size))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->size_to_preferred_size(_struct);
}
NO_SANITIZE("cfi-icall")
void CefOverlayControllerCToCpp::SetVisible(bool visible) {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_visible))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_visible(_struct, visible);
}
NO_SANITIZE("cfi-icall") bool CefOverlayControllerCToCpp::IsVisible() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_visible))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_visible(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") bool CefOverlayControllerCToCpp::IsDrawn() {
shutdown_checker::AssertNotShutdown();
cef_overlay_controller_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_drawn))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_drawn(_struct);
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefOverlayControllerCToCpp::CefOverlayControllerCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefOverlayControllerCToCpp::~CefOverlayControllerCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_overlay_controller_t* CefCToCppRefCounted<
CefOverlayControllerCToCpp,
CefOverlayController,
cef_overlay_controller_t>::UnwrapDerived(CefWrapperType type,
CefOverlayController* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefOverlayControllerCToCpp,
CefOverlayController,
cef_overlay_controller_t>::kWrapperType =
WT_OVERLAY_CONTROLLER;

View File

@ -0,0 +1,63 @@
// Copyright (c) 2021 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=3f0e14b544f91e4adfd0a3777242bc070025b927$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_OVERLAY_CONTROLLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_VIEWS_OVERLAY_CONTROLLER_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/views/cef_overlay_controller_capi.h"
#include "include/capi/views/cef_view_capi.h"
#include "include/capi/views/cef_window_capi.h"
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_view.h"
#include "include/views/cef_window.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefOverlayControllerCToCpp
: public CefCToCppRefCounted<CefOverlayControllerCToCpp,
CefOverlayController,
cef_overlay_controller_t> {
public:
CefOverlayControllerCToCpp();
virtual ~CefOverlayControllerCToCpp();
// CefOverlayController methods.
bool IsValid() override;
bool IsSame(CefRefPtr<CefOverlayController> that) override;
CefRefPtr<CefView> GetContentsView() override;
CefRefPtr<CefWindow> GetWindow() override;
cef_docking_mode_t GetDockingMode() override;
void Destroy() override;
void SetBounds(const CefRect& bounds) override;
CefRect GetBounds() override;
CefRect GetBoundsInScreen() override;
void SetSize(const CefSize& size) override;
CefSize GetSize() override;
void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
void SizeToPreferredSize() override;
void SetVisible(bool visible) override;
bool IsVisible() override;
bool IsDrawn() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_OVERLAY_CONTROLLER_CTOCPP_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=3e77ca44ea8a99a3fc8c335cca58b4cbc790e9cb$ // $hash=48fcc126726458e5391885e4513d74d56b0c5fdb$
// //
#include "libcef_dll/ctocpp/views/panel_ctocpp.h" #include "libcef_dll/ctocpp/views/panel_ctocpp.h"
@ -658,6 +658,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefPanelCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefPanelCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefPanelCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefPanelCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefPanelCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=c2d630805de3dbcb47933c566b791c0e2fb7e6d7$ // $hash=a6e6ceefb7e403c46c00c59dd86104787ab77f7a$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_CTOCPP_H_
@ -81,6 +81,8 @@ class CefPanelCToCpp
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=4bffffc0fe09523839a08109aef1e3de90f6e25c$ // $hash=2606f866b3a2d6a4d582a5c2c1990d8f8a7ff65d$
// //
#include "libcef_dll/ctocpp/views/panel_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/panel_delegate_ctocpp.h"
@ -191,6 +191,27 @@ void CefPanelDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefPanelDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct =
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefPanelDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefPanelDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=d508126f22cba29931a4d53aecbdaaca7dd39b9d$ // $hash=c5368e0456a726a09fd5a76ec65cd3e9f6a04d0f$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_DELEGATE_CTOCPP_H_
@ -48,6 +48,8 @@ class CefPanelDelegateCToCpp
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=8c2b3c821c18076ce40392ea339c177c66d53cc2$ // $hash=73f1e51eafb9ec8797e8f0753b33c2261c3b0e2f$
// //
#include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h" #include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h"
@ -565,6 +565,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefScrollViewCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefScrollViewCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefScrollViewCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefScrollViewCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefScrollViewCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=20f4f752402507b4573596d6759c93cd1bc7a982$ // $hash=cc3bfb5c57f0b7b31997bfb5226dd3dd77f6d40c$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_SCROLL_VIEW_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_SCROLL_VIEW_CTOCPP_H_
@ -68,6 +68,8 @@ class CefScrollViewCToCpp : public CefCToCppRefCounted<CefScrollViewCToCpp,
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=132a40648e492f00f21d6762ff63d4491e8060c3$ // $hash=0b38c9a006a344082c20030912d9d6fc4923912e$
// //
#include "libcef_dll/ctocpp/views/textfield_ctocpp.h" #include "libcef_dll/ctocpp/views/textfield_ctocpp.h"
@ -945,6 +945,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefTextfieldCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefTextfieldCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefTextfieldCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefTextfieldCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefTextfieldCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=e907d476bdd6717660c7e35f55ab9a1679f0f1fb$ // $hash=b5dc694168601801e87d3b92544f3eb9ea3cecc9$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_CTOCPP_H_
@ -94,6 +94,8 @@ class CefTextfieldCToCpp : public CefCToCppRefCounted<CefTextfieldCToCpp,
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=8582eda62f90bab166d04bb6a2f8783a98fabe15$ // $hash=b449c16a213a71b031e78963f32e0e1fd775c32f$
// //
#include "libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h"
@ -236,6 +236,27 @@ void CefTextfieldDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefTextfieldDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct =
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefTextfieldDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefTextfieldDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=3a83b906a29ba302874b73804e457680d2b7251e$ // $hash=7c27f6f641fa940331d727bacfa1ac527a98e441$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_DELEGATE_CTOCPP_H_
@ -53,6 +53,8 @@ class CefTextfieldDelegateCToCpp
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=d791f23eeaa056cdc478743acd452c1d60a4fd00$ // $hash=de07e058ed3b4435bc0f57cbdfc2160fae143112$
// //
#include "libcef_dll/ctocpp/views/view_ctocpp.h" #include "libcef_dll/ctocpp/views/view_ctocpp.h"
@ -426,6 +426,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefViewCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefViewCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefViewCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefViewCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefViewCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=a821d193174f4b6e06db1a003aece65eb1e0db02$ // $hash=a6a2a188d28fd07a4026ace975f42eef7853ba3c$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_CTOCPP_H_
@ -70,6 +70,8 @@ class CefViewCToCpp
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=7a6d2ca91509c2e6c510d5c9585a74c2fe10499b$ // $hash=ddd89002a51c428cb66fb95990b935f214ab0090$
// //
#include "libcef_dll/ctocpp/views/view_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/view_delegate_ctocpp.h"
@ -189,6 +189,26 @@ void CefViewDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefViewDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefViewDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefViewDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=f049a053042a00be15899439f324a376ee309dbb$ // $hash=a1888753d972c3f041c0ba24394ea032814a0d64$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_DELEGATE_CTOCPP_H_
@ -47,6 +47,8 @@ class CefViewDelegateCToCpp : public CefCToCppRefCounted<CefViewDelegateCToCpp,
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=6480777364c6c194652bf69ef2bb087c0805eddf$ // $hash=e4088be2354bf7a1151044c472b2a98e8130acb7$
// //
#include "libcef_dll/ctocpp/views/window_ctocpp.h" #include "libcef_dll/ctocpp/views/window_ctocpp.h"
@ -23,6 +23,7 @@
#include "libcef_dll/ctocpp/views/display_ctocpp.h" #include "libcef_dll/ctocpp/views/display_ctocpp.h"
#include "libcef_dll/ctocpp/views/fill_layout_ctocpp.h" #include "libcef_dll/ctocpp/views/fill_layout_ctocpp.h"
#include "libcef_dll/ctocpp/views/layout_ctocpp.h" #include "libcef_dll/ctocpp/views/layout_ctocpp.h"
#include "libcef_dll/ctocpp/views/overlay_controller_ctocpp.h"
#include "libcef_dll/ctocpp/views/panel_ctocpp.h" #include "libcef_dll/ctocpp/views/panel_ctocpp.h"
#include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h" #include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h"
#include "libcef_dll/ctocpp/views/textfield_ctocpp.h" #include "libcef_dll/ctocpp/views/textfield_ctocpp.h"
@ -408,6 +409,31 @@ CefRefPtr<CefImage> CefWindowCToCpp::GetWindowAppIcon() {
return CefImageCToCpp::Wrap(_retval); return CefImageCToCpp::Wrap(_retval);
} }
NO_SANITIZE("cfi-icall")
CefRefPtr<CefOverlayController> CefWindowCToCpp::AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode) {
shutdown_checker::AssertNotShutdown();
cef_window_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, add_overlay_view))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_same
DCHECK(view.get());
if (!view.get())
return nullptr;
// Execute
cef_overlay_controller_t* _retval = _struct->add_overlay_view(
_struct, CefViewCToCpp::Unwrap(view), docking_mode);
// Return type: refptr_same
return CefOverlayControllerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefWindowCToCpp::ShowMenu(CefRefPtr<CefMenuModel> menu_model, void CefWindowCToCpp::ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point, const CefPoint& screen_point,
@ -1229,6 +1255,36 @@ NO_SANITIZE("cfi-icall") CefPoint CefWindowCToCpp::GetPosition() {
return _retval; return _retval;
} }
NO_SANITIZE("cfi-icall")
void CefWindowCToCpp::SetInsets(const CefInsets& insets) {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_insets))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_insets(_struct, &insets);
}
NO_SANITIZE("cfi-icall") CefInsets CefWindowCToCpp::GetInsets() {
shutdown_checker::AssertNotShutdown();
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_insets))
return CefInsets();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_insets_t _retval = _struct->get_insets(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefSize CefWindowCToCpp::GetPreferredSize() { NO_SANITIZE("cfi-icall") CefSize CefWindowCToCpp::GetPreferredSize() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=f2fbf4be1755ed8793c2d471d65eddbdf4ba148b$ // $hash=9f4b4ed83102b989f2f436e56d311b4dcb8abe54$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_CTOCPP_H_
@ -58,6 +58,9 @@ class CefWindowCToCpp
CefRefPtr<CefImage> GetWindowIcon() override; CefRefPtr<CefImage> GetWindowIcon() override;
void SetWindowAppIcon(CefRefPtr<CefImage> image) override; void SetWindowAppIcon(CefRefPtr<CefImage> image) override;
CefRefPtr<CefImage> GetWindowAppIcon() override; CefRefPtr<CefImage> GetWindowAppIcon() override;
CefRefPtr<CefOverlayController> AddOverlayView(
CefRefPtr<CefView> view,
cef_docking_mode_t docking_mode) override;
void ShowMenu(CefRefPtr<CefMenuModel> menu_model, void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point, const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position) override; cef_menu_anchor_position_t anchor_position) override;
@ -121,6 +124,8 @@ class CefWindowCToCpp
CefSize GetSize() override; CefSize GetSize() override;
void SetPosition(const CefPoint& position) override; void SetPosition(const CefPoint& position) override;
CefPoint GetPosition() override; CefPoint GetPosition() override;
void SetInsets(const CefInsets& insets) override;
CefInsets GetInsets() override;
CefSize GetPreferredSize() override; CefSize GetPreferredSize() override;
void SizeToPreferredSize() override; void SizeToPreferredSize() override;
CefSize GetMinimumSize() override; CefSize GetMinimumSize() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=dda345b957ac58c71770da1cf4813ce16ea568b8$ // $hash=1035cc694edfd110c5a64b042a6e7ca2e975003a$
// //
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h" #include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
@ -457,6 +457,27 @@ void CefWindowDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
_struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added); _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
} }
NO_SANITIZE("cfi-icall")
void CefWindowDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) {
shutdown_checker::AssertNotShutdown();
cef_view_delegate_t* _struct =
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: view; type: refptr_diff
DCHECK(view.get());
if (!view.get())
return;
// Execute
_struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
void CefWindowDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) { void CefWindowDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=4e5e470d6aa929b3b2d4286eb4bcdc90dba052dc$ // $hash=8a77494e63a8e06241f675c020532ac20fbaaab0$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
@ -66,6 +66,8 @@ class CefWindowDelegateCToCpp
bool added, bool added,
CefRefPtr<CefView> child) override; CefRefPtr<CefView> child) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
}; };

View File

@ -9,12 +9,13 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=232cd54c28334b9a3d98ebfb5a291643f0a7db62$ // $hash=e55370b133d3c3b7e7c903557cae0cd04173ebd1$
// //
#include "include/capi/cef_app_capi.h" #include "include/capi/cef_app_capi.h"
#include "include/capi/cef_crash_util_capi.h" #include "include/capi/cef_crash_util_capi.h"
#include "include/capi/cef_file_util_capi.h" #include "include/capi/cef_file_util_capi.h"
#include "include/capi/cef_i18n_util_capi.h"
#include "include/capi/cef_origin_whitelist_capi.h" #include "include/capi/cef_origin_whitelist_capi.h"
#include "include/capi/cef_parser_capi.h" #include "include/capi/cef_parser_capi.h"
#include "include/capi/cef_path_util_capi.h" #include "include/capi/cef_path_util_capi.h"
@ -29,6 +30,7 @@
#include "include/cef_app.h" #include "include/cef_app.h"
#include "include/cef_crash_util.h" #include "include/cef_crash_util.h"
#include "include/cef_file_util.h" #include "include/cef_file_util.h"
#include "include/cef_i18n_util.h"
#include "include/cef_origin_whitelist.h" #include "include/cef_origin_whitelist.h"
#include "include/cef_parser.h" #include "include/cef_parser.h"
#include "include/cef_path_util.h" #include "include/cef_path_util.h"
@ -329,6 +331,16 @@ CEF_EXPORT void cef_load_crlsets_file(const cef_string_t* path) {
CefLoadCRLSetsFile(CefString(path)); CefLoadCRLSetsFile(CefString(path));
} }
CEF_EXPORT int cef_is_rtl() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
bool _retval = CefIsRTL();
// Return type: bool
return _retval;
}
CEF_EXPORT int cef_add_cross_origin_whitelist_entry( CEF_EXPORT int cef_add_cross_origin_whitelist_entry(
const cef_string_t* source_origin, const cef_string_t* source_origin,
const cef_string_t* target_protocol, const cef_string_t* target_protocol,

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=01fb8dd98e44b937595c1e1f987f5e4850bff64d$ // $hash=e3347463db785cc5e6c0aa840dedcef116a11043$
// //
#include <dlfcn.h> #include <dlfcn.h>
@ -23,6 +23,7 @@
#include "include/capi/cef_crash_util_capi.h" #include "include/capi/cef_crash_util_capi.h"
#include "include/capi/cef_drag_data_capi.h" #include "include/capi/cef_drag_data_capi.h"
#include "include/capi/cef_file_util_capi.h" #include "include/capi/cef_file_util_capi.h"
#include "include/capi/cef_i18n_util_capi.h"
#include "include/capi/cef_image_capi.h" #include "include/capi/cef_image_capi.h"
#include "include/capi/cef_media_router_capi.h" #include "include/capi/cef_media_router_capi.h"
#include "include/capi/cef_menu_model_capi.h" #include "include/capi/cef_menu_model_capi.h"
@ -115,6 +116,7 @@ typedef int (*cef_zip_directory_ptr)(const cef_string_t*,
const cef_string_t*, const cef_string_t*,
int); int);
typedef void (*cef_load_crlsets_file_ptr)(const cef_string_t*); typedef void (*cef_load_crlsets_file_ptr)(const cef_string_t*);
typedef int (*cef_is_rtl_ptr)();
typedef int (*cef_add_cross_origin_whitelist_entry_ptr)(const cef_string_t*, typedef int (*cef_add_cross_origin_whitelist_entry_ptr)(const cef_string_t*,
const cef_string_t*, const cef_string_t*,
const cef_string_t*, const cef_string_t*,
@ -533,6 +535,7 @@ struct libcef_pointers {
cef_delete_file_ptr cef_delete_file; cef_delete_file_ptr cef_delete_file;
cef_zip_directory_ptr cef_zip_directory; cef_zip_directory_ptr cef_zip_directory;
cef_load_crlsets_file_ptr cef_load_crlsets_file; cef_load_crlsets_file_ptr cef_load_crlsets_file;
cef_is_rtl_ptr cef_is_rtl;
cef_add_cross_origin_whitelist_entry_ptr cef_add_cross_origin_whitelist_entry; cef_add_cross_origin_whitelist_entry_ptr cef_add_cross_origin_whitelist_entry;
cef_remove_cross_origin_whitelist_entry_ptr cef_remove_cross_origin_whitelist_entry_ptr
cef_remove_cross_origin_whitelist_entry; cef_remove_cross_origin_whitelist_entry;
@ -750,6 +753,7 @@ int libcef_init_pointers(const char* path) {
INIT_ENTRY(cef_delete_file); INIT_ENTRY(cef_delete_file);
INIT_ENTRY(cef_zip_directory); INIT_ENTRY(cef_zip_directory);
INIT_ENTRY(cef_load_crlsets_file); INIT_ENTRY(cef_load_crlsets_file);
INIT_ENTRY(cef_is_rtl);
INIT_ENTRY(cef_add_cross_origin_whitelist_entry); INIT_ENTRY(cef_add_cross_origin_whitelist_entry);
INIT_ENTRY(cef_remove_cross_origin_whitelist_entry); INIT_ENTRY(cef_remove_cross_origin_whitelist_entry);
INIT_ENTRY(cef_clear_cross_origin_whitelist); INIT_ENTRY(cef_clear_cross_origin_whitelist);
@ -1057,6 +1061,10 @@ NO_SANITIZE("cfi-icall") void cef_load_crlsets_file(const cef_string_t* path) {
g_libcef_pointers.cef_load_crlsets_file(path); g_libcef_pointers.cef_load_crlsets_file(path);
} }
NO_SANITIZE("cfi-icall") int cef_is_rtl() {
return g_libcef_pointers.cef_is_rtl();
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
int cef_add_cross_origin_whitelist_entry(const cef_string_t* source_origin, int cef_add_cross_origin_whitelist_entry(const cef_string_t* source_origin,
const cef_string_t* target_protocol, const cef_string_t* target_protocol,

View File

@ -9,12 +9,13 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=7fef7aaa85b96ed7c7fc82542cd393210e1d89ee$ // $hash=e71ff10558002c5a09d9348d2b128facd881b869$
// //
#include "include/capi/cef_app_capi.h" #include "include/capi/cef_app_capi.h"
#include "include/capi/cef_crash_util_capi.h" #include "include/capi/cef_crash_util_capi.h"
#include "include/capi/cef_file_util_capi.h" #include "include/capi/cef_file_util_capi.h"
#include "include/capi/cef_i18n_util_capi.h"
#include "include/capi/cef_origin_whitelist_capi.h" #include "include/capi/cef_origin_whitelist_capi.h"
#include "include/capi/cef_parser_capi.h" #include "include/capi/cef_parser_capi.h"
#include "include/capi/cef_path_util_capi.h" #include "include/capi/cef_path_util_capi.h"
@ -30,6 +31,7 @@
#include "include/cef_app.h" #include "include/cef_app.h"
#include "include/cef_crash_util.h" #include "include/cef_crash_util.h"
#include "include/cef_file_util.h" #include "include/cef_file_util.h"
#include "include/cef_i18n_util.h"
#include "include/cef_origin_whitelist.h" #include "include/cef_origin_whitelist.h"
#include "include/cef_parser.h" #include "include/cef_parser.h"
#include "include/cef_path_util.h" #include "include/cef_path_util.h"
@ -309,6 +311,16 @@ CEF_GLOBAL void CefLoadCRLSetsFile(const CefString& path) {
cef_load_crlsets_file(path.GetStruct()); cef_load_crlsets_file(path.GetStruct());
} }
NO_SANITIZE("cfi-icall") CEF_GLOBAL bool CefIsRTL() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = cef_is_rtl();
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") NO_SANITIZE("cfi-icall")
CEF_GLOBAL CEF_GLOBAL
bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=abd4c6d471c9ff3d7113b6125a6cfb2a26d58304$ // $hash=e09286ac977f5f06cf356eb8a5e04b48b0836523$
// //
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_ #ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
@ -90,6 +90,7 @@ enum CefWrapperType {
WT_MENU_MODEL_DELEGATE, WT_MENU_MODEL_DELEGATE,
WT_NAVIGATION_ENTRY, WT_NAVIGATION_ENTRY,
WT_NAVIGATION_ENTRY_VISITOR, WT_NAVIGATION_ENTRY_VISITOR,
WT_OVERLAY_CONTROLLER,
WT_PANEL, WT_PANEL,
WT_PANEL_DELEGATE, WT_PANEL_DELEGATE,
WT_PDF_PRINT_CALLBACK, WT_PDF_PRINT_CALLBACK,

View File

@ -1,5 +1,5 @@
diff --git chrome/browser/ui/browser_command_controller.cc chrome/browser/ui/browser_command_controller.cc diff --git chrome/browser/ui/browser_command_controller.cc chrome/browser/ui/browser_command_controller.cc
index 9188154824c4d..d01f610a64135 100644 index 9188154824c4..d01f610a6413 100644
--- chrome/browser/ui/browser_command_controller.cc --- chrome/browser/ui/browser_command_controller.cc
+++ chrome/browser/ui/browser_command_controller.cc +++ chrome/browser/ui/browser_command_controller.cc
@@ -351,8 +351,10 @@ bool BrowserCommandController::ExecuteCommandWithDisposition( @@ -351,8 +351,10 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
@ -31,7 +31,7 @@ index 9188154824c4d..d01f610a64135 100644
void BrowserCommandController::InitCommandState() { void BrowserCommandController::InitCommandState() {
diff --git chrome/browser/ui/views/frame/browser_frame.cc chrome/browser/ui/views/frame/browser_frame.cc diff --git chrome/browser/ui/views/frame/browser_frame.cc chrome/browser/ui/views/frame/browser_frame.cc
index 2c4624fb0cd05..57c087dcbaaee 100644 index 2c4624fb0cd0..57c087dcbaae 100644
--- chrome/browser/ui/views/frame/browser_frame.cc --- chrome/browser/ui/views/frame/browser_frame.cc
+++ chrome/browser/ui/views/frame/browser_frame.cc +++ chrome/browser/ui/views/frame/browser_frame.cc
@@ -69,15 +69,23 @@ bool IsUsingGtkTheme(Profile* profile) { @@ -69,15 +69,23 @@ bool IsUsingGtkTheme(Profile* profile) {
@ -106,7 +106,7 @@ index 2c4624fb0cd05..57c087dcbaaee 100644
// or not we always use the dark ui instance. // or not we always use the dark ui instance.
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
diff --git chrome/browser/ui/views/frame/browser_frame.h chrome/browser/ui/views/frame/browser_frame.h diff --git chrome/browser/ui/views/frame/browser_frame.h chrome/browser/ui/views/frame/browser_frame.h
index 0ce7abdeb7d9f..8197a6bb7da98 100644 index 0ce7abdeb7d9..8197a6bb7da9 100644
--- chrome/browser/ui/views/frame/browser_frame.h --- chrome/browser/ui/views/frame/browser_frame.h
+++ chrome/browser/ui/views/frame/browser_frame.h +++ chrome/browser/ui/views/frame/browser_frame.h
@@ -54,7 +54,9 @@ enum class TabDragKind { @@ -54,7 +54,9 @@ enum class TabDragKind {
@ -120,10 +120,25 @@ index 0ce7abdeb7d9f..8197a6bb7da98 100644
// Initialize the frame (creates the underlying native window). // Initialize the frame (creates the underlying native window).
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
index f0b0bd645a3ce..0d8475b411512 100644 index f0b0bd645a3c..ae1449aa9986 100644
--- chrome/browser/ui/views/frame/browser_view.cc --- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc +++ chrome/browser/ui/views/frame/browser_view.cc
@@ -593,11 +593,22 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver { @@ -274,11 +274,10 @@ using content::WebContents;
using views::ColumnSet;
using web_modal::WebContentsModalDialogHost;
-namespace {
+// static
+const char BrowserView::kBrowserViewKey[] = "__BROWSER_VIEW__";
-// The name of a key to store on the window handle so that other code can
-// locate this object using just the handle.
-const char* const kBrowserViewKey = "__BROWSER_VIEW__";
+namespace {
#if BUILDFLAG(IS_CHROMEOS_ASH)
// UMA histograms that record animation smoothness for tab loading animation.
@@ -593,11 +592,22 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// BrowserView, public: // BrowserView, public:
@ -147,7 +162,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
SetShowIcon(::ShouldShowWindowIcon(browser_.get())); SetShowIcon(::ShouldShowWindowIcon(browser_.get()));
// In forced app mode, all size controls are always disabled. Otherwise, use // In forced app mode, all size controls are always disabled. Otherwise, use
@@ -611,7 +622,6 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser) @@ -611,7 +621,6 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
} }
browser_->tab_strip_model()->AddObserver(this); browser_->tab_strip_model()->AddObserver(this);
@ -155,7 +170,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
// Top container holds tab strip region and toolbar and lives at the front of // Top container holds tab strip region and toolbar and lives at the front of
// the view hierarchy. // the view hierarchy.
@@ -655,8 +665,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser) @@ -655,8 +664,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
contents_container->SetLayoutManager(std::make_unique<ContentsLayoutManager>( contents_container->SetLayoutManager(std::make_unique<ContentsLayoutManager>(
devtools_web_view_, contents_web_view_)); devtools_web_view_, contents_web_view_));
@ -173,7 +188,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
contents_separator_ = contents_separator_ =
top_container_->AddChildView(std::make_unique<ContentsSeparator>()); top_container_->AddChildView(std::make_unique<ContentsSeparator>());
@@ -1440,6 +1457,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const { @@ -1440,6 +1456,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
if (immersive_mode_controller_->IsEnabled()) if (immersive_mode_controller_->IsEnabled())
return false; return false;
@ -182,7 +197,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen(); return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
} }
@@ -2482,7 +2501,8 @@ BrowserView::GetNativeViewHostsForTopControlsSlide() const { @@ -2482,7 +2500,8 @@ BrowserView::GetNativeViewHostsForTopControlsSlide() const {
} }
void BrowserView::ReparentTopContainerForEndOfImmersive() { void BrowserView::ReparentTopContainerForEndOfImmersive() {
@ -192,7 +207,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
top_container()->DestroyLayer(); top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0); AddChildViewAt(top_container(), 0);
EnsureFocusOrder(); EnsureFocusOrder();
@@ -2934,8 +2954,10 @@ void BrowserView::Layout() { @@ -2934,8 +2953,10 @@ void BrowserView::Layout() {
// TODO(jamescook): Why was this in the middle of layout code? // TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior( toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@ -205,7 +220,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
// Some of the situations when the BrowserView is laid out are: // Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode. // - Enter/exit immersive fullscreen mode.
@@ -2998,6 +3020,11 @@ void BrowserView::AddedToWidget() { @@ -2998,6 +3019,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile()); SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif #endif
@ -217,7 +232,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
toolbar_->Init(); toolbar_->Init();
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -3033,13 +3060,9 @@ void BrowserView::AddedToWidget() { @@ -3033,13 +3059,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder(); EnsureFocusOrder();
@ -234,10 +249,10 @@ index f0b0bd645a3ce..0d8475b411512 100644
MaybeInitializeWebUITabStrip(); MaybeInitializeWebUITabStrip();
diff --git chrome/browser/ui/views/frame/browser_view.h chrome/browser/ui/views/frame/browser_view.h diff --git chrome/browser/ui/views/frame/browser_view.h chrome/browser/ui/views/frame/browser_view.h
index 021f04720e567..8c4f2cbf34f25 100644 index 021f04720e56..98097fd4f11f 100644
--- chrome/browser/ui/views/frame/browser_view.h --- chrome/browser/ui/views/frame/browser_view.h
+++ chrome/browser/ui/views/frame/browser_view.h +++ chrome/browser/ui/views/frame/browser_view.h
@@ -114,7 +114,9 @@ class BrowserView : public BrowserWindow, @@ -114,11 +114,16 @@ class BrowserView : public BrowserWindow,
public webapps::AppBannerManager::Observer { public webapps::AppBannerManager::Observer {
public: public:
METADATA_HEADER(BrowserView); METADATA_HEADER(BrowserView);
@ -247,7 +262,14 @@ index 021f04720e567..8c4f2cbf34f25 100644
BrowserView(const BrowserView&) = delete; BrowserView(const BrowserView&) = delete;
BrowserView& operator=(const BrowserView&) = delete; BrowserView& operator=(const BrowserView&) = delete;
~BrowserView() override; ~BrowserView() override;
@@ -668,6 +670,12 @@ class BrowserView : public BrowserWindow,
+ // Key used to bind BrowserView to the Widget with which it is associated.
+ static const char kBrowserViewKey[];
+
void set_frame(BrowserFrame* frame) { frame_ = frame; }
BrowserFrame* frame() const { return frame_; }
@@ -668,6 +673,12 @@ class BrowserView : public BrowserWindow,
return accessibility_focus_highlight_.get(); return accessibility_focus_highlight_.get();
} }
@ -261,15 +283,25 @@ index 021f04720e567..8c4f2cbf34f25 100644
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
// interface to keep these two classes decoupled and testable. // interface to keep these two classes decoupled and testable.
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
index 18a85f436bd97..0d6e4c9f916e7 100644 index 18a85f436bd9..cf880936a8ed 100644
--- chrome/browser/ui/views/frame/browser_view_layout.cc --- chrome/browser/ui/views/frame/browser_view_layout.cc
+++ chrome/browser/ui/views/frame/browser_view_layout.cc +++ chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -441,6 +441,12 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) { @@ -39,6 +39,10 @@
#include "ui/views/widget/widget.h"
#include "ui/views/window/client_view.h"
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/browser/chrome/views/chrome_views_util.h"
+#endif
+
using views::View;
using web_modal::WebContentsModalDialogHost;
using web_modal::ModalDialogHostObserver;
@@ -441,6 +445,11 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
int BrowserViewLayout::LayoutToolbar(int top) { int BrowserViewLayout::LayoutToolbar(int top) {
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar"); TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
+ if (toolbar_->parent() && toolbar_->parent()->GetLayoutManager() != this && + if (cef::IsCefView(toolbar_)) {
+ toolbar_->parent()->GetLayoutManager() != nullptr) {
+ // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK + // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK
+ // in LayoutManager::SetViewVisibility(). + // in LayoutManager::SetViewVisibility().
+ return top; + return top;
@ -278,7 +310,7 @@ index 18a85f436bd97..0d6e4c9f916e7 100644
bool toolbar_visible = delegate_->IsToolbarVisible(); bool toolbar_visible = delegate_->IsToolbarVisible();
int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0; int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 5e516ea5873ca..b9890fbe050af 100644 index 5e516ea5873c..b9890fbe050a 100644
--- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -587,37 +587,53 @@ gfx::Range BrowserTabStripController::ListTabsInGroup( @@ -587,37 +587,53 @@ gfx::Range BrowserTabStripController::ListTabsInGroup(
@ -336,7 +368,7 @@ index 5e516ea5873ca..b9890fbe050af 100644
} }
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
index 7bc5cd3dabf7d..ea706584db609 100644 index 7bc5cd3dabf7..ea706584db60 100644
--- chrome/browser/ui/views/toolbar/toolbar_view.cc --- chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc +++ chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -162,12 +162,13 @@ auto& GetViewCommandMap() { @@ -162,12 +162,13 @@ auto& GetViewCommandMap() {
@ -365,7 +397,7 @@ index 7bc5cd3dabf7d..ea706584db609 100644
size_animation_.Reset(1); size_animation_.Reset(1);
diff --git chrome/browser/ui/views/toolbar/toolbar_view.h chrome/browser/ui/views/toolbar/toolbar_view.h diff --git chrome/browser/ui/views/toolbar/toolbar_view.h chrome/browser/ui/views/toolbar/toolbar_view.h
index 8346b612cfbe6..d7fc5440af829 100644 index 8346b612cfbe..d7fc5440af82 100644
--- chrome/browser/ui/views/toolbar/toolbar_view.h --- chrome/browser/ui/views/toolbar/toolbar_view.h
+++ chrome/browser/ui/views/toolbar/toolbar_view.h +++ chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -90,7 +90,8 @@ class ToolbarView : public views::AccessiblePaneView, @@ -90,7 +90,8 @@ class ToolbarView : public views::AccessiblePaneView,

View File

@ -341,7 +341,7 @@ void RootWindowViews::OnSetAddress(const std::string& url) {
return; return;
} }
if (window_ && config_->with_controls) if (window_)
window_->SetAddress(url); window_->SetAddress(url);
} }
@ -420,7 +420,6 @@ void RootWindowViews::OnSetLoadingState(bool isLoading,
} }
if (window_) { if (window_) {
if (config_->with_controls)
window_->SetLoadingState(isLoading, canGoBack, canGoForward); window_->SetLoadingState(isLoading, canGoBack, canGoForward);
if (isLoading) { if (isLoading) {

View File

@ -4,6 +4,7 @@
#include "tests/cefclient/browser/views_menu_bar.h" #include "tests/cefclient/browser/views_menu_bar.h"
#include "include/cef_i18n_util.h"
#include "include/views/cef_box_layout.h" #include "include/views/cef_box_layout.h"
#include "include/views/cef_window.h" #include "include/views/cef_window.h"
#include "tests/cefclient/browser/views_style.h" #include "tests/cefclient/browser/views_style.h"
@ -153,9 +154,13 @@ void ViewsMenuBar::OnMenuButtonPressed(
CefRefPtr<CefMenuButtonPressedLock> button_pressed_lock) { CefRefPtr<CefMenuButtonPressedLock> button_pressed_lock) {
CefRefPtr<CefMenuModel> menu_model = GetMenuModel(menu_button->GetID()); CefRefPtr<CefMenuModel> menu_model = GetMenuModel(menu_button->GetID());
// Adjust menu position left by button width. // Adjust menu position to align with the button.
CefPoint point = screen_point; CefPoint point = screen_point;
if (CefIsRTL()) {
point.x += menu_button->GetBounds().width - 4;
} else {
point.x -= menu_button->GetBounds().width - 4; point.x -= menu_button->GetBounds().width - 4;
}
// Keep track of the current |last_nav_with_keyboard_| status and restore it // Keep track of the current |last_nav_with_keyboard_| status and restore it
// after displaying the new menu. // after displaying the new menu.
@ -211,6 +216,11 @@ void ViewsMenuBar::MouseOutsideMenu(CefRefPtr<CefMenuModel> menu_model,
CefRefPtr<CefView> button = panel_->GetViewForID(id); CefRefPtr<CefView> button = panel_->GetViewForID(id);
CefRect button_bounds = button->GetBounds(); CefRect button_bounds = button->GetBounds();
if (CefIsRTL()) {
// Adjust for right-to-left button layout.
button_bounds.x =
panel_bounds.width - button_bounds.x - button_bounds.width;
}
if (button_bounds.Contains(window_point)) { if (button_bounds.Contains(window_point)) {
// Trigger the hovered MenuButton. // Trigger the hovered MenuButton.
TriggerMenuButton(button); TriggerMenuButton(button);

View File

@ -0,0 +1,192 @@
// Copyright (c) 2021 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 "tests/cefclient/browser/views_overlay_controls.h"
#include <string>
#include "include/views/cef_box_layout.h"
#include "include/views/cef_window.h"
#include "tests/cefclient/browser/views_style.h"
namespace client {
namespace {
constexpr int kInsets = 4;
constexpr int kLocationBarPadding = 100;
// White with 80% opacity.
constexpr auto kBackgroundColor = CefColorSetARGB(255 * .80, 255, 255, 255);
std::string GetLabel(ViewsOverlayControls::Command command, bool maximized) {
switch (command) {
case ViewsOverlayControls::Command::kMinimize:
return "-";
case ViewsOverlayControls::Command::kMaximize:
return maximized ? "O" : "o";
case ViewsOverlayControls::Command::kClose:
return "X";
}
}
} // namespace
ViewsOverlayControls::ViewsOverlayControls() = default;
void ViewsOverlayControls::Initialize(CefRefPtr<CefWindow> window,
CefRefPtr<CefMenuButton> menu_button,
CefRefPtr<CefView> location_bar,
bool is_chrome_toolbar) {
DCHECK(!window_);
DCHECK(menu_button);
DCHECK(location_bar);
window_ = window;
window_maximized_ = window_->IsMaximized();
// Window control buttons. These controls are currently text which means that
// we can't use a transparent background because subpixel text rendering will
// break. See comments on the related DCHECK in Label::PaintText.
panel_ = CefPanel::CreatePanel(nullptr);
views_style::ApplyTo(panel_);
// Use a horizontal box layout.
CefBoxLayoutSettings panel_layout_settings;
panel_layout_settings.horizontal = true;
panel_->SetToBoxLayout(panel_layout_settings);
panel_->AddChildView(CreateButton(ViewsOverlayControls::Command::kMinimize));
panel_->AddChildView(CreateButton(ViewsOverlayControls::Command::kMaximize));
panel_->AddChildView(CreateButton(ViewsOverlayControls::Command::kClose));
panel_controller_ =
window->AddOverlayView(panel_, CEF_DOCKING_MODE_TOP_RIGHT);
panel_controller_->SetVisible(true);
// Menu button.
menu_button->SetBackgroundColor(kBackgroundColor);
menu_controller_ =
window_->AddOverlayView(menu_button, CEF_DOCKING_MODE_TOP_LEFT);
menu_controller_->SetInsets(CefInsets(kInsets, kInsets, 0, 0));
menu_controller_->SetVisible(true);
// Location bar. Will be made visible in UpdateControls().
location_bar_ = location_bar;
is_chrome_toolbar_ = is_chrome_toolbar;
// Use a 100% transparent background for the Chrome toolbar.
location_bar_->SetBackgroundColor(is_chrome_toolbar_ ? 0 : kBackgroundColor);
location_controller_ =
window_->AddOverlayView(location_bar_, CEF_DOCKING_MODE_CUSTOM);
}
void ViewsOverlayControls::Destroy() {
window_ = nullptr;
panel_ = nullptr;
panel_controller_->Destroy();
panel_controller_ = nullptr;
menu_controller_->Destroy();
menu_controller_ = nullptr;
location_bar_ = nullptr;
location_controller_->Destroy();
location_controller_ = nullptr;
}
void ViewsOverlayControls::UpdateControls() {
// Update location bar size, position and visibility.
auto bounds = window_->GetBounds();
bounds.x = kLocationBarPadding;
bounds.width -= kLocationBarPadding * 2;
bounds.y = kInsets;
if (is_chrome_toolbar_) {
// Fit the standard Chrome toolbar.
const auto preferred_size = location_bar_->GetPreferredSize();
bounds.height =
std::max(menu_controller_->GetSize().height, preferred_size.height);
} else {
bounds.height = menu_controller_->GetSize().height;
}
if (bounds.width < kLocationBarPadding * 2) {
// Not enough space.
location_controller_->SetVisible(false);
} else {
location_bar_->SetSize(CefSize(bounds.width, bounds.height));
location_controller_->SetBounds(bounds);
location_controller_->SetVisible(true);
}
MaybeUpdateMaximizeButton();
}
void ViewsOverlayControls::UpdateDraggableRegions(
std::vector<CefDraggableRegion>& window_regions) {
if (panel_controller_ && panel_controller_->IsVisible()) {
window_regions.push_back(CefDraggableRegion(panel_controller_->GetBounds(),
/*draggable=*/false));
}
if (menu_controller_ && menu_controller_->IsVisible()) {
window_regions.push_back(
CefDraggableRegion(menu_controller_->GetBounds(), /*draggable=*/false));
}
if (location_controller_ && location_controller_->IsVisible()) {
window_regions.push_back(CefDraggableRegion(
location_controller_->GetBounds(), /*draggable=*/false));
}
}
void ViewsOverlayControls::OnButtonPressed(CefRefPtr<CefButton> button) {
auto command = static_cast<Command>(button->GetID());
switch (command) {
case ViewsOverlayControls::Command::kMinimize:
window_->Minimize();
break;
case ViewsOverlayControls::Command::kMaximize:
if (window_->IsMaximized())
window_->Restore();
else
window_->Maximize();
break;
case ViewsOverlayControls::Command::kClose:
window_->Close();
return;
}
// Explicitly reset button state because the button may have moved and it
// won't receive the corresponding mouse move events.
button->SetState(CEF_BUTTON_STATE_NORMAL);
button->SetInkDropEnabled(false);
button->SetInkDropEnabled(true);
if (command == Command::kMaximize)
MaybeUpdateMaximizeButton();
}
CefRefPtr<CefLabelButton> ViewsOverlayControls::CreateButton(Command command) {
CefRefPtr<CefLabelButton> button = CefLabelButton::CreateLabelButton(
this, GetLabel(command, window_maximized_));
button->SetID(static_cast<int>(command));
views_style::ApplyTo(button);
button->SetInkDropEnabled(true);
button->SetFocusable(false); // Don't give focus to the button.
return button;
}
void ViewsOverlayControls::MaybeUpdateMaximizeButton() {
if (window_->IsMaximized() == window_maximized_)
return;
window_maximized_ = !window_maximized_;
auto max_button = panel_->GetChildViewAt(1);
auto command = static_cast<Command>(max_button->GetID());
DCHECK(command == Command::kMaximize);
max_button->AsButton()->AsLabelButton()->SetText(
GetLabel(command, window_maximized_));
// Adjust overlay size and placement due to layout changing.
panel_controller_->SizeToPreferredSize();
}
} // namespace client

View File

@ -0,0 +1,71 @@
// Copyright (c) 2021 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 CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_OVERLAY_CONTROLS_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_OVERLAY_CONTROLS_H_
#pragma once
#include "include/views/cef_button_delegate.h"
#include "include/views/cef_label_button.h"
#include "include/views/cef_menu_button.h"
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_panel.h"
namespace client {
// Implements window overlay controls that receive absolute positioning on top
// of the browser view. All methods must be called on the browser process UI
// thread.
class ViewsOverlayControls : public CefButtonDelegate {
public:
enum class Command {
kMinimize = 1,
kMaximize,
kClose,
};
ViewsOverlayControls();
void Initialize(CefRefPtr<CefWindow> window,
CefRefPtr<CefMenuButton> menu_button,
CefRefPtr<CefView> location_bar,
bool is_chrome_toolbar);
void Destroy();
// Update window control button state and location bar bounds.
void UpdateControls();
// Exclude all regions obscured by overlays.
void UpdateDraggableRegions(std::vector<CefDraggableRegion>& window_regions);
private:
// CefButtonDelegate methods:
void OnButtonPressed(CefRefPtr<CefButton> button) override;
CefRefPtr<CefLabelButton> CreateButton(Command command);
void MaybeUpdateMaximizeButton();
CefRefPtr<CefWindow> window_;
bool window_maximized_;
// Window control buttons.
CefRefPtr<CefPanel> panel_;
CefRefPtr<CefOverlayController> panel_controller_;
// Location bar.
CefRefPtr<CefView> location_bar_;
bool is_chrome_toolbar_;
CefRefPtr<CefOverlayController> location_controller_;
// Menu button.
CefRefPtr<CefOverlayController> menu_controller_;
IMPLEMENT_REFCOUNTING(ViewsOverlayControls);
DISALLOW_COPY_AND_ASSIGN(ViewsOverlayControls);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_OVERLAY_CONTROLS_H_

View File

@ -49,6 +49,13 @@ bool IsSet() {
return g_background_color != 0; return g_background_color != 0;
} }
void ApplyBackgroundTo(CefRefPtr<CefView> view) {
if (!IsSet())
return;
view->SetBackgroundColor(g_background_color);
}
void ApplyTo(CefRefPtr<CefPanel> panel) { void ApplyTo(CefRefPtr<CefPanel> panel) {
if (!IsSet()) if (!IsSet())
return; return;

View File

@ -19,6 +19,7 @@ namespace views_style {
bool IsSet(); bool IsSet();
// Apply style to views objects. // Apply style to views objects.
void ApplyBackgroundTo(CefRefPtr<CefView> view);
void ApplyTo(CefRefPtr<CefPanel> panel); void ApplyTo(CefRefPtr<CefPanel> panel);
void ApplyTo(CefRefPtr<CefLabelButton> label_button); void ApplyTo(CefRefPtr<CefLabelButton> label_button);
void ApplyTo(CefRefPtr<CefTextfield> textfield); void ApplyTo(CefRefPtr<CefTextfield> textfield);

View File

@ -9,6 +9,7 @@
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/base/cef_callback.h" #include "include/base/cef_callback.h"
#include "include/cef_app.h" #include "include/cef_app.h"
#include "include/cef_i18n_util.h"
#include "include/views/cef_box_layout.h" #include "include/views/cef_box_layout.h"
#include "include/wrapper/cef_helpers.h" #include "include/wrapper/cef_helpers.h"
#include "tests/cefclient/browser/main_context.h" #include "tests/cefclient/browser/main_context.h"
@ -190,12 +191,12 @@ void ViewsWindow::Close(bool force) {
void ViewsWindow::SetAddress(const std::string& url) { void ViewsWindow::SetAddress(const std::string& url) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (!window_ || !with_controls_) if (!window_)
return; return;
CefRefPtr<CefView> view = window_->GetViewForID(ID_URL_TEXTFIELD); // |location_bar_| may instead be a Chrome toolbar.
if (view && view->AsTextfield()) if (location_bar_ && location_bar_->AsTextfield())
view->AsTextfield()->SetText(url); location_bar_->AsTextfield()->SetText(url);
} }
void ViewsWindow::SetTitle(const std::string& title) { void ViewsWindow::SetTitle(const std::string& title) {
@ -236,15 +237,19 @@ void ViewsWindow::SetLoadingState(bool isLoading,
bool canGoBack, bool canGoBack,
bool canGoForward) { bool canGoForward) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (!window_ || !with_controls_ || chrome_toolbar_type_ == CEF_CTT_NORMAL) if (!window_ || chrome_toolbar_type_ == CEF_CTT_NORMAL)
return; return;
if (with_controls_) {
EnableView(ID_BACK_BUTTON, canGoBack); EnableView(ID_BACK_BUTTON, canGoBack);
EnableView(ID_FORWARD_BUTTON, canGoForward); EnableView(ID_FORWARD_BUTTON, canGoForward);
EnableView(ID_RELOAD_BUTTON, !isLoading); EnableView(ID_RELOAD_BUTTON, !isLoading);
EnableView(ID_STOP_BUTTON, isLoading); EnableView(ID_STOP_BUTTON, isLoading);
}
if (location_bar_) {
EnableView(ID_URL_TEXTFIELD, true); EnableView(ID_URL_TEXTFIELD, true);
} }
}
void ViewsWindow::SetDraggableRegions( void ViewsWindow::SetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) { const std::vector<CefDraggableRegion>& regions) {
@ -266,20 +271,25 @@ void ViewsWindow::SetDraggableRegions(
window_regions.push_back(region); window_regions.push_back(region);
} }
if (overlay_controls_) {
// Exclude all regions obscured by overlays.
overlay_controls_->UpdateDraggableRegions(window_regions);
}
window_->SetDraggableRegions(window_regions); window_->SetDraggableRegions(window_regions);
} }
void ViewsWindow::TakeFocus(bool next) { void ViewsWindow::TakeFocus(bool next) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (!window_ || !with_controls_) if (!window_)
return; return;
if (chrome_toolbar_type_ == CEF_CTT_NORMAL) { if (chrome_toolbar_type_ == CEF_CTT_NORMAL) {
top_toolbar_->RequestFocus(); top_toolbar_->RequestFocus();
} else { } else if (location_bar_) {
// Give focus to the URL textfield. // Give focus to the location bar.
location_->RequestFocus(); location_bar_->RequestFocus();
} }
} }
@ -427,18 +437,30 @@ void ViewsWindow::OnMenuButtonPressed(
return; return;
} }
DCHECK(with_controls_); DCHECK(with_controls_ || with_overlay_controls_);
DCHECK_EQ(ID_MENU_BUTTON, id); DCHECK_EQ(ID_MENU_BUTTON, id);
menu_button->ShowMenu(button_menu_model_, screen_point, auto point = screen_point;
CEF_MENU_ANCHOR_TOPRIGHT); if (with_overlay_controls_) {
// Align the menu correctly under the button.
const int button_width = menu_button->GetSize().width;
if (CefIsRTL()) {
point.x += button_width - 4;
} else {
point.x -= button_width - 4;
}
}
menu_button->ShowMenu(button_menu_model_, point,
with_overlay_controls_ ? CEF_MENU_ANCHOR_TOPLEFT
: CEF_MENU_ANCHOR_TOPRIGHT);
} }
void ViewsWindow::ExecuteCommand(CefRefPtr<CefMenuModel> menu_model, void ViewsWindow::ExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
int command_id, int command_id,
cef_event_flags_t event_flags) { cef_event_flags_t event_flags) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
DCHECK(with_controls_); DCHECK(with_controls_ || with_overlay_controls_);
if (command_id == ID_QUIT) { if (command_id == ID_QUIT) {
delegate_->OnExit(); delegate_->OnExit();
@ -452,7 +474,6 @@ void ViewsWindow::ExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
bool ViewsWindow::OnKeyEvent(CefRefPtr<CefTextfield> textfield, bool ViewsWindow::OnKeyEvent(CefRefPtr<CefTextfield> textfield,
const CefKeyEvent& event) { const CefKeyEvent& event) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
DCHECK(with_controls_);
DCHECK_EQ(ID_URL_TEXTFIELD, textfield->GetID()); DCHECK_EQ(ID_URL_TEXTFIELD, textfield->GetID());
// Trigger when the return key is pressed. // Trigger when the return key is pressed.
@ -460,13 +481,10 @@ bool ViewsWindow::OnKeyEvent(CefRefPtr<CefTextfield> textfield,
event.windows_key_code == VK_RETURN) { event.windows_key_code == VK_RETURN) {
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser(); CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
if (browser) { if (browser) {
CefRefPtr<CefView> view = window_->GetViewForID(ID_URL_TEXTFIELD); const CefString& url = textfield->GetText();
if (view && view->AsTextfield()) {
const CefString& url = view->AsTextfield()->GetText();
if (!url.empty()) if (!url.empty())
browser->GetMainFrame()->LoadURL(url); browser->GetMainFrame()->LoadURL(url);
} }
}
// We handled the event. // We handled the event.
return true; return true;
@ -500,9 +518,14 @@ void ViewsWindow::OnWindowCreated(CefRefPtr<CefWindow> window) {
// Set the background color for regions that are not obscured by other Views. // Set the background color for regions that are not obscured by other Views.
views_style::ApplyTo(window_.get()); views_style::ApplyTo(window_.get());
if (with_controls_ || with_overlay_controls_) {
// Create the MenuModel that will be displayed via the menu button.
CreateMenuModel();
}
if (with_controls_) { if (with_controls_) {
// Add the BrowserView and other controls to the Window. // Add the BrowserView and other controls to the Window.
AddControls(); AddBrowserView();
// Add keyboard accelerators to the Window. // Add keyboard accelerators to the Window.
AddAccelerators(); AddAccelerators();
@ -535,6 +558,7 @@ void ViewsWindow::OnWindowDestroyed(CefRefPtr<CefWindow> window) {
top_menu_bar_ = nullptr; top_menu_bar_ = nullptr;
} }
extensions_panel_ = nullptr; extensions_panel_ = nullptr;
menu_button_ = nullptr;
window_ = nullptr; window_ = nullptr;
} }
@ -681,117 +705,41 @@ void ViewsWindow::OnBlur(CefRefPtr<CefView> view) {
} }
void ViewsWindow::OnWindowChanged(CefRefPtr<CefView> view, bool added) { void ViewsWindow::OnWindowChanged(CefRefPtr<CefView> view, bool added) {
if (!with_controls_ || !added)
return;
const int view_id = view->GetID(); const int view_id = view->GetID();
if (view_id != ID_BROWSER_VIEW) if (view_id != ID_BROWSER_VIEW)
return; return;
// Build the remainder of the UI now that the BrowserView has been added to if (added) {
// the CefWindow. This is a requirement to use Chrome toolbars. if (with_controls_) {
AddControls();
CefRefPtr<CefPanel> top_menu_panel;
if (top_menu_bar_)
top_menu_panel = top_menu_bar_->GetMenuPanel();
LabelButtons browse_buttons;
CefRefPtr<CefMenuButton> menu_button;
if (chrome_toolbar_type_ == CEF_CTT_NORMAL) {
// Chrome will provide a normal toolbar with location, menu, etc.
top_toolbar_ = browser_view_->GetChromeToolbar();
DCHECK(top_toolbar_);
} }
if (!top_toolbar_) { if (with_overlay_controls_) {
// Create the browse buttons. overlay_controls_ = new ViewsOverlayControls();
browse_buttons.push_back(CreateBrowseButton("Back", ID_BACK_BUTTON)); overlay_controls_->Initialize(window_, CreateMenuButton(),
browse_buttons.push_back(CreateBrowseButton("Forward", ID_FORWARD_BUTTON)); CreateLocationBar(),
browse_buttons.push_back(CreateBrowseButton("Reload", ID_RELOAD_BUTTON)); chrome_toolbar_type_ != CEF_CTT_NONE);
browse_buttons.push_back(CreateBrowseButton("Stop", ID_STOP_BUTTON)); }
} else {
if (chrome_toolbar_type_ == CEF_CTT_LOCATION) { if (overlay_controls_) {
// Chrome will provide a minimal location bar. // Overlay controls may include the Chrome toolbar, in which case they
location_ = browser_view_->GetChromeToolbar(); // need to be removed before the BrowserView.
DCHECK(location_); overlay_controls_->Destroy();
overlay_controls_ = nullptr;
location_bar_ = nullptr;
}
} }
if (!location_) {
// Create the URL textfield.
CefRefPtr<CefTextfield> url_textfield =
CefTextfield::CreateTextfield(this);
url_textfield->SetID(ID_URL_TEXTFIELD);
url_textfield->SetEnabled(false); // Disabled by default.
views_style::ApplyTo(url_textfield);
location_ = url_textfield;
} }
// Create the menu button. void ViewsWindow::OnLayoutChanged(CefRefPtr<CefView> view,
menu_button = CefMenuButton::CreateMenuButton(this, CefString()); const CefRect& new_bounds) {
menu_button->SetID(ID_MENU_BUTTON); const int view_id = view->GetID();
menu_button->SetImage( if (view_id != ID_BROWSER_VIEW)
CEF_BUTTON_STATE_NORMAL, return;
delegate_->GetImageCache()->GetCachedImage("menu_icon"));
views_style::ApplyTo(menu_button.get());
menu_button->SetInkDropEnabled(true);
// Override the default minimum size.
menu_button->SetMinimumSize(CefSize(0, 0));
// Create the top panel. if (overlay_controls_) {
CefRefPtr<CefPanel> top_panel = CefPanel::CreatePanel(nullptr); overlay_controls_->UpdateControls();
// Use a horizontal box layout for |top_panel|.
CefBoxLayoutSettings top_panel_layout_settings;
top_panel_layout_settings.horizontal = true;
CefRefPtr<CefBoxLayout> top_panel_layout =
top_panel->SetToBoxLayout(top_panel_layout_settings);
// Add the buttons and URL textfield to |top_panel|.
for (size_t i = 0U; i < browse_buttons.size(); ++i)
top_panel->AddChildView(browse_buttons[i]);
top_panel->AddChildView(location_);
UpdateExtensionControls();
DCHECK(extensions_panel_);
top_panel->AddChildView(extensions_panel_);
top_panel->AddChildView(menu_button);
views_style::ApplyTo(top_panel);
// Allow |location| to grow and fill any remaining space.
top_panel_layout->SetFlexForView(location_, 1);
top_toolbar_ = top_panel;
} }
// Add the top panel and browser view to |window|.
int top_index = 0;
if (top_menu_panel)
window_->AddChildViewAt(top_menu_panel, top_index++);
window_->AddChildViewAt(top_toolbar_, top_index);
// Lay out |window| so we can get the default button sizes.
window_->Layout();
int min_width = 200;
if (!browse_buttons.empty()) {
// Make all browse buttons the same size.
MakeButtonsSameSize(browse_buttons);
// Lay out |window| again with the new button sizes.
window_->Layout();
// Minimum window width is the size of all buttons plus some extra.
min_width = browse_buttons[0]->GetBounds().width * 4 +
menu_button->GetBounds().width + 100;
}
// Minimum window height is the hight of the top toolbar plus some extra.
int min_height = top_toolbar_->GetBounds().height + 100;
if (top_menu_panel)
min_height += top_menu_panel->GetBounds().height;
minimum_window_size_ = CefSize(min_width, min_height);
} }
void ViewsWindow::MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model, void ViewsWindow::MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
@ -812,8 +760,16 @@ ViewsWindow::ViewsWindow(Delegate* delegate,
CefRefPtr<CefCommandLine> command_line = CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine(); CefCommandLine::GetGlobalCommandLine();
frameless_ = command_line->HasSwitch(switches::kHideFrame) ||
delegate_->WithExtension(); const bool hide_frame = command_line->HasSwitch(switches::kHideFrame);
const bool hide_overlays = command_line->HasSwitch(switches::kHideOverlays);
// Without a window frame.
frameless_ = hide_frame || delegate_->WithExtension();
// With an overlay that mimics window controls.
with_overlay_controls_ =
hide_frame && !hide_overlays && !delegate_->WithControls();
if (MainContext::Get()->UseChromeRuntime()) { if (MainContext::Get()->UseChromeRuntime()) {
const std::string& toolbar_type = const std::string& toolbar_type =
@ -823,7 +779,8 @@ ViewsWindow::ViewsWindow(Delegate* delegate,
} else if (toolbar_type == "location") { } else if (toolbar_type == "location") {
chrome_toolbar_type_ = CEF_CTT_LOCATION; chrome_toolbar_type_ = CEF_CTT_LOCATION;
} else { } else {
chrome_toolbar_type_ = CEF_CTT_NORMAL; chrome_toolbar_type_ =
with_overlay_controls_ ? CEF_CTT_LOCATION : CEF_CTT_NORMAL;
} }
} else { } else {
chrome_toolbar_type_ = CEF_CTT_NONE; chrome_toolbar_type_ = CEF_CTT_NONE;
@ -869,16 +826,49 @@ CefRefPtr<CefLabelButton> ViewsWindow::CreateBrowseButton(
CefRefPtr<CefLabelButton> button = CefRefPtr<CefLabelButton> button =
CefLabelButton::CreateLabelButton(this, label); CefLabelButton::CreateLabelButton(this, label);
button->SetID(id); button->SetID(id);
views_style::ApplyTo(button.get());
button->SetInkDropEnabled(true);
button->SetEnabled(false); // Disabled by default. button->SetEnabled(false); // Disabled by default.
button->SetFocusable(false); // Don't give focus to the button. button->SetFocusable(false); // Don't give focus to the button.
return button; return button;
} }
void ViewsWindow::AddControls() { CefRefPtr<CefMenuButton> ViewsWindow::CreateMenuButton() {
// Create the MenuModel that will be displayed via the menu button. // Create the menu button.
CreateMenuModel(); DCHECK(!menu_button_);
menu_button_ = CefMenuButton::CreateMenuButton(this, CefString());
menu_button_->SetID(ID_MENU_BUTTON);
menu_button_->SetImage(
CEF_BUTTON_STATE_NORMAL,
delegate_->GetImageCache()->GetCachedImage("menu_icon"));
views_style::ApplyTo(menu_button_.get());
menu_button_->SetInkDropEnabled(true);
// Override the default minimum size.
menu_button_->SetMinimumSize(CefSize(0, 0));
return menu_button_;
}
CefRefPtr<CefView> ViewsWindow::CreateLocationBar() {
DCHECK(!location_bar_);
if (chrome_toolbar_type_ == CEF_CTT_LOCATION) {
// Chrome will provide a minimal location bar.
location_bar_ = browser_view_->GetChromeToolbar();
DCHECK(location_bar_);
views_style::ApplyBackgroundTo(location_bar_);
}
if (!location_bar_) {
// Create the URL textfield.
CefRefPtr<CefTextfield> url_textfield = CefTextfield::CreateTextfield(this);
url_textfield->SetID(ID_URL_TEXTFIELD);
url_textfield->SetEnabled(false); // Disabled by default.
views_style::ApplyTo(url_textfield);
location_bar_ = url_textfield;
}
return location_bar_;
}
void ViewsWindow::AddBrowserView() {
// Use a vertical box layout for |window|. // Use a vertical box layout for |window|.
CefBoxLayoutSettings window_layout_settings; CefBoxLayoutSettings window_layout_settings;
window_layout_settings.horizontal = false; window_layout_settings.horizontal = false;
@ -896,6 +886,89 @@ void ViewsWindow::AddControls() {
// only available after the BrowserView is added. // only available after the BrowserView is added.
} }
void ViewsWindow::AddControls() {
// Build the remainder of the UI now that the BrowserView has been added to
// the CefWindow. This is a requirement to use Chrome toolbars.
CefRefPtr<CefPanel> top_menu_panel;
if (top_menu_bar_)
top_menu_panel = top_menu_bar_->GetMenuPanel();
LabelButtons browse_buttons;
if (chrome_toolbar_type_ == CEF_CTT_NORMAL) {
// Chrome will provide a normal toolbar with location, menu, etc.
top_toolbar_ = browser_view_->GetChromeToolbar();
DCHECK(top_toolbar_);
}
if (!top_toolbar_) {
// Create the browse buttons.
browse_buttons.push_back(CreateBrowseButton("Back", ID_BACK_BUTTON));
browse_buttons.push_back(CreateBrowseButton("Forward", ID_FORWARD_BUTTON));
browse_buttons.push_back(CreateBrowseButton("Reload", ID_RELOAD_BUTTON));
browse_buttons.push_back(CreateBrowseButton("Stop", ID_STOP_BUTTON));
CreateLocationBar();
CreateMenuButton();
// Create the top panel.
CefRefPtr<CefPanel> top_panel = CefPanel::CreatePanel(nullptr);
// Use a horizontal box layout for |top_panel|.
CefBoxLayoutSettings top_panel_layout_settings;
top_panel_layout_settings.horizontal = true;
CefRefPtr<CefBoxLayout> top_panel_layout =
top_panel->SetToBoxLayout(top_panel_layout_settings);
// Add the buttons and URL textfield to |top_panel|.
for (size_t i = 0U; i < browse_buttons.size(); ++i)
top_panel->AddChildView(browse_buttons[i]);
top_panel->AddChildView(location_bar_);
UpdateExtensionControls();
DCHECK(extensions_panel_);
top_panel->AddChildView(extensions_panel_);
top_panel->AddChildView(menu_button_);
views_style::ApplyTo(top_panel);
// Allow |location| to grow and fill any remaining space.
top_panel_layout->SetFlexForView(location_bar_, 1);
top_toolbar_ = top_panel;
}
// Add the top panel and browser view to |window|.
int top_index = 0;
if (top_menu_panel)
window_->AddChildViewAt(top_menu_panel, top_index++);
window_->AddChildViewAt(top_toolbar_, top_index);
// Lay out |window| so we can get the default button sizes.
window_->Layout();
int min_width = 200;
if (!browse_buttons.empty()) {
// Make all browse buttons the same size.
MakeButtonsSameSize(browse_buttons);
// Lay out |window| again with the new button sizes.
window_->Layout();
// Minimum window width is the size of all buttons plus some extra.
min_width = browse_buttons[0]->GetBounds().width * 4 +
menu_button_->GetBounds().width + 100;
}
// Minimum window height is the hight of the top toolbar plus some extra.
int min_height = top_toolbar_->GetBounds().height + 100;
if (top_menu_panel)
min_height += top_menu_panel->GetBounds().height;
minimum_window_size_ = CefSize(min_width, min_height);
}
void ViewsWindow::AddAccelerators() { void ViewsWindow::AddAccelerators() {
// Trigger accelerators without first forwarding to web content. // Trigger accelerators without first forwarding to web content.
browser_view_->SetPreferAccelerators(true); browser_view_->SetPreferAccelerators(true);
@ -926,7 +999,10 @@ void ViewsWindow::SetMenuFocusable(bool focusable) {
void ViewsWindow::EnableView(int id, bool enable) { void ViewsWindow::EnableView(int id, bool enable) {
if (!window_) if (!window_)
return; return;
CefRefPtr<CefView> view = window_->GetViewForID(id); // Special handling for |location_bar_| which may be an overlay (e.g. not a
// child of this view).
CefRefPtr<CefView> view =
id == ID_URL_TEXTFIELD ? location_bar_ : window_->GetViewForID(id);
if (view) if (view)
view->SetEnabled(enable); view->SetEnabled(enable);
} }

View File

@ -18,12 +18,14 @@
#include "include/views/cef_label_button.h" #include "include/views/cef_label_button.h"
#include "include/views/cef_menu_button.h" #include "include/views/cef_menu_button.h"
#include "include/views/cef_menu_button_delegate.h" #include "include/views/cef_menu_button_delegate.h"
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_textfield.h" #include "include/views/cef_textfield.h"
#include "include/views/cef_textfield_delegate.h" #include "include/views/cef_textfield_delegate.h"
#include "include/views/cef_window.h" #include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h" #include "include/views/cef_window_delegate.h"
#include "tests/cefclient/browser/image_cache.h" #include "tests/cefclient/browser/image_cache.h"
#include "tests/cefclient/browser/views_menu_bar.h" #include "tests/cefclient/browser/views_menu_bar.h"
#include "tests/cefclient/browser/views_overlay_controls.h"
namespace client { namespace client {
@ -167,6 +169,8 @@ class ViewsWindow : public CefBrowserViewDelegate,
void OnFocus(CefRefPtr<CefView> view) override; void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override; void OnBlur(CefRefPtr<CefView> view) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override; void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
// ViewsMenuBar::Delegate methods: // ViewsMenuBar::Delegate methods:
void MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model, void MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
@ -185,8 +189,13 @@ class ViewsWindow : public CefBrowserViewDelegate,
void CreateMenuModel(); void CreateMenuModel();
CefRefPtr<CefLabelButton> CreateBrowseButton(const std::string& label, CefRefPtr<CefLabelButton> CreateBrowseButton(const std::string& label,
int id); int id);
CefRefPtr<CefMenuButton> CreateMenuButton();
CefRefPtr<CefView> CreateLocationBar();
// Add controls to the Window. // Add the BrowserView to the Window.
void AddBrowserView();
// Add other controls to the Window.
void AddControls(); void AddControls();
// Add keyboard accelerators to the Window. // Add keyboard accelerators to the Window.
@ -214,18 +223,22 @@ class ViewsWindow : public CefBrowserViewDelegate,
CefRefPtr<CefBrowserView> browser_view_; CefRefPtr<CefBrowserView> browser_view_;
bool frameless_; bool frameless_;
bool with_controls_; bool with_controls_;
bool with_overlay_controls_;
ChromeToolbarType chrome_toolbar_type_; ChromeToolbarType chrome_toolbar_type_;
CefRefPtr<CefWindow> window_; CefRefPtr<CefWindow> window_;
CefRefPtr<CefMenuModel> button_menu_model_; CefRefPtr<CefMenuModel> button_menu_model_;
CefRefPtr<ViewsMenuBar> top_menu_bar_; CefRefPtr<ViewsMenuBar> top_menu_bar_;
CefRefPtr<CefView> top_toolbar_; CefRefPtr<CefView> top_toolbar_;
CefRefPtr<CefView> location_; CefRefPtr<CefMenuButton> menu_button_;
CefRefPtr<CefView> location_bar_;
bool menu_has_focus_; bool menu_has_focus_;
int last_focused_view_; int last_focused_view_;
CefSize minimum_window_size_; CefSize minimum_window_size_;
CefRefPtr<ViewsOverlayControls> overlay_controls_;
// Structure representing an extension. // Structure representing an extension.
struct ExtensionInfo { struct ExtensionInfo {
ExtensionInfo(CefRefPtr<CefExtension> extension, CefRefPtr<CefImage> image) ExtensionInfo(CefRefPtr<CefExtension> extension, CefRefPtr<CefImage> image)

View File

@ -2,6 +2,24 @@
<head> <head>
<title>Draggable Regions Test</title> <title>Draggable Regions Test</title>
<style> <style>
html, body {
height: 100%;
overflow: hidden;
}
.draggable-title {
-webkit-app-region: drag;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 34px;
background-color: white;
opacity: .5;
}
.content {
margin-top: 34px;
background-color: white;
}
.draggable { .draggable {
-webkit-app-region: drag; -webkit-app-region: drag;
position: absolute; position: absolute;
@ -23,10 +41,13 @@
} }
</style> </style>
</head> </head>
<body bgcolor="white"> <body>
<div class="draggable-title"></div>
<div class="content">
Draggable regions can be defined using the -webkit-app-region CSS property. Draggable regions can be defined using the -webkit-app-region CSS property.
<br/>In the below example the red region is draggable and the blue sub-region is non-draggable. <br/>In the below example the red region is draggable and the blue sub-region is non-draggable.
<br/>Windows can be resized by default and closed using JavaScript <a href="#" onClick="window.close(); return false;">window.close()</a>. <br/>Windows can be resized by default and closed using JavaScript <a href="#" onClick="window.close(); return false;">window.close()</a>.
</div>
<div class="draggable"> <div class="draggable">
<div class="nondraggable"></div> <div class="nondraggable"></div>
</div> </div>

View File

@ -37,6 +37,7 @@ const char kFilterURL[] = "filter-url";
const char kUseViews[] = "use-views"; const char kUseViews[] = "use-views";
const char kHideFrame[] = "hide-frame"; const char kHideFrame[] = "hide-frame";
const char kHideControls[] = "hide-controls"; const char kHideControls[] = "hide-controls";
const char kHideOverlays[] = "hide-overlays";
const char kAlwaysOnTop[] = "always-on-top"; const char kAlwaysOnTop[] = "always-on-top";
const char kHideTopMenu[] = "hide-top-menu"; const char kHideTopMenu[] = "hide-top-menu";
const char kSslClientCertificate[] = "ssl-client-certificate"; const char kSslClientCertificate[] = "ssl-client-certificate";

View File

@ -31,6 +31,7 @@ extern const char kFilterURL[];
extern const char kUseViews[]; extern const char kUseViews[];
extern const char kHideFrame[]; extern const char kHideFrame[];
extern const char kHideControls[]; extern const char kHideControls[];
extern const char kHideOverlays[];
extern const char kAlwaysOnTop[]; extern const char kAlwaysOnTop[];
extern const char kHideTopMenu[]; extern const char kHideTopMenu[];
extern const char kSslClientCertificate[]; extern const char kSslClientCertificate[];

View File

@ -398,6 +398,7 @@ _simpletypes = {
], ],
'CefEventHandle': ['cef_event_handle_t', 'kNullEventHandle'], 'CefEventHandle': ['cef_event_handle_t', 'kNullEventHandle'],
'CefWindowHandle': ['cef_window_handle_t', 'kNullWindowHandle'], 'CefWindowHandle': ['cef_window_handle_t', 'kNullWindowHandle'],
'CefInsets': ['cef_insets_t', 'CefInsets()'],
'CefPoint': ['cef_point_t', 'CefPoint()'], 'CefPoint': ['cef_point_t', 'CefPoint()'],
'CefRect': ['cef_rect_t', 'CefRect()'], 'CefRect': ['cef_rect_t', 'CefRect()'],
'CefSize': ['cef_size_t', 'CefSize()'], 'CefSize': ['cef_size_t', 'CefSize()'],