From cd3f61717164d36f26a467cdcc39dd69b9f01a22 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 2 Jul 2024 14:16:55 -0400 Subject: [PATCH] Rename browser_util to browser_event_util (seee #3685) Use more specific file naming. This change is a functional no-op. --- BUILD.gn | 4 ++-- libcef/browser/browser_contents_delegate.cc | 6 +++--- .../browser/{browser_util.cc => browser_event_util.cc} | 6 +----- .../browser/{browser_util.h => browser_event_util.h} | 10 +++------- libcef/browser/views/browser_view_impl.cc | 4 ++-- libcef/browser/views/textfield_view.cc | 4 ++-- libcef/browser/views/window_impl.cc | 4 ++-- 7 files changed, 15 insertions(+), 23 deletions(-) rename libcef/browser/{browser_util.cc => browser_event_util.cc} (95%) rename libcef/browser/{browser_util.h => browser_event_util.h} (76%) diff --git a/BUILD.gn b/BUILD.gn index f3427ae4c..e95b745e0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -477,6 +477,8 @@ source_set("libcef_static") { "libcef/browser/browser_contents_delegate.h", "libcef/browser/browser_context.cc", "libcef/browser/browser_context.h", + "libcef/browser/browser_event_util.cc", + "libcef/browser/browser_event_util.h", "libcef/browser/browser_frame.cc", "libcef/browser/browser_frame.h", "libcef/browser/browser_guest_util.cc", @@ -495,8 +497,6 @@ source_set("libcef_static") { "libcef/browser/browser_platform_delegate.cc", "libcef/browser/browser_platform_delegate.h", "libcef/browser/browser_platform_delegate_create.cc", - "libcef/browser/browser_util.cc", - "libcef/browser/browser_util.h", "libcef/browser/certificate_query.cc", "libcef/browser/certificate_query.h", "libcef/browser/chrome/browser_delegate.h", diff --git a/libcef/browser/browser_contents_delegate.cc b/libcef/browser/browser_contents_delegate.cc index 1a2b5c2e2..cabb389c5 100644 --- a/libcef/browser/browser_contents_delegate.cc +++ b/libcef/browser/browser_contents_delegate.cc @@ -5,9 +5,9 @@ #include "cef/libcef/browser/browser_contents_delegate.h" #include "base/memory/raw_ptr.h" +#include "cef/libcef/browser/browser_event_util.h" #include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_platform_delegate.h" -#include "cef/libcef/browser/browser_util.h" #include "cef/libcef/browser/native/cursor_util.h" #include "cef/libcef/common/frame_util.h" #include "chrome/browser/ui/views/sad_tab_view.h" @@ -252,7 +252,7 @@ CefBrowserContentsDelegate::PreHandleKeyboardEvent( if (auto c = client()) { if (auto handler = c->GetKeyboardHandler()) { CefKeyEvent cef_event; - if (browser_util::GetCefKeyEvent(event, cef_event)) { + if (GetCefKeyEvent(event, cef_event)) { cef_event.focus_on_editable_field = focus_on_editable_field_; auto event_handle = delegate->GetEventHandle(event); @@ -284,7 +284,7 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent( if (auto c = client()) { if (auto handler = c->GetKeyboardHandler()) { CefKeyEvent cef_event; - if (browser_util::GetCefKeyEvent(event, cef_event)) { + if (GetCefKeyEvent(event, cef_event)) { cef_event.focus_on_editable_field = focus_on_editable_field_; auto event_handle = delegate->GetEventHandle(event); diff --git a/libcef/browser/browser_util.cc b/libcef/browser/browser_event_util.cc similarity index 95% rename from libcef/browser/browser_util.cc rename to libcef/browser/browser_event_util.cc index 2a83766ae..1b976cda5 100644 --- a/libcef/browser/browser_util.cc +++ b/libcef/browser/browser_event_util.cc @@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file. -#include "cef/libcef/browser/browser_util.h" +#include "cef/libcef/browser/browser_event_util.h" #include "components/input/native_web_keyboard_event.h" -namespace browser_util { - bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event, CefKeyEvent& cef_event) { switch (event.GetType()) { @@ -69,5 +67,3 @@ bool GetCefKeyEvent(const ui::KeyEvent& event, CefKeyEvent& cef_event) { input::NativeWebKeyboardEvent native_event(event); return GetCefKeyEvent(native_event, cef_event); } - -} // namespace browser_util diff --git a/libcef/browser/browser_util.h b/libcef/browser/browser_event_util.h similarity index 76% rename from libcef/browser/browser_util.h rename to libcef/browser/browser_event_util.h index 778c4fc61..af71bbeef 100644 --- a/libcef/browser/browser_util.h +++ b/libcef/browser/browser_event_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file. -#ifndef CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_ -#define CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_ +#ifndef CEF_LIBCEF_BROWSER_BROWSER_EVENT_UTIL_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_EVENT_UTIL_H_ #pragma once #include "cef/include/internal/cef_types_wrappers.h" @@ -16,8 +16,6 @@ namespace ui { class KeyEvent; } -namespace browser_util { - // Convert a input::NativeWebKeyboardEvent to a CefKeyEvent. bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event, CefKeyEvent& cef_event); @@ -25,6 +23,4 @@ bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event, // Convert a ui::KeyEvent to a CefKeyEvent. bool GetCefKeyEvent(const ui::KeyEvent& event, CefKeyEvent& cef_event); -} // namespace browser_util - -#endif // CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_ +#endif // CEF_LIBCEF_BROWSER_BROWSER_EVENT_UTIL_H_ diff --git a/libcef/browser/views/browser_view_impl.cc b/libcef/browser/views/browser_view_impl.cc index 460c42b6b..5bbeec704 100644 --- a/libcef/browser/views/browser_view_impl.cc +++ b/libcef/browser/views/browser_view_impl.cc @@ -7,8 +7,8 @@ #include #include +#include "cef/libcef/browser/browser_event_util.h" #include "cef/libcef/browser/browser_host_base.h" -#include "cef/libcef/browser/browser_util.h" #include "cef/libcef/browser/chrome/views/chrome_browser_view.h" #include "cef/libcef/browser/context.h" #include "cef/libcef/browser/request_context_impl.h" @@ -184,7 +184,7 @@ bool CefBrowserViewImpl::HandleKeyboardEvent( // Give the CefWindowDelegate a chance to handle the event. if (auto* window_impl = cef_window_impl()) { CefKeyEvent cef_event; - if (browser_util::GetCefKeyEvent(event, cef_event) && + if (GetCefKeyEvent(event, cef_event) && window_impl->OnKeyEvent(cef_event)) { return true; } diff --git a/libcef/browser/views/textfield_view.cc b/libcef/browser/views/textfield_view.cc index ee7a26df6..9ea1ecb2c 100644 --- a/libcef/browser/views/textfield_view.cc +++ b/libcef/browser/views/textfield_view.cc @@ -4,7 +4,7 @@ #include "cef/libcef/browser/views/textfield_view.h" -#include "cef/libcef/browser/browser_util.h" +#include "cef/libcef/browser/browser_event_util.h" CefTextfieldView::CefTextfieldView(CefTextfieldDelegate* cef_delegate) : ParentClass(cef_delegate) { @@ -27,7 +27,7 @@ bool CefTextfieldView::HandleKeyEvent(views::Textfield* sender, } CefKeyEvent cef_key_event; - if (!browser_util::GetCefKeyEvent(key_event, cef_key_event)) { + if (!GetCefKeyEvent(key_event, cef_key_event)) { return false; } diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc index 7940e8717..57bb31687 100644 --- a/libcef/browser/views/window_impl.cc +++ b/libcef/browser/views/window_impl.cc @@ -8,7 +8,7 @@ #include "base/i18n/rtl.h" #include "base/memory/raw_ptr.h" -#include "cef/libcef/browser/browser_util.h" +#include "cef/libcef/browser/browser_event_util.h" #include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/views/browser_view_impl.h" #include "cef/libcef/browser/views/display_impl.h" @@ -86,7 +86,7 @@ class CefUnhandledKeyEventHandler : public ui::EventHandler { } CefKeyEvent cef_event; - if (browser_util::GetCefKeyEvent(*event, cef_event) && + if (GetCefKeyEvent(*event, cef_event) && window_impl_->OnKeyEvent(cef_event)) { event->StopPropagation(); }