chrome: Add ability to hide toolbar and app menu contents (see issue #3280)

This change adds new CefCommandHandler callbacks for optionally hiding
specific Chrome toolbar icons, buttons and app menu items.

To test: Run `cefclient --enable-chrome-runtime --filter-chrome-commands`.
Most icons, buttons and app/context menu items will be hidden.
This commit is contained in:
Marshall Greenblatt
2023-03-06 18:21:57 -05:00
parent 06af9c85da
commit 14dd0c0d06
15 changed files with 866 additions and 77 deletions

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bf815bb565ccf2570c6f6b881009fe7df20805f0$
// $hash=7b58140cd5e363a79adf4e420ceae009a7d10811$
//
#include "libcef_dll/cpptoc/command_handler_cpptoc.h"
@ -47,12 +47,114 @@ command_handler_on_chrome_command(struct _cef_command_handler_t* self,
return _retval;
}
int CEF_CALLBACK command_handler_is_chrome_app_menu_item_visible(
struct _cef_command_handler_t* self,
cef_browser_t* browser,
int command_id) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser) {
return 0;
}
// Execute
bool _retval = CefCommandHandlerCppToC::Get(self)->IsChromeAppMenuItemVisible(
CefBrowserCToCpp::Wrap(browser), command_id);
// Return type: bool
return _retval;
}
int CEF_CALLBACK command_handler_is_chrome_app_menu_item_enabled(
struct _cef_command_handler_t* self,
cef_browser_t* browser,
int command_id) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser) {
return 0;
}
// Execute
bool _retval = CefCommandHandlerCppToC::Get(self)->IsChromeAppMenuItemEnabled(
CefBrowserCToCpp::Wrap(browser), command_id);
// Return type: bool
return _retval;
}
int CEF_CALLBACK command_handler_is_chrome_page_action_icon_visible(
struct _cef_command_handler_t* self,
cef_chrome_page_action_icon_type_t icon_type) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Execute
bool _retval =
CefCommandHandlerCppToC::Get(self)->IsChromePageActionIconVisible(
icon_type);
// Return type: bool
return _retval;
}
int CEF_CALLBACK command_handler_is_chrome_toolbar_button_visible(
struct _cef_command_handler_t* self,
cef_chrome_toolbar_button_type_t button_type) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Execute
bool _retval =
CefCommandHandlerCppToC::Get(self)->IsChromeToolbarButtonVisible(
button_type);
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefCommandHandlerCppToC::CefCommandHandlerCppToC() {
GetStruct()->on_chrome_command = command_handler_on_chrome_command;
GetStruct()->is_chrome_app_menu_item_visible =
command_handler_is_chrome_app_menu_item_visible;
GetStruct()->is_chrome_app_menu_item_enabled =
command_handler_is_chrome_app_menu_item_enabled;
GetStruct()->is_chrome_page_action_icon_visible =
command_handler_is_chrome_page_action_icon_visible;
GetStruct()->is_chrome_toolbar_button_visible =
command_handler_is_chrome_toolbar_button_visible;
}
// DESTRUCTOR - Do not edit by hand.