mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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:
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
|
||||
@@ -65,6 +66,32 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if the app menu item should be visible. ID values come from
|
||||
// chrome/app/chrome_command_ids.h.
|
||||
virtual bool IsAppMenuItemVisible(int command_id) { return true; }
|
||||
|
||||
// Return true if the app menu item should be enabled. ID values come from
|
||||
// chrome/app/chrome_command_ids.h.
|
||||
virtual bool IsAppMenuItemEnabled(int command_id) { return true; }
|
||||
|
||||
// Return true if the page action icon should be visible.
|
||||
virtual bool IsPageActionIconVisible(PageActionIconType icon_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
enum class ToolbarButtonType {
|
||||
kCast = 0,
|
||||
kDownload,
|
||||
kSendTabToSelf,
|
||||
kSidePanel,
|
||||
kMaxValue = kSidePanel,
|
||||
};
|
||||
|
||||
// Return true if the toolbar button should be visible.
|
||||
virtual bool IsToolbarButtonVisible(ToolbarButtonType button_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Same as RequestMediaAccessPermission but returning |callback| if the
|
||||
// request is unhandled.
|
||||
[[nodiscard]] virtual content::MediaResponseCallback
|
||||
|
Reference in New Issue
Block a user