alloy: views: mac: Add three-finger-swipe navigation gesture support

This adds support for the three-finger-swipe navigation gesture with
Alloy/Views. The default implementation matches the Chrome runtime
and navigates the browser back/forward. We also add an Alloy/Views-
specific client callback in CefBrowserViewDelegate for optional
custom handling of the gesture event.
This commit is contained in:
Nik Pavlov
2023-05-26 09:05:33 +00:00
committed by Marshall Greenblatt
parent 29b5999fd7
commit eb63f9e7ae
11 changed files with 145 additions and 8 deletions

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1b695e1b06a8ba626073b4a610d47c5a931a4735$
// $hash=4bffd98075025b4d02063698dbec87e9b9a31597$
//
#include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
@ -184,6 +184,32 @@ browser_view_delegate_get_chrome_toolbar_type(
return _retval;
}
int CEF_CALLBACK browser_view_delegate_on_gesture_command(
struct _cef_browser_view_delegate_t* self,
cef_browser_view_t* browser_view,
cef_gesture_command_t gesture_command) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: browser_view; type: refptr_diff
DCHECK(browser_view);
if (!browser_view) {
return 0;
}
// Execute
bool _retval = CefBrowserViewDelegateCppToC::Get(self)->OnGestureCommand(
CefBrowserViewCToCpp::Wrap(browser_view), gesture_command);
// Return type: bool
return _retval;
}
cef_size_t CEF_CALLBACK
browser_view_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
cef_view_t* view) {
@ -467,6 +493,7 @@ CefBrowserViewDelegateCppToC::CefBrowserViewDelegateCppToC() {
browser_view_delegate_on_popup_browser_view_created;
GetStruct()->get_chrome_toolbar_type =
browser_view_delegate_get_chrome_toolbar_type;
GetStruct()->on_gesture_command = browser_view_delegate_on_gesture_command;
GetStruct()->base.get_preferred_size =
browser_view_delegate_get_preferred_size;
GetStruct()->base.get_minimum_size = browser_view_delegate_get_minimum_size;