diff --git a/cef1/cef_paths.gypi b/cef1/cef_paths.gypi index 632d06272..e06a9acb6 100644 --- a/cef1/cef_paths.gypi +++ b/cef1/cef_paths.gypi @@ -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', ], }, } diff --git a/cef1/include/capi/cef_client_capi.h b/cef1/include/capi/cef_client_capi.h index 896612a9c..8eaecef72 100644 --- a/cef1/include/capi/cef_client_capi.h +++ b/cef1/include/capi/cef_client_capi.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; diff --git a/cef1/include/capi/cef_zoom_handler_capi.h b/cef1/include/capi/cef_zoom_handler_capi.h new file mode 100644 index 000000000..5661e3330 --- /dev/null +++ b/cef1/include/capi/cef_zoom_handler_capi.h @@ -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_ diff --git a/cef1/include/cef_client.h b/cef1/include/cef_client.h index e13adf27e..0a93a3c1c 100644 --- a/cef1/include/cef_client.h +++ b/cef1/include/cef_client.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 GetGeolocationHandler() { return NULL; } + + /// + // Return the handler for zoom events. If no handler is provided the default + // zoom behavior will be used. + /// + /*--cef()--*/ + virtual CefRefPtr GetZoomHandler() { + return NULL; + } }; #endif // CEF_INCLUDE_CEF_CLIENT_H_ diff --git a/cef1/include/cef_zoom_handler.h b/cef1/include/cef_zoom_handler.h new file mode 100644 index 000000000..7062b64b7 --- /dev/null +++ b/cef1/include/cef_zoom_handler.h @@ -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 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 browser, + const CefString& url, + double zoomLevel) { return false; } +}; + +#endif // CEF_INCLUDE_CEF_ZOOM_HANDLER_H_ diff --git a/cef1/libcef/browser_impl.cc b/cef1/libcef/browser_impl.cc index b410c09e5..d80bd9103 100644 --- a/cef1/libcef/browser_impl.cc +++ b/cef1/libcef/browser_impl.cc @@ -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 handler = client_->GetZoomHandler(); + if (handler.get()) + didHandleZoom = handler->OnSetZoomLevel(this, url.spec(), zoomLevel); + } + if (!didHandleZoom) + ZoomMap::GetInstance()->set(url, zoomLevel); set_zoom_level(zoomLevel); } } diff --git a/cef1/libcef/browser_webview_delegate.cc b/cef1/libcef/browser_webview_delegate.cc index 709cb35f1..b09046a86 100644 --- a/cef1/libcef/browser_webview_delegate.cc +++ b/cef1/libcef/browser_webview_delegate.cc @@ -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 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); } diff --git a/cef1/libcef_dll/cpptoc/client_cpptoc.cc b/cef1/libcef_dll/cpptoc/client_cpptoc.cc index 7d9a0c02a..e15819503 100644 --- a/cef1/libcef_dll/cpptoc/client_cpptoc.cc +++ b/cef1/libcef_dll/cpptoc/client_cpptoc.cc @@ -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 _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 diff --git a/cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.cc b/cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.cc new file mode 100644 index 000000000..30753d037 --- /dev/null +++ b/cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.cc @@ -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(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::DebugObjCt = 0; +#endif + diff --git a/cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.h b/cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.h new file mode 100644 index 000000000..2187d4e0e --- /dev/null +++ b/cef1/libcef_dll/cpptoc/zoom_handler_cpptoc.h @@ -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 { + public: + explicit CefZoomHandlerCppToC(CefZoomHandler* cls); + virtual ~CefZoomHandlerCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_ZOOM_HANDLER_CPPTOC_H_ + diff --git a/cef1/libcef_dll/ctocpp/client_ctocpp.cc b/cef1/libcef_dll/ctocpp/client_ctocpp.cc index fcbd3abbd..7cd971d6a 100644 --- a/cef1/libcef_dll/ctocpp/client_ctocpp.cc +++ b/cef1/libcef_dll/ctocpp/client_ctocpp.cc @@ -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 CefClientCToCpp::GetGeolocationHandler() { return CefGeolocationHandlerCToCpp::Wrap(_retval); } +CefRefPtr 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 GetRenderHandler() OVERRIDE; virtual CefRefPtr GetDragHandler() OVERRIDE; virtual CefRefPtr GetGeolocationHandler() OVERRIDE; + virtual CefRefPtr GetZoomHandler() OVERRIDE; }; #endif // BUILDING_CEF_SHARED diff --git a/cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.cc b/cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.cc new file mode 100644 index 000000000..3cf82374c --- /dev/null +++ b/cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.cc @@ -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 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 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::DebugObjCt = 0; +#endif + diff --git a/cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.h b/cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.h new file mode 100644 index 000000000..077be537f --- /dev/null +++ b/cef1/libcef_dll/ctocpp/zoom_handler_ctocpp.h @@ -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 { + public: + explicit CefZoomHandlerCToCpp(cef_zoom_handler_t* str) + : CefCToCpp( + str) {} + virtual ~CefZoomHandlerCToCpp() {} + + // CefZoomHandler methods + virtual bool OnGetZoomLevel(CefRefPtr browser, + const CefString& url, double& zoomLevel) OVERRIDE; + virtual bool OnSetZoomLevel(CefRefPtr browser, + const CefString& url, double zoomLevel) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_ZOOM_HANDLER_CTOCPP_H_ + diff --git a/cef1/libcef_dll/libcef_dll.cc b/cef1/libcef_dll/libcef_dll.cc index a849f66be..4a6ffe296 100644 --- a/cef1/libcef_dll/libcef_dll.cc +++ b/cef1/libcef_dll/libcef_dll.cc @@ -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 } diff --git a/cef1/libcef_dll/wrapper/libcef_dll_wrapper.cc b/cef1/libcef_dll/wrapper/libcef_dll_wrapper.cc index 22fdf3737..ab31b7c85 100644 --- a/cef1/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/cef1/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -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 }