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:
@ -51,6 +51,7 @@
|
||||
'include/cef_web_urlrequest.h',
|
||||
'include/cef_xml_reader.h',
|
||||
'include/cef_zip_reader.h',
|
||||
'include/cef_zoom_handler.h',
|
||||
],
|
||||
'autogen_capi_includes': [
|
||||
'include/capi/cef_app_capi.h',
|
||||
@ -92,6 +93,7 @@
|
||||
'include/capi/cef_web_urlrequest_capi.h',
|
||||
'include/capi/cef_xml_reader_capi.h',
|
||||
'include/capi/cef_zip_reader_capi.h',
|
||||
'include/capi/cef_zoom_handler_capi.h',
|
||||
],
|
||||
'autogen_library_side': [
|
||||
'libcef_dll/ctocpp/app_ctocpp.cc',
|
||||
@ -208,6 +210,8 @@
|
||||
'libcef_dll/cpptoc/xml_reader_cpptoc.h',
|
||||
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/zip_reader_cpptoc.h',
|
||||
'libcef_dll/ctocpp/zoom_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/zoom_handler_ctocpp.h',
|
||||
],
|
||||
'autogen_client_side': [
|
||||
'libcef_dll/cpptoc/app_cpptoc.cc',
|
||||
@ -324,6 +328,8 @@
|
||||
'libcef_dll/ctocpp/xml_reader_ctocpp.h',
|
||||
'libcef_dll/ctocpp/zip_reader_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/zip_reader_ctocpp.h',
|
||||
'libcef_dll/cpptoc/zoom_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/zoom_handler_cpptoc.h',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
@ -144,6 +144,13 @@ typedef struct _cef_client_t {
|
||||
///
|
||||
struct _cef_geolocation_handler_t* (CEF_CALLBACK *get_geolocation_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for zoom events. If no handler is provided the default
|
||||
// zoom behavior will be used.
|
||||
///
|
||||
struct _cef_zoom_handler_t* (CEF_CALLBACK *get_zoom_handler)(
|
||||
struct _cef_client_t* self);
|
||||
} cef_client_t;
|
||||
|
||||
|
||||
|
83
cef1/include/capi/cef_zoom_handler_capi.h
Normal file
83
cef1/include/capi/cef_zoom_handler_capi.h
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_ZOOM_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_ZOOM_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
|
||||
///
|
||||
// Implement this structure to customize zoom handling. The functions of this
|
||||
// structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_zoom_handler_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Called when the browser wants to retrieve the zoom level for the given
|
||||
// |url|. Return true (1) if |zoomLevel| has been set to the custom zoom
|
||||
// level. Return false (0) for the browser's default zoom handling behavior.
|
||||
///
|
||||
int (CEF_CALLBACK *on_get_zoom_level)(struct _cef_zoom_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* url,
|
||||
double* zoomLevel);
|
||||
|
||||
///
|
||||
// Called when the browser's zoom level has been set to |zoomLevel| for the
|
||||
// given |url|. Return true (1) to indicate that the new setting has been
|
||||
// handled. Return false (0) to use the browser's default zoom handling
|
||||
// behavior.
|
||||
///
|
||||
int (CEF_CALLBACK *on_set_zoom_level)(struct _cef_zoom_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* url,
|
||||
double zoomLevel);
|
||||
} cef_zoom_handler_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_ZOOM_HANDLER_CAPI_H_
|
@ -54,6 +54,7 @@
|
||||
#include "include/cef_render_handler.h"
|
||||
#include "include/cef_request_handler.h"
|
||||
#include "include/cef_v8context_handler.h"
|
||||
#include "include/cef_zoom_handler.h"
|
||||
|
||||
///
|
||||
// Implement this interface to provide handler implementations.
|
||||
@ -181,6 +182,15 @@ class CefClient : public virtual CefBase {
|
||||
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Return the handler for zoom events. If no handler is provided the default
|
||||
// zoom behavior will be used.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefZoomHandler> GetZoomHandler() {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_CLIENT_H_
|
||||
|
72
cef1/include/cef_zoom_handler.h
Normal file
72
cef1/include/cef_zoom_handler.h
Normal file
@ -0,0 +1,72 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_ZOOM_HANDLER_H_
|
||||
#define CEF_INCLUDE_CEF_ZOOM_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
|
||||
///
|
||||
// Implement this interface to customize zoom handling. The methods of this
|
||||
// class will be called on the UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefZoomHandler : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Called when the browser wants to retrieve the zoom level for the given
|
||||
// |url|. Return true if |zoomLevel| has been set to the custom zoom level.
|
||||
// Return false for the browser's default zoom handling behavior.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnGetZoomLevel(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
double& zoomLevel) { return false; }
|
||||
|
||||
///
|
||||
// Called when the browser's zoom level has been set to |zoomLevel| for the
|
||||
// given |url|. Return true to indicate that the new setting has been handled.
|
||||
// Return false to use the browser's default zoom handling behavior.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnSetZoomLevel(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
double zoomLevel) { return false; }
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_ZOOM_HANDLER_H_
|
@ -1465,8 +1465,16 @@ void CefBrowserImpl::UIT_SetZoomLevel(double zoomLevel) {
|
||||
REQUIRE_UIT();
|
||||
WebKit::WebFrame* web_frame = UIT_GetMainWebFrame();
|
||||
if (web_frame) {
|
||||
GURL url = web_frame->document().url();
|
||||
web_frame->view()->setZoomLevel(false, zoomLevel);
|
||||
ZoomMap::GetInstance()->set(web_frame->document().url(), zoomLevel);
|
||||
bool didHandleZoom = false;
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefZoomHandler> handler = client_->GetZoomHandler();
|
||||
if (handler.get())
|
||||
didHandleZoom = handler->OnSetZoomLevel(this, url.spec(), zoomLevel);
|
||||
}
|
||||
if (!didHandleZoom)
|
||||
ZoomMap::GetInstance()->set(url, zoomLevel);
|
||||
set_zoom_level(zoomLevel);
|
||||
}
|
||||
}
|
||||
|
@ -909,8 +909,21 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
||||
// Apply zoom settings only on top-level frames.
|
||||
if (is_main_frame) {
|
||||
// Restore the zoom value that we have for this URL, if any.
|
||||
GURL url = frame->document().url();
|
||||
double zoomLevel = 0.0;
|
||||
ZoomMap::GetInstance()->get(frame->document().url(), zoomLevel);
|
||||
bool didGetCustomZoom = false;
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefZoomHandler> handler = client->GetZoomHandler();
|
||||
if (handler.get()) {
|
||||
double newZoomLevel = zoomLevel;
|
||||
didGetCustomZoom =
|
||||
handler->OnGetZoomLevel(browser_, url.spec(), newZoomLevel);
|
||||
if (didGetCustomZoom)
|
||||
zoomLevel = newZoomLevel;
|
||||
}
|
||||
}
|
||||
if (!didGetCustomZoom)
|
||||
ZoomMap::GetInstance()->get(url, zoomLevel);
|
||||
frame->view()->setZoomLevel(false, zoomLevel);
|
||||
browser_->set_zoom_level(zoomLevel);
|
||||
}
|
||||
|
@ -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_
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8context_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/zoom_handler_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
@ -226,6 +227,19 @@ CefRefPtr<CefGeolocationHandler> CefClientCToCpp::GetGeolocationHandler() {
|
||||
return CefGeolocationHandlerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
CefRefPtr<CefZoomHandler> CefClientCToCpp::GetZoomHandler() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_zoom_handler))
|
||||
return NULL;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_zoom_handler_t* _retval = struct_->get_zoom_handler(struct_);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefZoomHandlerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefClientCToCpp, CefClient,
|
||||
|
@ -47,6 +47,7 @@ class CefClientCToCpp
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefZoomHandler> GetZoomHandler() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
76
cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.cc
Normal file
76
cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.cc
Normal file
@ -0,0 +1,76 @@
|
||||
// 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/browser_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/zoom_handler_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
bool CefZoomHandlerCToCpp::OnGetZoomLevel(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, double& zoomLevel) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_get_zoom_level))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: url; type: string_byref_const
|
||||
DCHECK(!url.empty());
|
||||
if (url.empty())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_get_zoom_level(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
url.GetStruct(),
|
||||
&zoomLevel);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefZoomHandlerCToCpp::OnSetZoomLevel(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, double zoomLevel) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_set_zoom_level))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: url; type: string_byref_const
|
||||
DCHECK(!url.empty());
|
||||
if (url.empty())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_set_zoom_level(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
url.GetStruct(),
|
||||
zoomLevel);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefZoomHandlerCToCpp, CefZoomHandler,
|
||||
cef_zoom_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
45
cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.h
Normal file
45
cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.h
Normal file
@ -0,0 +1,45 @@
|
||||
// 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_CTOCPP_ZOOM_HANDLER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_ZOOM_HANDLER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#ifndef BUILDING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||
#else // BUILDING_CEF_SHARED
|
||||
|
||||
#include "include/cef_zoom_handler.h"
|
||||
#include "include/capi/cef_zoom_handler_capi.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefZoomHandlerCToCpp
|
||||
: public CefCToCpp<CefZoomHandlerCToCpp, CefZoomHandler,
|
||||
cef_zoom_handler_t> {
|
||||
public:
|
||||
explicit CefZoomHandlerCToCpp(cef_zoom_handler_t* str)
|
||||
: CefCToCpp<CefZoomHandlerCToCpp, CefZoomHandler, cef_zoom_handler_t>(
|
||||
str) {}
|
||||
virtual ~CefZoomHandlerCToCpp() {}
|
||||
|
||||
// CefZoomHandler methods
|
||||
virtual bool OnGetZoomLevel(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, double& zoomLevel) OVERRIDE;
|
||||
virtual bool OnSetZoomLevel(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, double zoomLevel) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_ZOOM_HANDLER_CTOCPP_H_
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/web_urlrequest_client_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/write_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/zoom_handler_ctocpp.h"
|
||||
|
||||
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
@ -169,6 +170,7 @@ CEF_EXPORT void cef_shutdown() {
|
||||
DCHECK_EQ(CefWriteHandlerCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefXmlReaderCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefZipReaderCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefZoomHandlerCToCpp::DebugObjCt, 0);
|
||||
#endif // !NDEBUG
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/write_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/zoom_handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/domdocument_ctocpp.h"
|
||||
@ -171,6 +172,7 @@ CEF_GLOBAL void CefShutdown() {
|
||||
DCHECK_EQ(CefWriteHandlerCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefXmlReaderCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefZipReaderCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefZoomHandlerCppToC::DebugObjCt, 0);
|
||||
#endif // !NDEBUG
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user