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:
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=683d7bff8da04826eee83c7e23cf9c5a701ae265$
|
||||
// $hash=db4fce1215cb4f69346ef2d048974ba34187b2b1$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -365,16 +365,39 @@ typedef struct _cef_browser_host_t {
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Get the current zoom level. The default zoom level is 0.0. This function
|
||||
/// can only be called on the UI thread.
|
||||
/// Returns true (1) if this browser can execute the specified zoom command.
|
||||
/// This function can only be called on the UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* can_zoom)(struct _cef_browser_host_t* self,
|
||||
cef_zoom_command_t command);
|
||||
|
||||
///
|
||||
/// Execute a zoom command in this browser. If called on the UI thread the
|
||||
/// change will be applied immediately. Otherwise, the change will be applied
|
||||
/// asynchronously on the UI thread.
|
||||
///
|
||||
void(CEF_CALLBACK* zoom)(struct _cef_browser_host_t* self,
|
||||
cef_zoom_command_t command);
|
||||
|
||||
///
|
||||
/// Get the default zoom level. This value will be 0.0 by default but can be
|
||||
/// configured with the Chrome runtime. This function can only be called on
|
||||
/// the UI thread.
|
||||
///
|
||||
double(CEF_CALLBACK* get_default_zoom_level)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Get the current zoom level. This function can only be called on the UI
|
||||
/// thread.
|
||||
///
|
||||
double(CEF_CALLBACK* get_zoom_level)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Change the zoom level to the specified value. Specify 0.0 to reset the
|
||||
/// zoom level. If called on the UI thread the change will be applied
|
||||
/// immediately. Otherwise, the change will be applied asynchronously on the
|
||||
/// UI thread.
|
||||
/// zoom level to the default. If called on the UI thread the change will be
|
||||
/// applied immediately. Otherwise, the change will be applied asynchronously
|
||||
/// on the UI thread.
|
||||
///
|
||||
void(CEF_CALLBACK* set_zoom_level)(struct _cef_browser_host_t* self,
|
||||
double zoomLevel);
|
||||
|
@@ -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 "fb95812349ecedc56374e2d195b4af712f6f9ab3"
|
||||
#define CEF_API_HASH_UNIVERSAL "abeac9ee5411570f5e39d9242cba575a19439f86"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "4b12d27bf02871c32719580c1be18d686e20bc84"
|
||||
#define CEF_API_HASH_PLATFORM "85fba672bea98e3687ccfc28c4a509ca70240990"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "e6b30ef107ccb6ba9af40bd6498ad4cef247a171"
|
||||
#define CEF_API_HASH_PLATFORM "3c960598536b6e112d3857d19d01f05e49474f86"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "a4ec73cc821ea2d1681c7f8271f0a7d3e3cea33a"
|
||||
#define CEF_API_HASH_PLATFORM "821845ef5f7ea8618f7425a4096702205f4b346b"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -396,17 +396,40 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
virtual CefRefPtr<CefRequestContext> GetRequestContext() = 0;
|
||||
|
||||
///
|
||||
/// Get the current zoom level. The default zoom level is 0.0. This method can
|
||||
/// only be called on the UI thread.
|
||||
/// Returns true if this browser can execute the specified zoom command. This
|
||||
/// method can only be called on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanZoom(cef_zoom_command_t command) = 0;
|
||||
|
||||
///
|
||||
/// Execute a zoom command in this browser. If called on the UI thread the
|
||||
/// change will be applied immediately. Otherwise, the change will be applied
|
||||
/// asynchronously on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Zoom(cef_zoom_command_t command) = 0;
|
||||
|
||||
///
|
||||
/// Get the default zoom level. This value will be 0.0 by default but can be
|
||||
/// configured with the Chrome runtime. This method can only be called on the
|
||||
/// UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual double GetDefaultZoomLevel() = 0;
|
||||
|
||||
///
|
||||
/// Get the current zoom level. This method can only be called on the UI
|
||||
/// thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual double GetZoomLevel() = 0;
|
||||
|
||||
///
|
||||
/// Change the zoom level to the specified value. Specify 0.0 to reset the
|
||||
/// zoom level. If called on the UI thread the change will be applied
|
||||
/// immediately. Otherwise, the change will be applied asynchronously on the
|
||||
/// UI thread.
|
||||
/// zoom level to the default. If called on the UI thread the change will be
|
||||
/// applied immediately. Otherwise, the change will be applied asynchronously
|
||||
/// on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetZoomLevel(double zoomLevel) = 0;
|
||||
|
@@ -687,6 +687,12 @@ typedef struct _cef_browser_settings_t {
|
||||
/// https://www.chromium.org/user-experience/status-bubble/
|
||||
///
|
||||
cef_state_t chrome_status_bubble;
|
||||
|
||||
///
|
||||
/// Controls whether the Chrome zoom bubble will be shown when zooming. Only
|
||||
/// supported with the Chrome runtime.
|
||||
///
|
||||
cef_state_t chrome_zoom_bubble;
|
||||
} cef_browser_settings_t;
|
||||
|
||||
///
|
||||
@@ -3660,6 +3666,15 @@ typedef enum {
|
||||
CEF_GESTURE_COMMAND_FORWARD,
|
||||
} cef_gesture_command_t;
|
||||
|
||||
///
|
||||
/// Specifies the zoom commands supported by CefBrowserHost::Zoom.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_ZOOM_COMMAND_OUT,
|
||||
CEF_ZOOM_COMMAND_RESET,
|
||||
CEF_ZOOM_COMMAND_IN,
|
||||
} cef_zoom_command_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -541,6 +541,7 @@ struct CefBrowserSettingsTraits {
|
||||
&target->accept_language_list, copy);
|
||||
|
||||
target->chrome_status_bubble = src->chrome_status_bubble;
|
||||
target->chrome_zoom_bubble = src->chrome_zoom_bubble;
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user