mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add new CanZoom/Zoom API (fixes #3284)
Add a simpler CanZoom/Zoom API as an alternative to the more error-prone SetZoomLevel/GetZoomLevel API. Both APIs are now implemented for both runtimes. With the Chrome runtime a zoom notification bubble will be displayed unless CefBrowserSettings.chrome_zoom_bubble is set to STATE_DISABLED. To test: - Run cefclient and select zoom entries from the Tests menu. - chrome: Run cefclient with `--hide-chrome-bubbles` command-line flag to hide the zoom notification bubble.
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=6a2ebf843d929371a15e34792b6900c0ab622877$
|
||||
// $hash=497607653318fe0245cbe18c8911e39867e16249$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
|
||||
@ -298,6 +298,57 @@ browser_host_get_request_context(struct _cef_browser_host_t* self) {
|
||||
return CefRequestContextCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK browser_host_can_zoom(struct _cef_browser_host_t* self,
|
||||
cef_zoom_command_t command) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserHostCppToC::Get(self)->CanZoom(command);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_zoom(struct _cef_browser_host_t* self,
|
||||
cef_zoom_command_t command) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->Zoom(command);
|
||||
}
|
||||
|
||||
double CEF_CALLBACK
|
||||
browser_host_get_default_zoom_level(struct _cef_browser_host_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
double _retval = CefBrowserHostCppToC::Get(self)->GetDefaultZoomLevel();
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
double CEF_CALLBACK
|
||||
browser_host_get_zoom_level(struct _cef_browser_host_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
@ -1398,6 +1449,9 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
|
||||
GetStruct()->has_view = browser_host_has_view;
|
||||
GetStruct()->get_client = browser_host_get_client;
|
||||
GetStruct()->get_request_context = browser_host_get_request_context;
|
||||
GetStruct()->can_zoom = browser_host_can_zoom;
|
||||
GetStruct()->zoom = browser_host_zoom;
|
||||
GetStruct()->get_default_zoom_level = browser_host_get_default_zoom_level;
|
||||
GetStruct()->get_zoom_level = browser_host_get_zoom_level;
|
||||
GetStruct()->set_zoom_level = browser_host_set_zoom_level;
|
||||
GetStruct()->run_file_dialog = browser_host_run_file_dialog;
|
||||
|
Reference in New Issue
Block a user