views: Use default theme background color for all controls (see #3671)
Add new CefViewDelegate::OnThemeChanged callback for optionally overriding default theme colors when the current theme changes.
This commit is contained in:
parent
a13b6dc7f6
commit
19ba8b2b8d
|
@ -33,7 +33,7 @@
|
|||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=48df6ccac2c68f32c7024ae68c8a6b6a5f8ed914$
|
||||
// $hash=0ea5c2c5c1a8e8349f199a46642631be0c1bfb6b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
|
||||
|
@ -338,13 +338,16 @@ typedef struct _cef_view_t {
|
|||
void(CEF_CALLBACK* request_focus)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
/// Sets the background color for this View.
|
||||
/// Sets the background color for this View. The background color will be
|
||||
/// automatically reset if the current theme changes. See
|
||||
/// cef_view_delegate_t::OnThemeChanged for related documentation.
|
||||
///
|
||||
void(CEF_CALLBACK* set_background_color)(struct _cef_view_t* self,
|
||||
cef_color_t color);
|
||||
|
||||
///
|
||||
/// Returns the background color for this View.
|
||||
/// Returns the background color for this View. If the background color has
|
||||
/// not been explicitly set then the current theme color will be returned.
|
||||
///
|
||||
cef_color_t(CEF_CALLBACK* get_background_color)(struct _cef_view_t* self);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=4e421d2d1e24df6e58f7a7c0c074056bc5284df4$
|
||||
// $hash=d3624baa94bb722c48880b4319f5d5e8035eaa46$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
|
||||
|
@ -140,6 +140,17 @@ typedef struct _cef_view_delegate_t {
|
|||
///
|
||||
void(CEF_CALLBACK* on_blur)(struct _cef_view_delegate_t* self,
|
||||
struct _cef_view_t* view);
|
||||
|
||||
///
|
||||
/// Called when the theme for |view| has changed, after the new theme colors
|
||||
/// have already been applied. This will be called at least one time when
|
||||
/// |view| is added to a parent View. Further theme changes can be disabled by
|
||||
/// passing the `--force-dark-mode` or `--force-light-mode` command-line flag.
|
||||
/// Optionally use this callback to override the new theme colors by calling
|
||||
/// the appropriate cef_view_t functions (SetBackgroundColor, etc).
|
||||
///
|
||||
void(CEF_CALLBACK* on_theme_changed)(struct _cef_view_delegate_t* self,
|
||||
struct _cef_view_t* view);
|
||||
} cef_view_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -42,13 +42,13 @@
|
|||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "a419379d63087c1c3fb8a8215c066882fd4fce03"
|
||||
#define CEF_API_HASH_UNIVERSAL "a741045ff32b6feeaedf4e767ee0a18ed1c68007"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "04f4a1140954f4b11e6fef271d39908ecff07b86"
|
||||
#define CEF_API_HASH_PLATFORM "1180df9630b71b08a4c4874aa66484c3ca391327"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "d0143d677ea9945ed5e0c3624afdb444796661ee"
|
||||
#define CEF_API_HASH_PLATFORM "eaed012692fa480863cb78189e21ddf738fb8d5d"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "cac5605286f35bf76576098a0da810a9a34b418a"
|
||||
#define CEF_API_HASH_PLATFORM "e17a9dca9ce61905920a734e71333729578da10e"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -357,13 +357,16 @@ class CefView : public CefBaseRefCounted {
|
|||
virtual void RequestFocus() = 0;
|
||||
|
||||
///
|
||||
/// Sets the background color for this View.
|
||||
/// Sets the background color for this View. The background color will be
|
||||
/// automatically reset if the current theme changes. See
|
||||
/// CefViewDelegate::OnThemeChanged for related documentation.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetBackgroundColor(cef_color_t color) = 0;
|
||||
|
||||
///
|
||||
/// Returns the background color for this View.
|
||||
/// Returns the background color for this View. If the background color has
|
||||
/// not been explicitly set then the current theme color will be returned.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual cef_color_t GetBackgroundColor() = 0;
|
||||
|
|
|
@ -131,6 +131,17 @@ class CefViewDelegate : public virtual CefBaseRefCounted {
|
|||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnBlur(CefRefPtr<CefView> view) {}
|
||||
|
||||
///
|
||||
/// Called when the theme for |view| has changed, after the new theme colors
|
||||
/// have already been applied. This will be called at least one time when
|
||||
/// |view| is added to a parent View. Further theme changes can be disabled by
|
||||
/// passing the `--force-dark-mode` or `--force-light-mode` command-line flag.
|
||||
/// Optionally use this callback to override the new theme colors by calling
|
||||
/// the appropriate CefView methods (SetBackgroundColor, etc).
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnThemeChanged(CefRefPtr<CefView> view) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "chrome/browser/ui/ui_features.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/color/color_mixers.h"
|
||||
#include "components/constrained_window/constrained_window_views.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
|
@ -246,6 +247,8 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
|||
|
||||
// On GTK that builds the native theme that, in turn, adds the GTK core color
|
||||
// mixer; core mixers should all be added before we add chrome mixers.
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(color::AddComponentsColorMixers));
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(AddChromeColorMixers));
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetInkDropEnabled(bool enabled) {
|
|||
if (enabled) {
|
||||
views::InkDrop::Get(ParentClass::root_view())
|
||||
->SetBaseColor(color_utils::BlendTowardMaxContrast(
|
||||
ParentClass::root_view()->background()->get_color(), 0x61));
|
||||
ParentClass::GetBackgroundColor(), 0x61));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,8 +193,6 @@ void CefOverlayViewHost::Init(views::View* host_view,
|
|||
: 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);
|
||||
|
@ -213,6 +211,11 @@ void CefOverlayViewHost::Init(views::View* host_view,
|
|||
}
|
||||
}
|
||||
|
||||
// Call AddChildView after the Widget properties have been configured.
|
||||
// Notifications resulting from this call may attempt to access those
|
||||
// properties (OnThemeChanged calling GetHostView, for example).
|
||||
view_ = widget_->GetContentsView()->AddChildView(std::move(controls_view));
|
||||
|
||||
// Set the initial bounds after the View has been added to the Widget.
|
||||
// Otherwise, preferred size won't calculate correctly.
|
||||
gfx::Rect bounds;
|
||||
|
|
|
@ -675,12 +675,15 @@ CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::RequestFocus() {
|
|||
|
||||
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetBackgroundColor(cef_color_t color) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
content_view()->SetBackground(views::CreateSolidBackground(color));
|
||||
root_view()->SetBackground(views::CreateSolidBackground(color));
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T cef_color_t CEF_VIEW_IMPL_D::GetBackgroundColor() {
|
||||
CEF_REQUIRE_VALID_RETURN(0U);
|
||||
return content_view()->background()->get_color();
|
||||
if (root_view()->background()) {
|
||||
return root_view()->background()->get_color();
|
||||
}
|
||||
return view_util::GetColor(root_view(), ui::kColorPrimaryBackground);
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::ConvertPointToScreen(CefPoint& point) {
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
|
||||
#include "libcef/browser/views/view_adapter.h"
|
||||
|
||||
#include "ui/color/color_provider.h"
|
||||
#include "ui/color/color_provider_manager.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
#include "ui/gfx/geometry/point_conversions.h"
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/widget/widget_delegate.h"
|
||||
#include "ui/views/window/non_client_view.h"
|
||||
|
@ -118,9 +121,24 @@ class UserData : public base::SupportsUserData::Data {
|
|||
CefView* view_ref_;
|
||||
};
|
||||
|
||||
// Based on Widget::GetNativeTheme.
|
||||
const ui::NativeTheme* GetDefaultNativeTheme() {
|
||||
return ui::NativeTheme::GetInstanceForNativeUi();
|
||||
}
|
||||
|
||||
// Based on Widget::GetColorProviderKey.
|
||||
ui::ColorProviderKey GetDefaultColorProviderKey() {
|
||||
return GetDefaultNativeTheme()->GetColorProviderKey(/*custom_theme=*/nullptr);
|
||||
}
|
||||
|
||||
// Based on Widget::GetColorProvider.
|
||||
ui::ColorProvider* GetDefaultColorProvider() {
|
||||
return ui::ColorProviderManager::Get().GetColorProviderFor(
|
||||
GetDefaultColorProviderKey());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const SkColor kDefaultBackgroundColor = SkColorSetARGB(255, 255, 255, 255);
|
||||
const char kDefaultFontList[] = "Arial, Helvetica, 14px";
|
||||
|
||||
void Register(CefRefPtr<CefView> view) {
|
||||
|
@ -323,4 +341,14 @@ bool ConvertPointFromWindow(views::View* view, gfx::Point* point) {
|
|||
return true;
|
||||
}
|
||||
|
||||
SkColor GetColor(views::View* view, ui::ColorId id) {
|
||||
// |color_provider| will be nullptr if |view| has not yet been added to a
|
||||
// Widget.
|
||||
if (auto color_provider = view->GetColorProvider()) {
|
||||
return color_provider->GetColor(id);
|
||||
}
|
||||
|
||||
return GetDefaultColorProvider()->GetColor(id);
|
||||
}
|
||||
|
||||
} // namespace view_util
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "include/views/cef_view.h"
|
||||
#include "include/views/cef_window.h"
|
||||
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
|
@ -45,7 +46,6 @@ class CefWindowDelegate;
|
|||
namespace view_util {
|
||||
|
||||
// Default values.
|
||||
extern const SkColor kDefaultBackgroundColor;
|
||||
extern const char kDefaultFontList[];
|
||||
|
||||
// Called when a CefView is initialized to create the initial association
|
||||
|
@ -165,6 +165,11 @@ views::View* GetHostView(views::Widget* widget);
|
|||
float GetNSWindowTitleBarHeight(views::Widget* widget);
|
||||
#endif
|
||||
|
||||
// Returns the mixer color for |id|. If |view| has been added to a Widget it
|
||||
// will use the Widget's ColorProvider, otherwise it will use the default theme
|
||||
// ColorProvider. Returns gfx::kPlaceholderColor if |id| cannot be constructed.
|
||||
SkColor GetColor(views::View* view, ui::ColorId id);
|
||||
|
||||
} // namespace view_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_VIEWS_VIEW_UTIL_H_
|
||||
|
|
|
@ -44,10 +44,6 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
|
|||
// CefViewImpl registration has completed so it is safe to call complex
|
||||
// views::View-derived methods here.
|
||||
virtual void Initialize() {
|
||||
// Use our defaults instead of the Views framework defaults.
|
||||
ParentClass::SetBackground(
|
||||
views::CreateSolidBackground(view_util::kDefaultBackgroundColor));
|
||||
|
||||
// TODO(crbug.com/1218186): Remove this, if this view is focusable then it
|
||||
// needs to add a name so that the screen reader knows what to announce.
|
||||
ParentClass::SetProperty(views::kSkipAccessibilityPaintChecks, true);
|
||||
|
@ -80,6 +76,7 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
|
|||
void RemovedFromWidget() override;
|
||||
void OnFocus() override;
|
||||
void OnBlur() override;
|
||||
void OnThemeChanged() override;
|
||||
|
||||
// Return true if this View is expected to have a minimum size (for example,
|
||||
// a button where the minimum size is based on the label).
|
||||
|
@ -214,6 +211,35 @@ CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::OnBlur() {
|
|||
ParentClass::OnBlur();
|
||||
}
|
||||
|
||||
CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::OnThemeChanged() {
|
||||
// Clear the background, if set.
|
||||
if (ParentClass::background()) {
|
||||
ParentClass::SetBackground(nullptr);
|
||||
}
|
||||
|
||||
// Apply default theme colors.
|
||||
ParentClass::OnThemeChanged();
|
||||
|
||||
// Allow the client to override the default colors.
|
||||
if (cef_delegate()) {
|
||||
cef_delegate()->OnThemeChanged(GetCefView());
|
||||
}
|
||||
|
||||
// If the background is still unset, and the containing Widget is not an
|
||||
// overlay (which has transparent background), then set the background based
|
||||
// on the current theme.
|
||||
if (!ParentClass::background()) {
|
||||
const bool is_overlay_hosted =
|
||||
ParentClass::GetWidget() &&
|
||||
view_util::GetHostView(ParentClass::GetWidget()) != nullptr;
|
||||
if (!is_overlay_hosted) {
|
||||
const SkColor color =
|
||||
view_util::GetColor(this, ui::kColorPrimaryBackground);
|
||||
ParentClass::SetBackground(views::CreateSolidBackground(color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CEF_VIEW_VIEW_T void CEF_VIEW_VIEW_D::NotifyChildViewChanged(
|
||||
const views::ViewHierarchyChangedDetails& details) {
|
||||
if (!cef_delegate()) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5e87111d30f695b234fe6e0fee539e8e15453c66$
|
||||
// $hash=c8365b492a81de537ee4d337ca18dae8b3f20e0d$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
|
||||
|
@ -513,6 +513,29 @@ browser_view_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
browser_view_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefBrowserViewDelegateCppToC::Get(
|
||||
reinterpret_cast<cef_browser_view_delegate_t*>(self))
|
||||
->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -544,6 +567,7 @@ CefBrowserViewDelegateCppToC::CefBrowserViewDelegateCppToC() {
|
|||
GetStruct()->base.on_layout_changed = browser_view_delegate_on_layout_changed;
|
||||
GetStruct()->base.on_focus = browser_view_delegate_on_focus;
|
||||
GetStruct()->base.on_blur = browser_view_delegate_on_blur;
|
||||
GetStruct()->base.on_theme_changed = browser_view_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4dce379ea37fb6976b0af5f46fc1eeccf2e8606d$
|
||||
// $hash=0e5cf49bf903204aa1241520c8acf1cb5767da65$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/button_delegate_cpptoc.h"
|
||||
|
@ -327,6 +327,28 @@ void CEF_CALLBACK button_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
button_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
|
||||
->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -347,6 +369,7 @@ CefButtonDelegateCppToC::CefButtonDelegateCppToC() {
|
|||
GetStruct()->base.on_layout_changed = button_delegate_on_layout_changed;
|
||||
GetStruct()->base.on_focus = button_delegate_on_focus;
|
||||
GetStruct()->base.on_blur = button_delegate_on_blur;
|
||||
GetStruct()->base.on_theme_changed = button_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5e0418c416ecd0c23cb7fcc9d6a52ef06ba86686$
|
||||
// $hash=e279bb0412c82b1235a5f4cd860ad2d5aab07042$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h"
|
||||
|
@ -376,6 +376,29 @@ menu_button_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
menu_button_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefMenuButtonDelegateCppToC::Get(
|
||||
reinterpret_cast<cef_menu_button_delegate_t*>(self))
|
||||
->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -404,6 +427,8 @@ CefMenuButtonDelegateCppToC::CefMenuButtonDelegateCppToC() {
|
|||
menu_button_delegate_on_layout_changed;
|
||||
GetStruct()->base.base.on_focus = menu_button_delegate_on_focus;
|
||||
GetStruct()->base.base.on_blur = menu_button_delegate_on_blur;
|
||||
GetStruct()->base.base.on_theme_changed =
|
||||
menu_button_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cb28c29eeb68707fb9b164f539804a6d8a7e61be$
|
||||
// $hash=cb2d1231eb279cea9a132af8bded03032307cb45$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/panel_delegate_cpptoc.h"
|
||||
|
@ -282,6 +282,28 @@ void CEF_CALLBACK panel_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
panel_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
|
||||
->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -299,6 +321,7 @@ CefPanelDelegateCppToC::CefPanelDelegateCppToC() {
|
|||
GetStruct()->base.on_layout_changed = panel_delegate_on_layout_changed;
|
||||
GetStruct()->base.on_focus = panel_delegate_on_focus;
|
||||
GetStruct()->base.on_blur = panel_delegate_on_blur;
|
||||
GetStruct()->base.on_theme_changed = panel_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e0a80958b419a73b1f57655ef19f4aa7064bd19d$
|
||||
// $hash=3a3696160ea6f07beb0a7c68e415e2c71490963e$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h"
|
||||
|
@ -344,6 +344,29 @@ void CEF_CALLBACK textfield_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
textfield_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefTextfieldDelegateCppToC::Get(
|
||||
reinterpret_cast<cef_textfield_delegate_t*>(self))
|
||||
->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -364,6 +387,7 @@ CefTextfieldDelegateCppToC::CefTextfieldDelegateCppToC() {
|
|||
GetStruct()->base.on_layout_changed = textfield_delegate_on_layout_changed;
|
||||
GetStruct()->base.on_focus = textfield_delegate_on_focus;
|
||||
GetStruct()->base.on_blur = textfield_delegate_on_blur;
|
||||
GetStruct()->base.on_theme_changed = textfield_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a73bcac096d32c3a63cca3f3006d70a803c00626$
|
||||
// $hash=bd18088799d97c56459bce12fb0cb2177caecead$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/view_delegate_cpptoc.h"
|
||||
|
@ -281,6 +281,27 @@ void CEF_CALLBACK view_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
CefViewDelegateCppToC::Get(self)->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
view_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefViewDelegateCppToC::Get(self)->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -296,6 +317,7 @@ CefViewDelegateCppToC::CefViewDelegateCppToC() {
|
|||
GetStruct()->on_layout_changed = view_delegate_on_layout_changed;
|
||||
GetStruct()->on_focus = view_delegate_on_focus;
|
||||
GetStruct()->on_blur = view_delegate_on_blur;
|
||||
GetStruct()->on_theme_changed = view_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=1f438b082c8c499084a3e494e1bb83adaecf91d1$
|
||||
// $hash=1829e6ed7282ca9a0b34e825a11c229ddd48590d$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
|
||||
|
@ -793,6 +793,28 @@ void CEF_CALLBACK window_delegate_on_blur(struct _cef_view_delegate_t* self,
|
|||
->OnBlur(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
window_delegate_on_theme_changed(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefWindowDelegateCppToC::Get(reinterpret_cast<cef_window_delegate_t*>(self))
|
||||
->OnThemeChanged(CefViewCToCpp::Wrap(view));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@ -835,6 +857,7 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
|
|||
GetStruct()->base.base.on_layout_changed = window_delegate_on_layout_changed;
|
||||
GetStruct()->base.base.on_focus = window_delegate_on_focus;
|
||||
GetStruct()->base.base.on_blur = window_delegate_on_blur;
|
||||
GetStruct()->base.base.on_theme_changed = window_delegate_on_theme_changed;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=07f16fe4afc8f6c558d40bdc2852a27920dd779c$
|
||||
// $hash=bf57f469c4dc266377346d8874406c437b682112$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h"
|
||||
|
@ -486,6 +486,28 @@ void CefBrowserViewDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefBrowserViewDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct =
|
||||
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefBrowserViewDelegateCToCpp::CefBrowserViewDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a10c42b7075bc78e51a99ff5aa7da9effa4fe6f5$
|
||||
// $hash=b7d2905473b08d50a876b01f9e6a275316166c72$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_DELEGATE_CTOCPP_H_
|
||||
|
@ -74,6 +74,7 @@ class CefBrowserViewDelegateCToCpp
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=68df0ecd51479bdc9f55fb605933ac10ca15affd$
|
||||
// $hash=564f44a20f3eab8c45fe840cb8d65f399f3ee0db$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/button_delegate_ctocpp.h"
|
||||
|
@ -318,6 +318,28 @@ void CefButtonDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefButtonDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct =
|
||||
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefButtonDelegateCToCpp::CefButtonDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=53e751a5b54ab964ee2aef1a8232a9647f47db00$
|
||||
// $hash=0e50e8cd82200398ce91a03a6c0ef51da5ac956b$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_DELEGATE_CTOCPP_H_
|
||||
|
@ -56,6 +56,7 @@ class CefButtonDelegateCToCpp
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=f65b17eb26f40ebf503684544969eed98dcabd9b$
|
||||
// $hash=a6485751f5491da5b4a762d8f70c80fec73d0a95$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h"
|
||||
|
@ -353,6 +353,28 @@ void CefMenuButtonDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMenuButtonDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct =
|
||||
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMenuButtonDelegateCToCpp::CefMenuButtonDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a95e80394596beec91e6f8915fed15fdd52bea96$
|
||||
// $hash=99795614556ff22cbcbac94cfb9f4794e5fe5c81$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_DELEGATE_CTOCPP_H_
|
||||
|
@ -62,6 +62,7 @@ class CefMenuButtonDelegateCToCpp
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=eeb999ed9ff1b98afba6cc6d0c4c7917c4d28230$
|
||||
// $hash=96114a38e7bbf499fcb245d029164975b8d10ebe$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/panel_delegate_ctocpp.h"
|
||||
|
@ -274,6 +274,28 @@ void CefPanelDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefPanelDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct =
|
||||
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefPanelDelegateCToCpp::CefPanelDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=26cc71f954f212dae798b7c0ffb99f9ec7b8caac$
|
||||
// $hash=74dcb25fa301e2442b1275efa20421e0477b47e0$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_DELEGATE_CTOCPP_H_
|
||||
|
@ -52,6 +52,7 @@ class CefPanelDelegateCToCpp
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=974d55311d65e2bea484c9c8721e138018f4ab10$
|
||||
// $hash=6bb6403f617d98d48362f9038b648a176b67e585$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h"
|
||||
|
@ -323,6 +323,28 @@ void CefTextfieldDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefTextfieldDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct =
|
||||
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefTextfieldDelegateCToCpp::CefTextfieldDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=343716f91bef33f5c84bd269d5755b142010f8be$
|
||||
// $hash=c8a4c746300947cd664bbea7b85811e77f7f7bc4$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_DELEGATE_CTOCPP_H_
|
||||
|
@ -57,6 +57,7 @@ class CefTextfieldDelegateCToCpp
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=db639bf9fe95b7a04e6d126b32ba4ba797a82ef0$
|
||||
// $hash=4a5c6a3e8b378e785f57c0749926b380cc29ad43$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/view_delegate_ctocpp.h"
|
||||
|
@ -269,6 +269,27 @@ void CefViewDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefViewDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefViewDelegateCToCpp::CefViewDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e6d59b73a62b960955749e557d300f656a95297c$
|
||||
// $hash=de93178ea96887a8dc558c96f46f2ed075fae0a6$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_DELEGATE_CTOCPP_H_
|
||||
|
@ -51,6 +51,7 @@ class CefViewDelegateCToCpp : public CefCToCppRefCounted<CefViewDelegateCToCpp,
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cfe4f7b7980000ea0bf223db0d717ed44e8b880b$
|
||||
// $hash=1d798c20b6e7325b2e769185739288682b037960$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
|
||||
|
@ -766,6 +766,28 @@ void CefWindowDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
|
|||
_struct->on_blur(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefWindowDelegateCToCpp::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_delegate_t* _struct =
|
||||
reinterpret_cast<cef_view_delegate_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, on_theme_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_theme_changed(_struct, CefViewCppToC::Wrap(view));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefWindowDelegateCToCpp::CefWindowDelegateCToCpp() {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=ffa207a19ab4e538ce2f6071584c56c82233921c$
|
||||
// $hash=80e6d33af9304311baec72c039930dc22d38bd53$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
|
||||
|
@ -82,6 +82,7 @@ class CefWindowDelegateCToCpp
|
|||
const CefRect& new_bounds) override;
|
||||
void OnFocus(CefRefPtr<CefView> view) override;
|
||||
void OnBlur(CefRefPtr<CefView> view) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
|
||||
|
|
|
@ -124,9 +124,6 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
|||
// Parse the background color value.
|
||||
background_color_ =
|
||||
ParseColor(command_line_->GetSwitchValue(switches::kBackgroundColor));
|
||||
} else if (command_line_->HasSwitch("force-dark-mode")) {
|
||||
// Use black background color by default with dark mode.
|
||||
background_color_ = ParseColor("black");
|
||||
}
|
||||
|
||||
if (background_color_ == 0 && !use_views_) {
|
||||
|
|
|
@ -83,7 +83,6 @@ CefRefPtr<CefMenuModel> ViewsMenuBar::CreateMenuModel(const CefString& label,
|
|||
CefRefPtr<CefMenuButton> button =
|
||||
CefMenuButton::CreateMenuButton(this, label);
|
||||
button->SetID(new_menu_id);
|
||||
views_style::ApplyTo(button.get());
|
||||
button->SetInkDropEnabled(true);
|
||||
|
||||
// Assign a group ID to allow focus traversal between MenuButtons using the
|
||||
|
@ -283,13 +282,17 @@ void ViewsMenuBar::MenuClosed(CefRefPtr<CefMenuModel> menu_model) {
|
|||
}
|
||||
}
|
||||
|
||||
void ViewsMenuBar::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
// Apply colors when the theme changes.
|
||||
views_style::ApplyTo(view);
|
||||
}
|
||||
|
||||
void ViewsMenuBar::EnsureMenuPanel() {
|
||||
if (panel_) {
|
||||
return;
|
||||
}
|
||||
|
||||
panel_ = CefPanel::CreatePanel(nullptr);
|
||||
views_style::ApplyTo(panel_);
|
||||
panel_ = CefPanel::CreatePanel(this);
|
||||
|
||||
// Use a horizontal box layout.
|
||||
CefBoxLayoutSettings top_panel_layout_settings;
|
||||
|
|
|
@ -21,7 +21,9 @@ namespace client {
|
|||
// Implements a menu bar which is composed of CefMenuButtons positioned in a
|
||||
// row with automatic switching between them via mouse/keyboard. All methods
|
||||
// must be called on the browser process UI thread.
|
||||
class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate {
|
||||
class ViewsMenuBar : public CefMenuButtonDelegate,
|
||||
public CefMenuModelDelegate,
|
||||
public CefPanelDelegate {
|
||||
public:
|
||||
// Delegate methods will be called on the browser process UI thread.
|
||||
class Delegate {
|
||||
|
@ -90,6 +92,9 @@ class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate {
|
|||
bool is_rtl) override;
|
||||
void MenuClosed(CefRefPtr<CefMenuModel> menu_model) override;
|
||||
|
||||
// CefViewDelegate methods:
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
|
||||
private:
|
||||
// Creates the menu panel if it doesn't already exist.
|
||||
void EnsureMenuPanel();
|
||||
|
|
|
@ -96,8 +96,7 @@ void ViewsOverlayControls::Initialize(CefRefPtr<CefWindow> window,
|
|||
// 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_);
|
||||
panel_ = CefPanel::CreatePanel(this);
|
||||
|
||||
// Use a horizontal box layout.
|
||||
CefBoxLayoutSettings panel_layout_settings;
|
||||
|
@ -226,11 +225,15 @@ void ViewsOverlayControls::OnButtonPressed(CefRefPtr<CefButton> button) {
|
|||
}
|
||||
}
|
||||
|
||||
void ViewsOverlayControls::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
// Apply colors when the theme changes.
|
||||
views_style::ApplyTo(view);
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -17,7 +17,7 @@ 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 {
|
||||
class ViewsOverlayControls : public CefButtonDelegate, public CefPanelDelegate {
|
||||
public:
|
||||
enum class Command {
|
||||
kMinimize = 1,
|
||||
|
@ -43,6 +43,9 @@ class ViewsOverlayControls : public CefButtonDelegate {
|
|||
// CefButtonDelegate methods:
|
||||
void OnButtonPressed(CefRefPtr<CefButton> button) override;
|
||||
|
||||
// CefViewDelegate methods:
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
|
||||
CefRefPtr<CefLabelButton> CreateButton(Command command);
|
||||
|
||||
void MaybeUpdateMaximizeButton();
|
||||
|
|
|
@ -48,44 +48,6 @@ bool IsSet() {
|
|||
return g_background_color != 0;
|
||||
}
|
||||
|
||||
void ApplyBackgroundTo(CefRefPtr<CefView> view) {
|
||||
if (!IsSet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
view->SetBackgroundColor(g_background_color);
|
||||
}
|
||||
|
||||
void ApplyTo(CefRefPtr<CefPanel> panel) {
|
||||
if (!IsSet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
panel->SetBackgroundColor(g_background_color);
|
||||
}
|
||||
|
||||
void ApplyTo(CefRefPtr<CefLabelButton> label_button) {
|
||||
if (!IsSet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// All text except disabled gets the same color.
|
||||
label_button->SetEnabledTextColors(g_text_color);
|
||||
label_button->SetTextColor(CEF_BUTTON_STATE_DISABLED,
|
||||
g_background_hover_color);
|
||||
|
||||
label_button->SetBackgroundColor(g_background_color);
|
||||
}
|
||||
|
||||
void ApplyTo(CefRefPtr<CefTextfield> textfield) {
|
||||
if (!IsSet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
textfield->SetBackgroundColor(g_background_color);
|
||||
textfield->SetTextColor(g_text_color);
|
||||
}
|
||||
|
||||
void ApplyTo(CefRefPtr<CefMenuModel> menu_model) {
|
||||
if (!IsSet()) {
|
||||
return;
|
||||
|
@ -111,4 +73,23 @@ void ApplyTo(CefRefPtr<CefMenuModel> menu_model) {
|
|||
}
|
||||
}
|
||||
|
||||
void ApplyTo(CefRefPtr<CefView> view) {
|
||||
if (!IsSet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto button = view->AsButton()) {
|
||||
if (auto label_button = button->AsLabelButton()) {
|
||||
// All text except disabled gets the same color.
|
||||
label_button->SetEnabledTextColors(g_text_color);
|
||||
label_button->SetTextColor(CEF_BUTTON_STATE_DISABLED,
|
||||
g_background_hover_color);
|
||||
}
|
||||
} else if (auto textfield = view->AsTextfield()) {
|
||||
textfield->SetTextColor(g_text_color);
|
||||
}
|
||||
|
||||
view->SetBackgroundColor(g_background_color);
|
||||
}
|
||||
|
||||
} // namespace client::views_style
|
||||
|
|
|
@ -17,11 +17,8 @@ namespace client::views_style {
|
|||
bool IsSet();
|
||||
|
||||
// Apply style to views objects.
|
||||
void ApplyBackgroundTo(CefRefPtr<CefView> view);
|
||||
void ApplyTo(CefRefPtr<CefPanel> panel);
|
||||
void ApplyTo(CefRefPtr<CefLabelButton> label_button);
|
||||
void ApplyTo(CefRefPtr<CefTextfield> textfield);
|
||||
void ApplyTo(CefRefPtr<CefMenuModel> menu_model);
|
||||
void ApplyTo(CefRefPtr<CefView> view);
|
||||
|
||||
} // namespace client::views_style
|
||||
|
||||
|
|
|
@ -1060,6 +1060,11 @@ void ViewsWindow::OnLayoutChanged(CefRefPtr<CefView> view,
|
|||
}
|
||||
}
|
||||
|
||||
void ViewsWindow::OnThemeChanged(CefRefPtr<CefView> view) {
|
||||
// Apply colors when the theme changes.
|
||||
views_style::ApplyTo(view);
|
||||
}
|
||||
|
||||
void ViewsWindow::MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
|
||||
int command_id,
|
||||
cef_event_flags_t event_flags) {
|
||||
|
@ -1157,7 +1162,6 @@ CefRefPtr<CefLabelButton> ViewsWindow::CreateBrowseButton(
|
|||
CefRefPtr<CefLabelButton> button =
|
||||
CefLabelButton::CreateLabelButton(this, label);
|
||||
button->SetID(id);
|
||||
views_style::ApplyTo(button.get());
|
||||
button->SetInkDropEnabled(true);
|
||||
button->SetEnabled(false); // Disabled by default.
|
||||
button->SetFocusable(false); // Don't give focus to the button.
|
||||
|
@ -1173,7 +1177,6 @@ CefRefPtr<CefMenuButton> ViewsWindow::CreateMenuButton() {
|
|||
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));
|
||||
|
@ -1186,14 +1189,12 @@ CefRefPtr<CefView> ViewsWindow::CreateLocationBar() {
|
|||
// 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_;
|
||||
|
@ -1264,7 +1265,6 @@ void ViewsWindow::AddControls() {
|
|||
panel->AddChildView(extensions_panel_);
|
||||
|
||||
panel->AddChildView(menu_button_);
|
||||
views_style::ApplyTo(panel);
|
||||
|
||||
// Allow |location| to grow and fill any remaining space.
|
||||
panel_layout->SetFlexForView(location_bar_, 1);
|
||||
|
@ -1405,7 +1405,6 @@ void ViewsWindow::UpdateExtensionControls() {
|
|||
CefMenuButton::CreateMenuButton(this, CefString());
|
||||
button->SetID(id);
|
||||
button->SetImage(CEF_BUTTON_STATE_NORMAL, (*it).image_);
|
||||
views_style::ApplyTo(button.get());
|
||||
button->SetInkDropEnabled(true);
|
||||
// Override the default minimum size.
|
||||
button->SetMinimumSize(CefSize(0, 0));
|
||||
|
|
|
@ -202,6 +202,7 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
|||
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
|
||||
void OnLayoutChanged(CefRefPtr<CefView> view,
|
||||
const CefRect& new_bounds) override;
|
||||
void OnThemeChanged(CefRefPtr<CefView> view) override;
|
||||
|
||||
// ViewsMenuBar::Delegate methods:
|
||||
void MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
|
||||
|
|
|
@ -56,7 +56,6 @@ void CreatePanel(CefRefPtr<CefPanelDelegate> delegate) {
|
|||
EXPECT_TRUE(panel->IsEnabled());
|
||||
EXPECT_FALSE(panel->IsFocusable());
|
||||
EXPECT_FALSE(panel->IsAccessibilityFocusable());
|
||||
EXPECT_EQ(CefColorSetARGB(255, 255, 255, 255), panel->GetBackgroundColor());
|
||||
|
||||
// Verify default Panel state.
|
||||
EXPECT_TRUE(panel->GetLayout().get());
|
||||
|
|
Loading…
Reference in New Issue