From 41b64e428ca1cbb04870b2f656e0eb85e3a559e3 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 27 Sep 2021 10:50:07 +0300 Subject: [PATCH] Rename SendFocusEvent to SetFocus (fixes issue #866) Also removes CefBrowserHost::SendFocusEvent. Use the existing SetFocus method instead. --- include/capi/cef_browser_capi.h | 8 +------- include/cef_api_hash.h | 8 ++++---- include/cef_browser.h | 6 ------ .../browser/alloy/alloy_browser_host_impl.cc | 8 ++------ .../browser/alloy/alloy_browser_host_impl.h | 1 - libcef/browser/browser_platform_delegate.cc | 2 +- libcef/browser/browser_platform_delegate.h | 2 +- .../chrome/chrome_browser_host_impl.cc | 4 ---- .../browser/chrome/chrome_browser_host_impl.h | 1 - .../browser_platform_delegate_background.cc | 2 +- .../browser_platform_delegate_background.h | 2 +- .../browser_platform_delegate_native_linux.cc | 2 +- .../browser_platform_delegate_native_linux.h | 2 +- .../browser_platform_delegate_native_mac.h | 2 +- .../browser_platform_delegate_native_mac.mm | 2 +- .../browser_platform_delegate_native_win.cc | 2 +- .../browser_platform_delegate_native_win.h | 2 +- .../osr/browser_platform_delegate_osr.cc | 4 ++-- .../osr/browser_platform_delegate_osr.h | 2 +- .../osr/render_widget_host_view_osr.cc | 2 +- .../browser/osr/render_widget_host_view_osr.h | 2 +- .../views/browser_platform_delegate_views.cc | 2 +- .../views/browser_platform_delegate_views.h | 2 +- libcef_dll/cpptoc/browser_host_cpptoc.cc | 17 +--------------- libcef_dll/ctocpp/browser_host_ctocpp.cc | 20 +++---------------- libcef_dll/ctocpp/browser_host_ctocpp.h | 3 +-- .../browser/browser_window_osr_gtk.cc | 6 +++--- .../browser/browser_window_osr_mac.mm | 8 ++++---- tests/cefclient/browser/osr_window_win.cc | 6 +++--- tests/ceftests/os_rendering_unittest.cc | 8 ++++---- 30 files changed, 43 insertions(+), 95 deletions(-) diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index e4661b997..5bb7fefa4 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=6e192c6e8a59c37e98e458578a287dd36b8ed90f$ +// $hash=b83b96e2b90124bba8084e2df7f66cc6749df872$ // #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ @@ -681,12 +681,6 @@ typedef struct _cef_browser_host_t { void(CEF_CALLBACK* send_touch_event)(struct _cef_browser_host_t* self, const struct _cef_touch_event_t* event); - /// - // Send a focus event to the browser. - /// - void(CEF_CALLBACK* send_focus_event)(struct _cef_browser_host_t* self, - int setFocus); - /// // Send a capture lost event to the browser. /// diff --git a/include/cef_api_hash.h b/include/cef_api_hash.h index 5721d0f07..96ab62d66 100644 --- a/include/cef_api_hash.h +++ b/include/cef_api_hash.h @@ -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 "6198f526f7dcccda1b66b81826ac030c1f76fd15" +#define CEF_API_HASH_UNIVERSAL "1e47eac2e964bf96bdbe3b0d358f28d7a2057f51" #if defined(OS_WIN) -#define CEF_API_HASH_PLATFORM "7b514a69fd70f75f8a7ddba848136a9cdd8182d4" +#define CEF_API_HASH_PLATFORM "f66e7db3f60e0ed5dd389277c9351c31ee71752b" #elif defined(OS_MAC) -#define CEF_API_HASH_PLATFORM "e33e34f6268be00c7eb4a69bdc97d6f5f3bc6154" +#define CEF_API_HASH_PLATFORM "1911de75fc8837d4bf9dbab275406ca2b284be69" #elif defined(OS_LINUX) -#define CEF_API_HASH_PLATFORM "edbea2dd852cfcf63a0f57d7495e5d69e87f0052" +#define CEF_API_HASH_PLATFORM "2aecfcaaf2e017e4b56c38ab814b6d9b29b584e6" #endif #ifdef __cplusplus diff --git a/include/cef_browser.h b/include/cef_browser.h index 303937434..0a31de81c 100644 --- a/include/cef_browser.h +++ b/include/cef_browser.h @@ -708,12 +708,6 @@ class CefBrowserHost : public virtual CefBaseRefCounted { /*--cef()--*/ virtual void SendTouchEvent(const CefTouchEvent& event) = 0; - /// - // Send a focus event to the browser. - /// - /*--cef()--*/ - virtual void SendFocusEvent(bool setFocus) = 0; - /// // Send a capture lost event to the browser. /// diff --git a/libcef/browser/alloy/alloy_browser_host_impl.cc b/libcef/browser/alloy/alloy_browser_host_impl.cc index f2a8988c7..9f3762066 100644 --- a/libcef/browser/alloy/alloy_browser_host_impl.cc +++ b/libcef/browser/alloy/alloy_browser_host_impl.cc @@ -365,7 +365,7 @@ void AlloyBrowserHostImpl::SetFocusInternal(bool focus) { if (focus) OnSetFocus(FOCUS_SOURCE_SYSTEM); else if (platform_delegate_) - platform_delegate_->SendFocusEvent(false); + platform_delegate_->SetFocus(false); } CefWindowHandle AlloyBrowserHostImpl::GetWindowHandle() { @@ -653,10 +653,6 @@ void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) { platform_delegate_->SendTouchEvent(event); } -void AlloyBrowserHostImpl::SendFocusEvent(bool setFocus) { - SetFocus(setFocus); -} - void AlloyBrowserHostImpl::SendCaptureLostEvent() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( @@ -818,7 +814,7 @@ void AlloyBrowserHostImpl::OnSetFocus(cef_focus_source_t source) { return; if (platform_delegate_) - platform_delegate_->SendFocusEvent(true); + platform_delegate_->SetFocus(true); } void AlloyBrowserHostImpl::RunFileChooser( diff --git a/libcef/browser/alloy/alloy_browser_host_impl.h b/libcef/browser/alloy/alloy_browser_host_impl.h index 216be88db..1a46d996b 100644 --- a/libcef/browser/alloy/alloy_browser_host_impl.h +++ b/libcef/browser/alloy/alloy_browser_host_impl.h @@ -113,7 +113,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, void Invalidate(PaintElementType type) override; void SendExternalBeginFrame() override; void SendTouchEvent(const CefTouchEvent& event) override; - void SendFocusEvent(bool setFocus) override; void SendCaptureLostEvent() override; void NotifyMoveOrResizeStarted() override; int GetWindowlessFrameRate() override; diff --git a/libcef/browser/browser_platform_delegate.cc b/libcef/browser/browser_platform_delegate.cc index ad0df5b11..ae52eee4c 100644 --- a/libcef/browser/browser_platform_delegate.cc +++ b/libcef/browser/browser_platform_delegate.cc @@ -172,7 +172,7 @@ void CefBrowserPlatformDelegate::SendTouchEvent(const CefTouchEvent& event) { NOTIMPLEMENTED(); } -void CefBrowserPlatformDelegate::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegate::SetFocus(bool setFocus) { NOTIMPLEMENTED(); } diff --git a/libcef/browser/browser_platform_delegate.h b/libcef/browser/browser_platform_delegate.h index 82d85db78..be1236f25 100644 --- a/libcef/browser/browser_platform_delegate.h +++ b/libcef/browser/browser_platform_delegate.h @@ -225,7 +225,7 @@ class CefBrowserPlatformDelegate { // Send focus event. The browser's WebContents may be NULL when this method is // called. - virtual void SendFocusEvent(bool setFocus); + virtual void SetFocus(bool setFocus); // Send capture lost event. virtual void SendCaptureLostEvent(); diff --git a/libcef/browser/chrome/chrome_browser_host_impl.cc b/libcef/browser/chrome/chrome_browser_host_impl.cc index 6c7118195..856581685 100644 --- a/libcef/browser/chrome/chrome_browser_host_impl.cc +++ b/libcef/browser/chrome/chrome_browser_host_impl.cc @@ -273,10 +273,6 @@ void ChromeBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) { NOTIMPLEMENTED(); } -void ChromeBrowserHostImpl::SendFocusEvent(bool setFocus) { - NOTIMPLEMENTED(); -} - void ChromeBrowserHostImpl::SendCaptureLostEvent() { NOTIMPLEMENTED(); } diff --git a/libcef/browser/chrome/chrome_browser_host_impl.h b/libcef/browser/chrome/chrome_browser_host_impl.h index 83dda1db8..92b5e64b8 100644 --- a/libcef/browser/chrome/chrome_browser_host_impl.h +++ b/libcef/browser/chrome/chrome_browser_host_impl.h @@ -93,7 +93,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase { void Invalidate(PaintElementType type) override; void SendExternalBeginFrame() override; void SendTouchEvent(const CefTouchEvent& event) override; - void SendFocusEvent(bool setFocus) override; void SendCaptureLostEvent() override; void NotifyMoveOrResizeStarted() override; int GetWindowlessFrameRate() override; diff --git a/libcef/browser/extensions/browser_platform_delegate_background.cc b/libcef/browser/extensions/browser_platform_delegate_background.cc index 5e640bfe8..0d0042b50 100644 --- a/libcef/browser/extensions/browser_platform_delegate_background.cc +++ b/libcef/browser/extensions/browser_platform_delegate_background.cc @@ -77,7 +77,7 @@ void CefBrowserPlatformDelegateBackground::SendTouchEvent( // Nothing to do here. } -void CefBrowserPlatformDelegateBackground::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegateBackground::SetFocus(bool setFocus) { // Nothing to do here. } diff --git a/libcef/browser/extensions/browser_platform_delegate_background.h b/libcef/browser/extensions/browser_platform_delegate_background.h index bd6226ea5..6793893e5 100644 --- a/libcef/browser/extensions/browser_platform_delegate_background.h +++ b/libcef/browser/extensions/browser_platform_delegate_background.h @@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateBackground int deltaX, int deltaY) override; void SendTouchEvent(const CefTouchEvent& event) override; - void SendFocusEvent(bool setFocus) override; + void SetFocus(bool setFocus) override; gfx::Point GetScreenPoint(const gfx::Point& view) const override; void ViewText(const std::string& text) override; bool HandleKeyboardEvent( diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.cc b/libcef/browser/native/browser_platform_delegate_native_linux.cc index df53a599d..f1255a7b7 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.cc +++ b/libcef/browser/native/browser_platform_delegate_native_linux.cc @@ -133,7 +133,7 @@ views::Widget* CefBrowserPlatformDelegateNativeLinux::GetWindowWidget() const { return window_widget_; } -void CefBrowserPlatformDelegateNativeLinux::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegateNativeLinux::SetFocus(bool setFocus) { if (!setFocus) return; diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.h b/libcef/browser/native/browser_platform_delegate_native_linux.h index f791ff7ed..c78d68338 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.h +++ b/libcef/browser/native/browser_platform_delegate_native_linux.h @@ -24,7 +24,7 @@ class CefBrowserPlatformDelegateNativeLinux void CloseHostWindow() override; CefWindowHandle GetHostWindowHandle() const override; views::Widget* GetWindowWidget() const override; - void SendFocusEvent(bool setFocus) override; + void SetFocus(bool setFocus) override; void NotifyMoveOrResizeStarted() override; void SizeTo(int width, int height) override; gfx::Point GetScreenPoint(const gfx::Point& view) const override; diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.h b/libcef/browser/native/browser_platform_delegate_native_mac.h index d0bfb68a6..b12f461a9 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.h +++ b/libcef/browser/native/browser_platform_delegate_native_mac.h @@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateNativeMac int deltaX, int deltaY) override; void SendTouchEvent(const CefTouchEvent& event) override; - void SendFocusEvent(bool setFocus) override; + void SetFocus(bool setFocus) override; gfx::Point GetScreenPoint(const gfx::Point& view) const override; void ViewText(const std::string& text) override; bool HandleKeyboardEvent( diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.mm b/libcef/browser/native/browser_platform_delegate_native_mac.mm index 5c34726d1..c643bb159 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.mm +++ b/libcef/browser/native/browser_platform_delegate_native_mac.mm @@ -310,7 +310,7 @@ void CefBrowserPlatformDelegateNativeMac::SendTouchEvent( NOTIMPLEMENTED(); } -void CefBrowserPlatformDelegateNativeMac::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegateNativeMac::SetFocus(bool setFocus) { auto view = GetHostView(); if (view) { view->SetActive(setFocus); diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index 1c648e3cb..62bb81f2b 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -243,7 +243,7 @@ views::Widget* CefBrowserPlatformDelegateNativeWin::GetWindowWidget() const { return window_widget_; } -void CefBrowserPlatformDelegateNativeWin::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegateNativeWin::SetFocus(bool setFocus) { if (!setFocus) return; diff --git a/libcef/browser/native/browser_platform_delegate_native_win.h b/libcef/browser/native/browser_platform_delegate_native_win.h index 6c8f7484e..9879f6c03 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.h +++ b/libcef/browser/native/browser_platform_delegate_native_win.h @@ -22,7 +22,7 @@ class CefBrowserPlatformDelegateNativeWin void CloseHostWindow() override; CefWindowHandle GetHostWindowHandle() const override; views::Widget* GetWindowWidget() const override; - void SendFocusEvent(bool setFocus) override; + void SetFocus(bool setFocus) override; void NotifyMoveOrResizeStarted() override; void SizeTo(int width, int height) override; gfx::Point GetScreenPoint(const gfx::Point& view) const override; diff --git a/libcef/browser/osr/browser_platform_delegate_osr.cc b/libcef/browser/osr/browser_platform_delegate_osr.cc index fe23f4145..427533baa 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr.cc @@ -161,10 +161,10 @@ void CefBrowserPlatformDelegateOsr::SendTouchEvent(const CefTouchEvent& event) { view->SendTouchEvent(event); } -void CefBrowserPlatformDelegateOsr::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegateOsr::SetFocus(bool setFocus) { CefRenderWidgetHostViewOSR* view = GetOSRHostView(); if (view) - view->SendFocusEvent(setFocus); + view->SetFocus(setFocus); } gfx::Point CefBrowserPlatformDelegateOsr::GetScreenPoint( diff --git a/libcef/browser/osr/browser_platform_delegate_osr.h b/libcef/browser/osr/browser_platform_delegate_osr.h index befed219f..5efb3ee96 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.h +++ b/libcef/browser/osr/browser_platform_delegate_osr.h @@ -42,7 +42,7 @@ class CefBrowserPlatformDelegateOsr int deltaX, int deltaY) override; void SendTouchEvent(const CefTouchEvent& event) override; - void SendFocusEvent(bool setFocus) override; + void SetFocus(bool setFocus) override; gfx::Point GetScreenPoint(const gfx::Point& view) const override; void ViewText(const std::string& text) override; bool HandleKeyboardEvent( diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 240b3ecc0..03242db39 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -1305,7 +1305,7 @@ bool CefRenderWidgetHostViewOSR::ShouldRouteEvents() const { return !!render_widget_host_->delegate()->GetInputEventRouter(); } -void CefRenderWidgetHostViewOSR::SendFocusEvent(bool focus) { +void CefRenderWidgetHostViewOSR::SetFocus(bool focus) { if (!render_widget_host_) return; diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index 518838c5f..3f764e52a 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -225,7 +225,7 @@ class CefRenderWidgetHostViewOSR void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); void SendTouchEvent(const CefTouchEvent& event); bool ShouldRouteEvents() const; - void SendFocusEvent(bool focus); + void SetFocus(bool focus); void UpdateFrameRate(); gfx::Size SizeInPixels(); diff --git a/libcef/browser/views/browser_platform_delegate_views.cc b/libcef/browser/views/browser_platform_delegate_views.cc index 635f4f46f..6a9e30922 100644 --- a/libcef/browser/views/browser_platform_delegate_views.cc +++ b/libcef/browser/views/browser_platform_delegate_views.cc @@ -217,7 +217,7 @@ void CefBrowserPlatformDelegateViews::SendTouchEvent( native_delegate_->SendTouchEvent(event); } -void CefBrowserPlatformDelegateViews::SendFocusEvent(bool setFocus) { +void CefBrowserPlatformDelegateViews::SetFocus(bool setFocus) { // Will activate the Widget and result in a call to WebContents::Focus(). if (setFocus && browser_view_->root_view()) { if (auto widget = GetWindowWidget()) { diff --git a/libcef/browser/views/browser_platform_delegate_views.h b/libcef/browser/views/browser_platform_delegate_views.h index 41448c007..e742a6f50 100644 --- a/libcef/browser/views/browser_platform_delegate_views.h +++ b/libcef/browser/views/browser_platform_delegate_views.h @@ -53,7 +53,7 @@ class CefBrowserPlatformDelegateViews int deltaX, int deltaY) override; void SendTouchEvent(const CefTouchEvent& event) override; - void SendFocusEvent(bool setFocus) override; + void SetFocus(bool setFocus) override; gfx::Point GetScreenPoint(const gfx::Point& view) const override; void ViewText(const std::string& text) override; bool HandleKeyboardEvent( diff --git a/libcef_dll/cpptoc/browser_host_cpptoc.cc b/libcef_dll/cpptoc/browser_host_cpptoc.cc index 9514635ef..ebfd51263 100644 --- a/libcef_dll/cpptoc/browser_host_cpptoc.cc +++ b/libcef_dll/cpptoc/browser_host_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=0109529f61a92116f73bc6c0ff47bfd0423b6f07$ +// $hash=08a83d2956014971961d1cf3f93afbc1dae48f76$ // #include "libcef_dll/cpptoc/browser_host_cpptoc.h" @@ -874,20 +874,6 @@ browser_host_send_touch_event(struct _cef_browser_host_t* self, CefBrowserHostCppToC::Get(self)->SendTouchEvent(eventObj); } -void CEF_CALLBACK -browser_host_send_focus_event(struct _cef_browser_host_t* self, int setFocus) { - shutdown_checker::AssertNotShutdown(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - - // Execute - CefBrowserHostCppToC::Get(self)->SendFocusEvent(setFocus ? true : false); -} - void CEF_CALLBACK browser_host_send_capture_lost_event(struct _cef_browser_host_t* self) { shutdown_checker::AssertNotShutdown(); @@ -1350,7 +1336,6 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() { GetStruct()->send_mouse_move_event = browser_host_send_mouse_move_event; GetStruct()->send_mouse_wheel_event = browser_host_send_mouse_wheel_event; GetStruct()->send_touch_event = browser_host_send_touch_event; - GetStruct()->send_focus_event = browser_host_send_focus_event; GetStruct()->send_capture_lost_event = browser_host_send_capture_lost_event; GetStruct()->notify_move_or_resize_started = browser_host_notify_move_or_resize_started; diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.cc b/libcef_dll/ctocpp/browser_host_ctocpp.cc index 1a5754593..2991fe6a6 100644 --- a/libcef_dll/ctocpp/browser_host_ctocpp.cc +++ b/libcef_dll/ctocpp/browser_host_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=e53c3c194d40a9bdee41a348a1c9fd65822e4ba9$ +// $hash=791e5fd2deefd0e040143477a6ae53593886e706$ // #include "libcef_dll/ctocpp/browser_host_ctocpp.h" @@ -764,20 +764,6 @@ void CefBrowserHostCToCpp::SendTouchEvent(const CefTouchEvent& event) { _struct->send_touch_event(_struct, &event); } -NO_SANITIZE("cfi-icall") -void CefBrowserHostCToCpp::SendFocusEvent(bool setFocus) { - shutdown_checker::AssertNotShutdown(); - - cef_browser_host_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, send_focus_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - _struct->send_focus_event(_struct, setFocus); -} - NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::SendCaptureLostEvent() { shutdown_checker::AssertNotShutdown(); @@ -1015,8 +1001,8 @@ void CefBrowserHostCToCpp::DragSourceSystemDragEnded() { } NO_SANITIZE("cfi-icall") -CefRefPtr< - CefNavigationEntry> CefBrowserHostCToCpp::GetVisibleNavigationEntry() { +CefRefPtr +CefBrowserHostCToCpp::GetVisibleNavigationEntry() { shutdown_checker::AssertNotShutdown(); cef_browser_host_t* _struct = GetStruct(); diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.h b/libcef_dll/ctocpp/browser_host_ctocpp.h index 0349287c0..d02e31f63 100644 --- a/libcef_dll/ctocpp/browser_host_ctocpp.h +++ b/libcef_dll/ctocpp/browser_host_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=0de1d0125514efd66096e5e900938b6481f0ec1d$ +// $hash=1c231cf78fe94d9e395fe8bee9c0c848d81f3ef5$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_ @@ -102,7 +102,6 @@ class CefBrowserHostCToCpp : public CefCToCppRefCountedGetHost()->SendFocusEvent(true); + browser_->GetHost()->SetFocus(true); } void BrowserWindowOsrGtk::Hide() { @@ -1051,7 +1051,7 @@ void BrowserWindowOsrGtk::Hide() { return; // Remove focus from the browser. - browser_->GetHost()->SendFocusEvent(false); + browser_->GetHost()->SetFocus(false); if (!hidden_) { // Set the browser as hidden. @@ -1648,7 +1648,7 @@ gint BrowserWindowOsrGtk::FocusEvent(GtkWidget* widget, BrowserWindowOsrGtk* self) { // May be called on the main thread and the UI thread. if (self->browser_.get()) - self->browser_->GetHost()->SendFocusEvent(event->in == TRUE); + self->browser_->GetHost()->SetFocus(event->in == TRUE); return TRUE; } diff --git a/tests/cefclient/browser/browser_window_osr_mac.mm b/tests/cefclient/browser/browser_window_osr_mac.mm index 26163bc87..cd16c56a0 100644 --- a/tests/cefclient/browser/browser_window_osr_mac.mm +++ b/tests/cefclient/browser/browser_window_osr_mac.mm @@ -486,7 +486,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { - (BOOL)becomeFirstResponder { CefRefPtr browser = [self getBrowser]; if (browser.get()) { - browser->GetHost()->SendFocusEvent(true); + browser->GetHost()->SetFocus(true); return [super becomeFirstResponder]; } @@ -496,7 +496,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { - (BOOL)resignFirstResponder { CefRefPtr browser = [self getBrowser]; if (browser.get()) { - browser->GetHost()->SendFocusEvent(false); + browser->GetHost()->SetFocus(false); return [super resignFirstResponder]; } @@ -1431,7 +1431,7 @@ void BrowserWindowOsrMacImpl::Show() { } // Give focus to the browser. - browser_window_.browser_->GetHost()->SendFocusEvent(true); + browser_window_.browser_->GetHost()->SetFocus(true); } void BrowserWindowOsrMacImpl::Hide() { @@ -1441,7 +1441,7 @@ void BrowserWindowOsrMacImpl::Hide() { return; // Remove focus from the browser. - browser_window_.browser_->GetHost()->SendFocusEvent(false); + browser_window_.browser_->GetHost()->SetFocus(false); if (!hidden_) { // Set the browser as hidden. diff --git a/tests/cefclient/browser/osr_window_win.cc b/tests/cefclient/browser/osr_window_win.cc index a661caf59..28d573606 100644 --- a/tests/cefclient/browser/osr_window_win.cc +++ b/tests/cefclient/browser/osr_window_win.cc @@ -202,7 +202,7 @@ void OsrWindowWin::Show() { } // Give focus to the browser. - browser_->GetHost()->SendFocusEvent(true); + browser_->GetHost()->SetFocus(true); } void OsrWindowWin::Hide() { @@ -216,7 +216,7 @@ void OsrWindowWin::Hide() { return; // Remove focus from the browser. - browser_->GetHost()->SendFocusEvent(false); + browser_->GetHost()->SetFocus(false); if (!hidden_) { // Set the browser as hidden. @@ -762,7 +762,7 @@ void OsrWindowWin::OnSize() { void OsrWindowWin::OnFocus(bool setFocus) { if (browser_) - browser_->GetHost()->SendFocusEvent(setFocus); + browser_->GetHost()->SetFocus(setFocus); } void OsrWindowWin::OnCaptureLost() { diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index a767b8a24..68dbb62fa 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -548,7 +548,7 @@ class OSRTestHandler : public RoutingTestHandler, case OSR_TEST_FOCUS: if (StartTest()) { // body.onfocus will make LI00 red - browser->GetHost()->SendFocusEvent(true); + browser->GetHost()->SetFocus(true); } break; case OSR_TEST_TAKE_FOCUS: @@ -566,7 +566,7 @@ class OSRTestHandler : public RoutingTestHandler, break; case OSR_TEST_GOT_FOCUS: if (StartTest()) { - browser->GetHost()->SendFocusEvent(true); + browser->GetHost()->SetFocus(true); } break; case OSR_TEST_CURSOR: @@ -750,7 +750,7 @@ class OSRTestHandler : public RoutingTestHandler, ExpandDropDown(); // Wait for the first popup paint to occur } else if (type == PET_POPUP) { - browser->GetHost()->SendFocusEvent(false); + browser->GetHost()->SetFocus(false); } break; case OSR_TEST_POPUP_HIDE_ON_ESC: @@ -1422,7 +1422,7 @@ class OSRTestHandler : public RoutingTestHandler, } void ExpandDropDown() { - GetBrowser()->GetHost()->SendFocusEvent(true); + GetBrowser()->GetHost()->SetFocus(true); CefMouseEvent mouse_event; const CefRect& LI11select = GetElementBounds("LI11select");