From 758d5c23c564ea17cd9ad73b74c963c86ac42855 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 12 Jan 2015 21:04:08 +0000 Subject: [PATCH] Add CefFindHandler for reporting find results (issue #1482). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1969 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef_paths.gypi | 6 ++ include/capi/cef_browser_capi.h | 3 +- include/capi/cef_client_capi.h | 7 +++ include/capi/cef_find_handler_capi.h | 78 ++++++++++++++++++++++++ include/cef_browser.h | 3 +- include/cef_client.h | 9 +++ include/cef_find_handler.h | 68 +++++++++++++++++++++ libcef/browser/browser_host_impl.cc | 18 ++++++ libcef/browser/browser_host_impl.h | 7 +++ libcef_dll/cpptoc/client_cpptoc.cc | 18 ++++++ libcef_dll/cpptoc/find_handler_cpptoc.cc | 62 +++++++++++++++++++ libcef_dll/cpptoc/find_handler_cpptoc.h | 36 +++++++++++ libcef_dll/ctocpp/client_ctocpp.cc | 14 +++++ libcef_dll/ctocpp/client_ctocpp.h | 1 + libcef_dll/ctocpp/find_handler_ctocpp.cc | 47 ++++++++++++++ libcef_dll/ctocpp/find_handler_ctocpp.h | 43 +++++++++++++ libcef_dll/libcef_dll.cc | 2 + libcef_dll/wrapper/libcef_dll_wrapper.cc | 2 + 18 files changed, 422 insertions(+), 2 deletions(-) create mode 100644 include/capi/cef_find_handler_capi.h create mode 100644 include/cef_find_handler.h create mode 100644 libcef_dll/cpptoc/find_handler_cpptoc.cc create mode 100644 libcef_dll/cpptoc/find_handler_cpptoc.h create mode 100644 libcef_dll/ctocpp/find_handler_ctocpp.cc create mode 100644 libcef_dll/ctocpp/find_handler_ctocpp.h diff --git a/cef_paths.gypi b/cef_paths.gypi index ae2276e76..62994f352 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -28,6 +28,7 @@ 'include/cef_download_item.h', 'include/cef_drag_data.h', 'include/cef_drag_handler.h', + 'include/cef_find_handler.h', 'include/cef_focus_handler.h', 'include/cef_frame.h', 'include/cef_geolocation.h', @@ -83,6 +84,7 @@ 'include/capi/cef_download_item_capi.h', 'include/capi/cef_drag_data_capi.h', 'include/capi/cef_drag_handler_capi.h', + 'include/capi/cef_find_handler_capi.h', 'include/capi/cef_focus_handler_capi.h', 'include/capi/cef_frame_capi.h', 'include/capi/cef_geolocation_capi.h', @@ -180,6 +182,8 @@ 'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h', 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc', 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h', + 'libcef_dll/ctocpp/find_handler_ctocpp.cc', + 'libcef_dll/ctocpp/find_handler_ctocpp.h', 'libcef_dll/ctocpp/focus_handler_ctocpp.cc', 'libcef_dll/ctocpp/focus_handler_ctocpp.h', 'libcef_dll/cpptoc/frame_cpptoc.cc', @@ -350,6 +354,8 @@ 'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h', 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc', 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h', + 'libcef_dll/cpptoc/find_handler_cpptoc.cc', + 'libcef_dll/cpptoc/find_handler_cpptoc.h', 'libcef_dll/cpptoc/focus_handler_cpptoc.cc', 'libcef_dll/cpptoc/focus_handler_cpptoc.h', 'libcef_dll/ctocpp/frame_ctocpp.cc', diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index 8dc00ee08..34f71380a 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -344,7 +344,8 @@ typedef struct _cef_browser_host_t { // running simultaniously. |forward| indicates whether to search forward or // backward within the page. |matchCase| indicates whether the search should // be case-sensitive. |findNext| indicates whether this is the first request - // or a follow-up. + // or a follow-up. The cef_find_handler_t instance, if any, returned via + // cef_client_t::GetFindHandler will be called to report find results. /// void (CEF_CALLBACK *find)(struct _cef_browser_host_t* self, int identifier, const cef_string_t* searchText, int forward, int matchCase, diff --git a/include/capi/cef_client_capi.h b/include/capi/cef_client_capi.h index 451da5589..7950152fe 100644 --- a/include/capi/cef_client_capi.h +++ b/include/capi/cef_client_capi.h @@ -44,6 +44,7 @@ #include "include/capi/cef_display_handler_capi.h" #include "include/capi/cef_download_handler_capi.h" #include "include/capi/cef_drag_handler_capi.h" +#include "include/capi/cef_find_handler_capi.h" #include "include/capi/cef_focus_handler_capi.h" #include "include/capi/cef_geolocation_handler_capi.h" #include "include/capi/cef_jsdialog_handler_capi.h" @@ -101,6 +102,12 @@ typedef struct _cef_client_t { struct _cef_drag_handler_t* (CEF_CALLBACK *get_drag_handler)( struct _cef_client_t* self); + /// + // Return the handler for find result events. + /// + struct _cef_find_handler_t* (CEF_CALLBACK *get_find_handler)( + struct _cef_client_t* self); + /// // Return the handler for focus events. /// diff --git a/include/capi/cef_find_handler_capi.h b/include/capi/cef_find_handler_capi.h new file mode 100644 index 000000000..14e15bb86 --- /dev/null +++ b/include/capi/cef_find_handler_capi.h @@ -0,0 +1,78 @@ +// Copyright (c) 2015 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_FIND_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/// +// Implement this structure to handle events related to find results. The +// functions of this structure will be called on the UI thread. +/// +typedef struct _cef_find_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called to report find results returned by cef_browser_host_t::find(). + // |identifer| is the identifier passed to find(), |count| is the number of + // matches currently identified, |selectionRect| is the location of where the + // match was found (in window coordinates), |activeMatchOrdinal| is the + // current position in the search results, and |finalUpdate| is true (1) if + // this is the last find notification. + /// + void (CEF_CALLBACK *on_find_result)(struct _cef_find_handler_t* self, + struct _cef_browser_t* browser, int identifier, int count, + const cef_rect_t* selectionRect, int activeMatchOrdinal, + int finalUpdate); +} cef_find_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ diff --git a/include/cef_browser.h b/include/cef_browser.h index ff2749172..4f7a34449 100644 --- a/include/cef_browser.h +++ b/include/cef_browser.h @@ -388,7 +388,8 @@ class CefBrowserHost : public virtual CefBase { // running simultaniously. |forward| indicates whether to search forward or // backward within the page. |matchCase| indicates whether the search should // be case-sensitive. |findNext| indicates whether this is the first request - // or a follow-up. + // or a follow-up. The CefFindHandler instance, if any, returned via + // CefClient::GetFindHandler will be called to report find results. /// /*--cef()--*/ virtual void Find(int identifier, const CefString& searchText, diff --git a/include/cef_client.h b/include/cef_client.h index d413e0e64..81a67ebae 100644 --- a/include/cef_client.h +++ b/include/cef_client.h @@ -44,6 +44,7 @@ #include "include/cef_display_handler.h" #include "include/cef_download_handler.h" #include "include/cef_drag_handler.h" +#include "include/cef_find_handler.h" #include "include/cef_focus_handler.h" #include "include/cef_geolocation_handler.h" #include "include/cef_jsdialog_handler.h" @@ -103,6 +104,14 @@ class CefClient : public virtual CefBase { return NULL; } + /// + // Return the handler for find result events. + /// + /*--cef()--*/ + virtual CefRefPtr GetFindHandler() { + return NULL; + } + /// // Return the handler for focus events. /// diff --git a/include/cef_find_handler.h b/include/cef_find_handler.h new file mode 100644 index 000000000..410cf5fec --- /dev/null +++ b/include/cef_find_handler.h @@ -0,0 +1,68 @@ +// Copyright (c) 2015 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_FIND_HANDLER_H_ +#define CEF_INCLUDE_CEF_FIND_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" + +/// +// Implement this interface to handle events related to find results. The +// methods of this class will be called on the UI thread. +/// +/*--cef(source=client)--*/ +class CefFindHandler : public virtual CefBase { + public: + /// + // Called to report find results returned by CefBrowserHost::Find(). + // |identifer| is the identifier passed to Find(), |count| is the number of + // matches currently identified, |selectionRect| is the location of where the + // match was found (in window coordinates), |activeMatchOrdinal| is the + // current position in the search results, and |finalUpdate| is true if this + // is the last find notification. + /// + /*--cef()--*/ + virtual void OnFindResult(CefRefPtr browser, + int identifier, + int count, + const CefRect& selectionRect, + int activeMatchOrdinal, + bool finalUpdate) {} +}; + +#endif // CEF_INCLUDE_CEF_FIND_HANDLER_H_ diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 8c8d46181..c91c41c36 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -1780,6 +1780,24 @@ void CefBrowserHostImpl::RunFileChooser( callback)); } +void CefBrowserHostImpl::FindReply( + content::WebContents* web_contents, + int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) { + if (client_.get()) { + CefRefPtr handler = client_->GetFindHandler(); + if (handler.get()) { + CefRect rect(selection_rect.x(), selection_rect.y(), + selection_rect.width(), selection_rect.height()); + handler->OnFindResult(this, request_id, number_of_matches, + rect, active_match_ordinal, final_update); + } + } +} + #if !defined(OS_MACOSX) CefTextInputContext CefBrowserHostImpl::GetNSTextInputContext() { NOTREACHED(); diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index f7620ed83..916bea3ea 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -389,6 +389,13 @@ class CefBrowserHostImpl : public CefBrowserHost, void RunFileChooser( content::WebContents* tab, const content::FileChooserParams& params) override; + void FindReply( + content::WebContents* web_contents, + int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) override; void UpdatePreferredSize(content::WebContents* source, const gfx::Size& pref_size) override; void RequestMediaAccessPermission( diff --git a/libcef_dll/cpptoc/client_cpptoc.cc b/libcef_dll/cpptoc/client_cpptoc.cc index 55a37b821..5d7d4820f 100644 --- a/libcef_dll/cpptoc/client_cpptoc.cc +++ b/libcef_dll/cpptoc/client_cpptoc.cc @@ -16,6 +16,7 @@ #include "libcef_dll/cpptoc/display_handler_cpptoc.h" #include "libcef_dll/cpptoc/download_handler_cpptoc.h" #include "libcef_dll/cpptoc/drag_handler_cpptoc.h" +#include "libcef_dll/cpptoc/find_handler_cpptoc.h" #include "libcef_dll/cpptoc/focus_handler_cpptoc.h" #include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" #include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" @@ -110,6 +111,22 @@ struct _cef_drag_handler_t* CEF_CALLBACK client_get_drag_handler( return CefDragHandlerCppToC::Wrap(_retval); } +struct _cef_find_handler_t* CEF_CALLBACK client_get_find_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)->GetFindHandler(); + + // Return type: refptr_same + return CefFindHandlerCppToC::Wrap(_retval); +} + struct _cef_focus_handler_t* CEF_CALLBACK client_get_focus_handler( struct _cef_client_t* self) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -275,6 +292,7 @@ CefClientCppToC::CefClientCppToC(CefClient* cls) struct_.struct_.get_display_handler = client_get_display_handler; struct_.struct_.get_download_handler = client_get_download_handler; struct_.struct_.get_drag_handler = client_get_drag_handler; + struct_.struct_.get_find_handler = client_get_find_handler; struct_.struct_.get_focus_handler = client_get_focus_handler; struct_.struct_.get_geolocation_handler = client_get_geolocation_handler; struct_.struct_.get_jsdialog_handler = client_get_jsdialog_handler; diff --git a/libcef_dll/cpptoc/find_handler_cpptoc.cc b/libcef_dll/cpptoc/find_handler_cpptoc.cc new file mode 100644 index 000000000..1645c8b47 --- /dev/null +++ b/libcef_dll/cpptoc/find_handler_cpptoc.cc @@ -0,0 +1,62 @@ +// Copyright (c) 2015 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/find_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK find_handler_on_find_result(struct _cef_find_handler_t* self, + cef_browser_t* browser, int identifier, int count, + const cef_rect_t* selectionRect, int activeMatchOrdinal, + int finalUpdate) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: selectionRect; type: simple_byref_const + DCHECK(selectionRect); + if (!selectionRect) + return; + + // Translate param: selectionRect; type: simple_byref_const + CefRect selectionRectVal = selectionRect?*selectionRect:CefRect(); + + // Execute + CefFindHandlerCppToC::Get(self)->OnFindResult( + CefBrowserCToCpp::Wrap(browser), + identifier, + count, + selectionRectVal, + activeMatchOrdinal, + finalUpdate?true:false); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefFindHandlerCppToC::CefFindHandlerCppToC(CefFindHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_find_result = find_handler_on_find_result; +} + +#ifndef NDEBUG +template<> base::AtomicRefCount CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/find_handler_cpptoc.h b/libcef_dll/cpptoc/find_handler_cpptoc.h new file mode 100644 index 000000000..aff1edc46 --- /dev/null +++ b/libcef_dll/cpptoc/find_handler_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2015 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_FIND_HANDLER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_FIND_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_find_handler.h" +#include "include/capi/cef_find_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 CefFindHandlerCppToC + : public CefCppToC { + public: + explicit CefFindHandlerCppToC(CefFindHandler* cls); +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_FIND_HANDLER_CPPTOC_H_ + diff --git a/libcef_dll/ctocpp/client_ctocpp.cc b/libcef_dll/ctocpp/client_ctocpp.cc index 54d101e5c..9a20b35c6 100644 --- a/libcef_dll/ctocpp/client_ctocpp.cc +++ b/libcef_dll/ctocpp/client_ctocpp.cc @@ -18,6 +18,7 @@ #include "libcef_dll/ctocpp/display_handler_ctocpp.h" #include "libcef_dll/ctocpp/download_handler_ctocpp.h" #include "libcef_dll/ctocpp/drag_handler_ctocpp.h" +#include "libcef_dll/ctocpp/find_handler_ctocpp.h" #include "libcef_dll/ctocpp/focus_handler_ctocpp.h" #include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" #include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h" @@ -96,6 +97,19 @@ CefRefPtr CefClientCToCpp::GetDragHandler() { return CefDragHandlerCToCpp::Wrap(_retval); } +CefRefPtr CefClientCToCpp::GetFindHandler() { + if (CEF_MEMBER_MISSING(struct_, get_find_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_find_handler_t* _retval = struct_->get_find_handler(struct_); + + // Return type: refptr_same + return CefFindHandlerCToCpp::Wrap(_retval); +} + CefRefPtr CefClientCToCpp::GetFocusHandler() { if (CEF_MEMBER_MISSING(struct_, get_focus_handler)) return NULL; diff --git a/libcef_dll/ctocpp/client_ctocpp.h b/libcef_dll/ctocpp/client_ctocpp.h index e08e8e7e5..b5dacbe0d 100644 --- a/libcef_dll/ctocpp/client_ctocpp.h +++ b/libcef_dll/ctocpp/client_ctocpp.h @@ -36,6 +36,7 @@ class CefClientCToCpp CefRefPtr GetDisplayHandler() override; CefRefPtr GetDownloadHandler() override; CefRefPtr GetDragHandler() override; + CefRefPtr GetFindHandler() override; CefRefPtr GetFocusHandler() override; CefRefPtr GetGeolocationHandler() override; CefRefPtr GetJSDialogHandler() override; diff --git a/libcef_dll/ctocpp/find_handler_ctocpp.cc b/libcef_dll/ctocpp/find_handler_ctocpp.cc new file mode 100644 index 000000000..55c6641de --- /dev/null +++ b/libcef_dll/ctocpp/find_handler_ctocpp.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2015 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/find_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefFindHandlerCToCpp::OnFindResult(CefRefPtr browser, + int identifier, int count, const CefRect& selectionRect, + int activeMatchOrdinal, bool finalUpdate) { + if (CEF_MEMBER_MISSING(struct_, on_find_result)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_find_result(struct_, + CefBrowserCppToC::Wrap(browser), + identifier, + count, + &selectionRect, + activeMatchOrdinal, + finalUpdate); +} + + +#ifndef NDEBUG +template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/find_handler_ctocpp.h b/libcef_dll/ctocpp/find_handler_ctocpp.h new file mode 100644 index 000000000..401473625 --- /dev/null +++ b/libcef_dll/ctocpp/find_handler_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2015 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_FIND_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_FIND_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_find_handler.h" +#include "include/capi/cef_find_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 CefFindHandlerCToCpp + : public CefCToCpp { + public: + explicit CefFindHandlerCToCpp(cef_find_handler_t* str) + : CefCToCpp( + str) {} + + // CefFindHandler methods + void OnFindResult(CefRefPtr browser, int identifier, int count, + const CefRect& selectionRect, int activeMatchOrdinal, + bool finalUpdate) override; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_FIND_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index d37eedfdb..cde827369 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -83,6 +83,7 @@ #include "libcef_dll/ctocpp/download_handler_ctocpp.h" #include "libcef_dll/ctocpp/drag_handler_ctocpp.h" #include "libcef_dll/ctocpp/end_tracing_callback_ctocpp.h" +#include "libcef_dll/ctocpp/find_handler_ctocpp.h" #include "libcef_dll/ctocpp/focus_handler_ctocpp.h" #include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" #include "libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h" @@ -210,6 +211,7 @@ CEF_EXPORT void cef_shutdown() { DCHECK(base::AtomicRefCountIsZero(&CefDragHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefEndTracingCallbackCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFileDialogCallbackCppToC::DebugObjCt)); + DCHECK(base::AtomicRefCountIsZero(&CefFindHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFocusHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFrameCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefGeolocationCallbackCppToC::DebugObjCt)); diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index 76f8d241f..a3cfa30cf 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -44,6 +44,7 @@ #include "libcef_dll/cpptoc/download_handler_cpptoc.h" #include "libcef_dll/cpptoc/drag_handler_cpptoc.h" #include "libcef_dll/cpptoc/end_tracing_callback_cpptoc.h" +#include "libcef_dll/cpptoc/find_handler_cpptoc.h" #include "libcef_dll/cpptoc/focus_handler_cpptoc.h" #include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" #include "libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h" @@ -202,6 +203,7 @@ CEF_GLOBAL void CefShutdown() { DCHECK(base::AtomicRefCountIsZero(&CefDragHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefEndTracingCallbackCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFileDialogCallbackCToCpp::DebugObjCt)); + DCHECK(base::AtomicRefCountIsZero(&CefFindHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFocusHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFrameCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefGeolocationCallbackCToCpp::DebugObjCt));