mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefZoomHandler interface to support custom zoom handling (issue #733).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@824 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8context_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/zoom_handler_cpptoc.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
@ -270,6 +271,22 @@ struct _cef_geolocation_handler_t* CEF_CALLBACK client_get_geolocation_handler(
|
||||
return CefGeolocationHandlerCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
struct _cef_zoom_handler_t* CEF_CALLBACK client_get_zoom_handler(
|
||||
struct _cef_client_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefZoomHandler> _retval = CefClientCppToC::Get(
|
||||
self)->GetZoomHandler();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefZoomHandlerCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
@ -290,6 +307,7 @@ CefClientCppToC::CefClientCppToC(CefClient* cls)
|
||||
struct_.struct_.get_render_handler = client_get_render_handler;
|
||||
struct_.struct_.get_drag_handler = client_get_drag_handler;
|
||||
struct_.struct_.get_geolocation_handler = client_get_geolocation_handler;
|
||||
struct_.struct_.get_zoom_handler = client_get_zoom_handler;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
97
cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.cc
Normal file
97
cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.cc
Normal file
@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/zoom_handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
int CEF_CALLBACK zoom_handler_on_get_zoom_level(
|
||||
struct _cef_zoom_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* url, double* zoomLevel) {
|
||||
// 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;
|
||||
// Verify param: url; type: string_byref_const
|
||||
DCHECK(url);
|
||||
if (!url)
|
||||
return 0;
|
||||
// Verify param: zoomLevel; type: simple_byref
|
||||
DCHECK(zoomLevel);
|
||||
if (!zoomLevel)
|
||||
return 0;
|
||||
|
||||
// Translate param: zoomLevel; type: simple_byref
|
||||
double zoomLevelVal = zoomLevel?*zoomLevel:0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefZoomHandlerCppToC::Get(self)->OnGetZoomLevel(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(url),
|
||||
zoomLevelVal);
|
||||
|
||||
// Restore param: zoomLevel; type: simple_byref
|
||||
if (zoomLevel)
|
||||
*zoomLevel = zoomLevelVal;
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK zoom_handler_on_set_zoom_level(
|
||||
struct _cef_zoom_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* url, double zoomLevel) {
|
||||
// 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;
|
||||
// Verify param: url; type: string_byref_const
|
||||
DCHECK(url);
|
||||
if (!url)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefZoomHandlerCppToC::Get(self)->OnSetZoomLevel(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(url),
|
||||
zoomLevel);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefZoomHandlerCppToC::CefZoomHandlerCppToC(CefZoomHandler* cls)
|
||||
: CefCppToC<CefZoomHandlerCppToC, CefZoomHandler, cef_zoom_handler_t>(cls) {
|
||||
struct_.struct_.on_get_zoom_level = zoom_handler_on_get_zoom_level;
|
||||
struct_.struct_.on_set_zoom_level = zoom_handler_on_set_zoom_level;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefZoomHandlerCppToC, CefZoomHandler,
|
||||
cef_zoom_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
37
cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.h
Normal file
37
cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.h
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_ZOOM_HANDLER_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_ZOOM_HANDLER_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#ifndef USING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||
#else // USING_CEF_SHARED
|
||||
|
||||
#include "include/cef_zoom_handler.h"
|
||||
#include "include/capi/cef_zoom_handler_capi.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefZoomHandlerCppToC
|
||||
: public CefCppToC<CefZoomHandlerCppToC, CefZoomHandler,
|
||||
cef_zoom_handler_t> {
|
||||
public:
|
||||
explicit CefZoomHandlerCppToC(CefZoomHandler* cls);
|
||||
virtual ~CefZoomHandlerCppToC() {}
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_ZOOM_HANDLER_CPPTOC_H_
|
||||
|
Reference in New Issue
Block a user