views: Fix Chrome style browser RequestFocus behavior (fixes #3819)
Fix implementation of CefBrowserView::RequestFocus for Chrome style browsers. Match Alloy style behavior of requesting browser focus (calling OnSetFocus) after initial navigation. Add CefView::HasFocus and CefWindow::GetFocusedView that can be used in combination with CefWindow::IsActive to determine global keyboard focus. Update sample applications for the new behavior. In cefclient: - Browser receives initial focus via ViewsWindow::RequestBrowserFocus. - When running with `--show-overlay-browser` (see #3790): - Give initial focus to the overlay browser. - Change the overlay popout shortcut to CTRL+SHIFT+O to avoid assigning focus to the menu in the main window. - Switching from overlay in the main window to popout browser window will give focus to the popout browser. - Switching from popout browser to overlay will leave current focus unchanged (e.g. in the overlay browser, or somewhere else). User gesture to activate the main window may be required on Mac/Linux. - When running with `--no-active` don't give initial focus to either browser. In cefsimple: - Browser receives initial focus via default handling.
This commit is contained in:
parent
9d40fa604d
commit
b91be9fcc9
|
@ -33,7 +33,7 @@
|
|||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=08f13de764f30261616372dfffb7f97c57957f73$
|
||||
// $hash=4c3a47faa34c20cee64fcaa37123860319995809$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
|
||||
|
@ -332,8 +332,17 @@ typedef struct _cef_view_t {
|
|||
int(CEF_CALLBACK* is_accessibility_focusable)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
/// Request keyboard focus. If this View is focusable it will become the
|
||||
/// focused View.
|
||||
/// Returns true (1) if this View has focus in the context of the containing
|
||||
/// Window. Check both this function and cef_window_t::IsActive to determine
|
||||
/// global keyboard focus.
|
||||
///
|
||||
int(CEF_CALLBACK* has_focus)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
/// Request focus for this View in the context of the containing Window. If
|
||||
/// this View is focusable it will become the focused View. Any focus changes
|
||||
/// while a Window is not active may be applied after that Window next becomes
|
||||
/// active.
|
||||
///
|
||||
void(CEF_CALLBACK* request_focus)(struct _cef_view_t* self);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=dd32b58ec9aca0e04a1d30ccf94a741995fcc094$
|
||||
// $hash=9de8ff77a40adc1e3edd7e2648f6c395c21a36bd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
|
||||
|
@ -52,6 +52,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct _cef_browser_view_t;
|
||||
struct _cef_view_t;
|
||||
|
||||
///
|
||||
/// A Window is a top-level Window/widget in the Views hierarchy. By default it
|
||||
|
@ -177,6 +178,15 @@ typedef struct _cef_window_t {
|
|||
///
|
||||
int(CEF_CALLBACK* is_fullscreen)(struct _cef_window_t* self);
|
||||
|
||||
///
|
||||
/// Returns the View that currently has focus in this Window, or nullptr if no
|
||||
/// View currently has focus. A Window may have a focused View even if it is
|
||||
/// not currently active. Any focus changes while a Window is not active may
|
||||
/// be applied after that Window next becomes active.
|
||||
///
|
||||
struct _cef_view_t*(CEF_CALLBACK* get_focused_view)(
|
||||
struct _cef_window_t* self);
|
||||
|
||||
///
|
||||
/// Set the Window title.
|
||||
///
|
||||
|
|
|
@ -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 "548bb305d04b05c0ef29eb2eed88c400e7905ab1"
|
||||
#define CEF_API_HASH_UNIVERSAL "38565e673fbcfcd9e4494914bcea03609b41ec30"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "b73640088f5d35912fcba870607031d8d0a0c33e"
|
||||
#define CEF_API_HASH_PLATFORM "df2092177211214092ab77559596adbc37edf68d"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "01224eb3f2e4bfa18defb3e6d40c93f65231b189"
|
||||
#define CEF_API_HASH_PLATFORM "aaa5bde96ceffff3de2c6fab11142c9264f44a39"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "46107dd79de8c5aab11757980c8951979cc7c266"
|
||||
#define CEF_API_HASH_PLATFORM "40de77e9ae3e071eda1f3bed7e900aedcdb354e5"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -350,8 +350,18 @@ class CefView : public CefBaseRefCounted {
|
|||
virtual bool IsAccessibilityFocusable() = 0;
|
||||
|
||||
///
|
||||
/// Request keyboard focus. If this View is focusable it will become the
|
||||
/// focused View.
|
||||
/// Returns true if this View has focus in the context of the containing
|
||||
/// Window. Check both this method and CefWindow::IsActive to determine global
|
||||
/// keyboard focus.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool HasFocus() = 0;
|
||||
|
||||
///
|
||||
/// Request focus for this View in the context of the containing Window. If
|
||||
/// this View is focusable it will become the focused View. Any focus changes
|
||||
/// while a Window is not active may be applied after that Window next becomes
|
||||
/// active.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void RequestFocus() = 0;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "include/views/cef_window_delegate.h"
|
||||
|
||||
class CefBrowserView;
|
||||
class CefView;
|
||||
|
||||
///
|
||||
/// A Window is a top-level Window/widget in the Views hierarchy. By default it
|
||||
|
@ -190,6 +191,15 @@ class CefWindow : public CefPanel {
|
|||
/*--cef()--*/
|
||||
virtual bool IsFullscreen() = 0;
|
||||
|
||||
///
|
||||
/// Returns the View that currently has focus in this Window, or nullptr if no
|
||||
/// View currently has focus. A Window may have a focused View even if it is
|
||||
/// not currently active. Any focus changes while a Window is not active may
|
||||
/// be applied after that Window next becomes active.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefView> GetFocusedView() = 0;
|
||||
|
||||
///
|
||||
/// Set the Window title.
|
||||
///
|
||||
|
|
|
@ -28,7 +28,8 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
|
|||
auto browser = CreateBrowser(params, std::nullopt);
|
||||
|
||||
GURL url = url_util::MakeGURL(params.url, /*fixup=*/true);
|
||||
if (url.is_empty()) {
|
||||
const bool url_is_empty = url.is_empty();
|
||||
if (url_is_empty) {
|
||||
// Chrome will navigate to kChromeUINewTabURL by default. We want to keep
|
||||
// the current CEF behavior of not navigating at all. Use a special URL that
|
||||
// will be recognized in HandleNonNavigationAboutURL.
|
||||
|
@ -50,6 +51,11 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
|
|||
ChromeBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
CHECK(browser_host);
|
||||
|
||||
if (!url_is_empty) {
|
||||
// Match Alloy-style behavior of requesting focus after initial navigation.
|
||||
browser_host->OnSetFocus(FOCUS_SOURCE_NAVIGATION);
|
||||
}
|
||||
|
||||
return browser_host;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,12 @@ CefBrowserPlatformDelegateChromeViews::GetBrowserView() const {
|
|||
return browser_view_.get();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::SetFocus(bool setFocus) {
|
||||
if (setFocus && browser_view_) {
|
||||
browser_view_->RequestFocusSync();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateChromeViews::IsViewsHosted() const {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class CefBrowserPlatformDelegateChromeViews
|
|||
views::Widget* GetWindowWidget() const override;
|
||||
CefRefPtr<CefBrowserView> GetBrowserView() const override;
|
||||
void SetBrowserView(CefRefPtr<CefBrowserView> browser_view) override;
|
||||
void SetFocus(bool setFocus) override;
|
||||
bool IsViewsHosted() const override;
|
||||
|
||||
CefBrowserViewImpl* browser_view() const { return browser_view_.get(); }
|
||||
|
|
|
@ -154,15 +154,8 @@ void CefBrowserPlatformDelegateViews::SendTouchEvent(
|
|||
}
|
||||
|
||||
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()) {
|
||||
// Don't activate a minimized Widget, or it will be shown.
|
||||
if (widget->IsMinimized()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
browser_view_->root_view()->RequestFocus();
|
||||
if (setFocus && browser_view_) {
|
||||
browser_view_->RequestFocusSync();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,6 +198,20 @@ void CefBrowserViewImpl::BrowserDestroyed(CefBrowserHostBase* browser) {
|
|||
DCHECK(!cef_widget_);
|
||||
}
|
||||
|
||||
void CefBrowserViewImpl::RequestFocusSync() {
|
||||
// With Chrome style the root_view() type (ChromeBrowserView) does not accept
|
||||
// focus, so always give focus to the WebView directly.
|
||||
if (web_view()) {
|
||||
if (auto widget = web_view()->GetWidget(); widget->IsMinimized()) {
|
||||
// Don't activate a minimized Widget, or it will be shown.
|
||||
return;
|
||||
}
|
||||
|
||||
// Activate the Widget and indirectly call WebContents::Focus().
|
||||
web_view()->RequestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserViewImpl::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
if (!root_view()) {
|
||||
|
@ -256,9 +270,8 @@ cef_runtime_style_t CefBrowserViewImpl::GetRuntimeStyle() {
|
|||
void CefBrowserViewImpl::RequestFocus() {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
// Always execute asynchronously to work around issue #3040.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserViewImpl::RequestFocusInternal,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserViewImpl::RequestFocusSync,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void CefBrowserViewImpl::SetBackgroundColor(cef_color_t color) {
|
||||
|
@ -481,10 +494,6 @@ bool CefBrowserViewImpl::HandleAccelerator(
|
|||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserViewImpl::RequestFocusInternal() {
|
||||
ParentClass::RequestFocus();
|
||||
}
|
||||
|
||||
void CefBrowserViewImpl::DisassociateFromWidget() {
|
||||
if (!cef_widget_) {
|
||||
return;
|
||||
|
|
|
@ -62,6 +62,7 @@ class CefBrowserViewImpl
|
|||
void BrowserCreated(CefBrowserHostBase* browser,
|
||||
base::RepeatingClosure on_bounds_changed);
|
||||
void BrowserDestroyed(CefBrowserHostBase* browser);
|
||||
void RequestFocusSync();
|
||||
|
||||
// Called to handle accelerators when the event is unhandled by the web
|
||||
// content and the browser client.
|
||||
|
@ -91,6 +92,7 @@ class CefBrowserViewImpl
|
|||
|
||||
// Return the WebView representation of this object.
|
||||
views::WebView* web_view() const;
|
||||
views::View* content_view() const override { return web_view(); }
|
||||
|
||||
// Return the CEF specialization of BrowserView.
|
||||
ChromeBrowserView* chrome_browser_view() const;
|
||||
|
@ -133,8 +135,6 @@ class CefBrowserViewImpl
|
|||
bool HandleAccelerator(const input::NativeWebKeyboardEvent& event,
|
||||
views::FocusManager* focus_manager);
|
||||
|
||||
void RequestFocusInternal();
|
||||
|
||||
void DisassociateFromWidget();
|
||||
|
||||
// True if the browser is Alloy style, otherwise Chrome style.
|
||||
|
|
|
@ -401,6 +401,7 @@ CEF_VIEW_IMPL_T class CefViewImpl : public CefViewAdapter, public CefViewClass {
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
@ -656,23 +657,29 @@ CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::IsEnabled() {
|
|||
|
||||
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetFocusable(bool focusable) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
root_view()->SetFocusBehavior(focusable ? views::View::FocusBehavior::ALWAYS
|
||||
: views::View::FocusBehavior::NEVER);
|
||||
content_view()->SetFocusBehavior(focusable
|
||||
? views::View::FocusBehavior::ALWAYS
|
||||
: views::View::FocusBehavior::NEVER);
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::IsFocusable() {
|
||||
CEF_REQUIRE_VALID_RETURN(false);
|
||||
return root_view()->IsFocusable();
|
||||
return content_view()->IsFocusable();
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::IsAccessibilityFocusable() {
|
||||
CEF_REQUIRE_VALID_RETURN(false);
|
||||
return root_view()->GetViewAccessibility().IsAccessibilityFocusable();
|
||||
return content_view()->GetViewAccessibility().IsAccessibilityFocusable();
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::HasFocus() {
|
||||
CEF_REQUIRE_VALID_RETURN(false);
|
||||
return content_view()->HasFocus();
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::RequestFocus() {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
root_view()->RequestFocus();
|
||||
content_view()->RequestFocus();
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetBackgroundColor(cef_color_t color) {
|
||||
|
|
|
@ -298,6 +298,16 @@ bool CefWindowImpl::IsFullscreen() {
|
|||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefView> CefWindowImpl::GetFocusedView() {
|
||||
CEF_REQUIRE_VALID_RETURN(nullptr);
|
||||
if (widget_ && widget_->GetFocusManager()) {
|
||||
if (auto* focused_view = widget_->GetFocusManager()->GetFocusedView()) {
|
||||
return view_util::GetFor(focused_view, /*find_known_parent=*/true);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefWindowImpl::SetTitle(const CefString& title) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
if (root_view()) {
|
||||
|
|
|
@ -58,6 +58,7 @@ class CefWindowImpl
|
|||
bool IsMaximized() override;
|
||||
bool IsMinimized() override;
|
||||
bool IsFullscreen() override;
|
||||
CefRefPtr<CefView> GetFocusedView() override;
|
||||
void SetTitle(const CefString& title) override;
|
||||
CefString GetTitle() override;
|
||||
void SetWindowIcon(CefRefPtr<CefImage> image) override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=34539b590718fa83d794a6cfcb34876da8a03d26$
|
||||
// $hash=f6c0c1dc3de70dab819ba42db591025c48667379$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/browser_view_cpptoc.h"
|
||||
|
@ -964,6 +964,25 @@ browser_view_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK browser_view_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefBrowserViewCppToC::Get(reinterpret_cast<cef_browser_view_t*>(self))
|
||||
->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_view_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1299,6 +1318,7 @@ CefBrowserViewCppToC::CefBrowserViewCppToC() {
|
|||
GetStruct()->base.is_focusable = browser_view_is_focusable;
|
||||
GetStruct()->base.is_accessibility_focusable =
|
||||
browser_view_is_accessibility_focusable;
|
||||
GetStruct()->base.has_focus = browser_view_has_focus;
|
||||
GetStruct()->base.request_focus = browser_view_request_focus;
|
||||
GetStruct()->base.set_background_color = browser_view_set_background_color;
|
||||
GetStruct()->base.get_background_color = browser_view_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4e2f75d68d804ad2414eb34b9f273b8f558c3dab$
|
||||
// $hash=2dc1cc5c216bf39628e9e67dad6432705c1b5123$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/button_cpptoc.h"
|
||||
|
@ -902,6 +902,24 @@ int CEF_CALLBACK button_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK button_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefButtonCppToC::Get(reinterpret_cast<cef_button_t*>(self))->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK button_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1230,6 +1248,7 @@ CefButtonCppToC::CefButtonCppToC() {
|
|||
GetStruct()->base.is_focusable = button_is_focusable;
|
||||
GetStruct()->base.is_accessibility_focusable =
|
||||
button_is_accessibility_focusable;
|
||||
GetStruct()->base.has_focus = button_has_focus;
|
||||
GetStruct()->base.request_focus = button_request_focus;
|
||||
GetStruct()->base.set_background_color = button_set_background_color;
|
||||
GetStruct()->base.get_background_color = button_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=51a06f8ad654129497df44179105e8523e1234af$
|
||||
// $hash=a1d17102b2aa9df60fa0296cafe9f43d879e20ea$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/label_button_cpptoc.h"
|
||||
|
@ -1178,6 +1178,25 @@ label_button_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK label_button_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefLabelButtonCppToC::Get(reinterpret_cast<cef_label_button_t*>(self))
|
||||
->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK label_button_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1528,6 +1547,7 @@ CefLabelButtonCppToC::CefLabelButtonCppToC() {
|
|||
GetStruct()->base.base.is_focusable = label_button_is_focusable;
|
||||
GetStruct()->base.base.is_accessibility_focusable =
|
||||
label_button_is_accessibility_focusable;
|
||||
GetStruct()->base.base.has_focus = label_button_has_focus;
|
||||
GetStruct()->base.base.request_focus = label_button_request_focus;
|
||||
GetStruct()->base.base.set_background_color =
|
||||
label_button_set_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=02040c0851514ead9307d3901c117d94d4fffb41$
|
||||
// $hash=d6f8f7a25fae4188fcced83882c2ec51f134e312$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/menu_button_cpptoc.h"
|
||||
|
@ -1231,6 +1231,25 @@ menu_button_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK menu_button_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefMenuButtonCppToC::Get(reinterpret_cast<cef_menu_button_t*>(self))
|
||||
->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK menu_button_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1585,6 +1604,7 @@ CefMenuButtonCppToC::CefMenuButtonCppToC() {
|
|||
GetStruct()->base.base.base.is_focusable = menu_button_is_focusable;
|
||||
GetStruct()->base.base.base.is_accessibility_focusable =
|
||||
menu_button_is_accessibility_focusable;
|
||||
GetStruct()->base.base.base.has_focus = menu_button_has_focus;
|
||||
GetStruct()->base.base.base.request_focus = menu_button_request_focus;
|
||||
GetStruct()->base.base.base.set_background_color =
|
||||
menu_button_set_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4c768c4065540d40bfcc8da63dfa1916ca09f6f7$
|
||||
// $hash=3ec9c298cd10893df63c6f7fd360968a5560a48c$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/panel_cpptoc.h"
|
||||
|
@ -1040,6 +1040,24 @@ int CEF_CALLBACK panel_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK panel_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefPanelCppToC::Get(reinterpret_cast<cef_panel_t*>(self))->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK panel_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1374,6 +1392,7 @@ CefPanelCppToC::CefPanelCppToC() {
|
|||
GetStruct()->base.is_focusable = panel_is_focusable;
|
||||
GetStruct()->base.is_accessibility_focusable =
|
||||
panel_is_accessibility_focusable;
|
||||
GetStruct()->base.has_focus = panel_has_focus;
|
||||
GetStruct()->base.request_focus = panel_request_focus;
|
||||
GetStruct()->base.set_background_color = panel_set_background_color;
|
||||
GetStruct()->base.get_background_color = panel_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=9c4a2548745464359046f080fa2a07d1438c208b$
|
||||
// $hash=1a624e78c1f34412717a3bf45bacc306fbde2b9c$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/scroll_view_cpptoc.h"
|
||||
|
@ -967,6 +967,25 @@ scroll_view_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK scroll_view_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefScrollViewCppToC::Get(reinterpret_cast<cef_scroll_view_t*>(self))
|
||||
->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK scroll_view_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1304,6 +1323,7 @@ CefScrollViewCppToC::CefScrollViewCppToC() {
|
|||
GetStruct()->base.is_focusable = scroll_view_is_focusable;
|
||||
GetStruct()->base.is_accessibility_focusable =
|
||||
scroll_view_is_accessibility_focusable;
|
||||
GetStruct()->base.has_focus = scroll_view_has_focus;
|
||||
GetStruct()->base.request_focus = scroll_view_request_focus;
|
||||
GetStruct()->base.set_background_color = scroll_view_set_background_color;
|
||||
GetStruct()->base.get_background_color = scroll_view_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5407c7f442b7787de087a85d5613fffb384288c8$
|
||||
// $hash=09a4dcefc71b4554d12a950d4c8879c0e2fd2521$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/textfield_cpptoc.h"
|
||||
|
@ -1397,6 +1397,25 @@ textfield_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK textfield_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefTextfieldCppToC::Get(reinterpret_cast<cef_textfield_t*>(self))
|
||||
->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK textfield_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1759,6 +1778,7 @@ CefTextfieldCppToC::CefTextfieldCppToC() {
|
|||
GetStruct()->base.is_focusable = textfield_is_focusable;
|
||||
GetStruct()->base.is_accessibility_focusable =
|
||||
textfield_is_accessibility_focusable;
|
||||
GetStruct()->base.has_focus = textfield_has_focus;
|
||||
GetStruct()->base.request_focus = textfield_request_focus;
|
||||
GetStruct()->base.set_background_color = textfield_set_background_color;
|
||||
GetStruct()->base.get_background_color = textfield_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=ae22b240b761b1bd2e9f168de2859ae0085191f6$
|
||||
// $hash=489b647764397f8cfba17ea7bccdd1153f0cc1a5$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/view_cpptoc.h"
|
||||
|
@ -743,6 +743,23 @@ int CEF_CALLBACK view_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK view_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval = CefViewCppToC::Get(self)->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK view_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -1053,6 +1070,7 @@ CefViewCppToC::CefViewCppToC() {
|
|||
GetStruct()->set_focusable = view_set_focusable;
|
||||
GetStruct()->is_focusable = view_is_focusable;
|
||||
GetStruct()->is_accessibility_focusable = view_is_accessibility_focusable;
|
||||
GetStruct()->has_focus = view_has_focus;
|
||||
GetStruct()->request_focus = view_request_focus;
|
||||
GetStruct()->set_background_color = view_set_background_color;
|
||||
GetStruct()->get_background_color = view_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e0e9fa1a9ab6826b9dda799e4a1fc3b8c133eeab$
|
||||
// $hash=374db873cd7af7312f9dd7c2bc6440e0f6f8cc02$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/window_cpptoc.h"
|
||||
|
@ -356,6 +356,23 @@ int CEF_CALLBACK window_is_fullscreen(struct _cef_window_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
cef_view_t* CEF_CALLBACK window_get_focused_view(struct _cef_window_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefView> _retval = CefWindowCppToC::Get(self)->GetFocusedView();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefViewCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK window_set_title(struct _cef_window_t* self,
|
||||
const cef_string_t* title) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
@ -1784,6 +1801,24 @@ int CEF_CALLBACK window_is_accessibility_focusable(struct _cef_view_t* self) {
|
|||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK window_has_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefWindowCppToC::Get(reinterpret_cast<cef_window_t*>(self))->HasFocus();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK window_request_focus(struct _cef_view_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@ -2084,6 +2119,7 @@ CefWindowCppToC::CefWindowCppToC() {
|
|||
GetStruct()->is_maximized = window_is_maximized;
|
||||
GetStruct()->is_minimized = window_is_minimized;
|
||||
GetStruct()->is_fullscreen = window_is_fullscreen;
|
||||
GetStruct()->get_focused_view = window_get_focused_view;
|
||||
GetStruct()->set_title = window_set_title;
|
||||
GetStruct()->get_title = window_get_title;
|
||||
GetStruct()->set_window_icon = window_set_window_icon;
|
||||
|
@ -2161,6 +2197,7 @@ CefWindowCppToC::CefWindowCppToC() {
|
|||
GetStruct()->base.base.is_focusable = window_is_focusable;
|
||||
GetStruct()->base.base.is_accessibility_focusable =
|
||||
window_is_accessibility_focusable;
|
||||
GetStruct()->base.base.has_focus = window_has_focus;
|
||||
GetStruct()->base.base.request_focus = window_request_focus;
|
||||
GetStruct()->base.base.set_background_color = window_set_background_color;
|
||||
GetStruct()->base.base.get_background_color = window_get_background_color;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=b1cca0d792a8c1aa71ec2aeda294b380b82e48fd$
|
||||
// $hash=519bc28c076065156644994840f486d3390ccd3e$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_VIEWS_WINDOW_CPPTOC_H_
|
||||
|
@ -21,8 +21,10 @@
|
|||
#endif
|
||||
|
||||
#include "include/capi/views/cef_browser_view_capi.h"
|
||||
#include "include/capi/views/cef_view_capi.h"
|
||||
#include "include/capi/views/cef_window_capi.h"
|
||||
#include "include/views/cef_browser_view.h"
|
||||
#include "include/views/cef_view.h"
|
||||
#include "include/views/cef_window.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=88f55766622ea99679e1b4c2748103d397e32117$
|
||||
// $hash=2ce9337436d62fd27d9ae7830811f3edeae693c2$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/browser_view_ctocpp.h"
|
||||
|
@ -836,6 +836,23 @@ NO_SANITIZE("cfi-icall") bool CefBrowserViewCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefBrowserViewCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefBrowserViewCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a61b633e9b8e4156fd4cdcb778ad54e38106dc0d$
|
||||
// $hash=ef7142f37fb7b2312373a6cf1c4df49f6a171623$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_CTOCPP_H_
|
||||
|
@ -81,6 +81,7 @@ class CefBrowserViewCToCpp : public CefCToCppRefCounted<CefBrowserViewCToCpp,
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=f71e4f87086a3fb6d20a922af417bc47c81dbc7c$
|
||||
// $hash=b829a205a55586221ebdcc65b618c09761980150$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/button_ctocpp.h"
|
||||
|
@ -816,6 +816,23 @@ NO_SANITIZE("cfi-icall") bool CefButtonCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefButtonCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefButtonCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c8c1e03aa10a0ea469774ccd59640fcec2487513$
|
||||
// $hash=fabfb73c073981506fb91b409bf85db47176f347$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BUTTON_CTOCPP_H_
|
||||
|
@ -84,6 +84,7 @@ class CefButtonCToCpp
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=771ab2674e580450d8a0478435305bccc2440cae$
|
||||
// $hash=abd223cdf6d809bf1a7e2ed11b36f5427ea892a9$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/label_button_ctocpp.h"
|
||||
|
@ -1043,6 +1043,23 @@ NO_SANITIZE("cfi-icall") bool CefLabelButtonCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefLabelButtonCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefLabelButtonCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=3ba705772b9bd57b5abac5f7128bc5afe148c83a$
|
||||
// $hash=c1f0efa7f36eff25faec6ababe5872a30d31e0f8$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_LABEL_BUTTON_CTOCPP_H_
|
||||
|
@ -99,6 +99,7 @@ class CefLabelButtonCToCpp : public CefCToCppRefCounted<CefLabelButtonCToCpp,
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=510f6e414ccd2152a39fdcd12447071794b649c2$
|
||||
// $hash=c49d0468a28969b21847b95f9d9a545af7a6039b$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/menu_button_ctocpp.h"
|
||||
|
@ -1091,6 +1091,23 @@ NO_SANITIZE("cfi-icall") bool CefMenuButtonCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMenuButtonCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefMenuButtonCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=fbe53f51eb991aeebc5d66da40a894880374e248$
|
||||
// $hash=544585f39ed5faa5230674c6a6d636cd12ba344e$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_CTOCPP_H_
|
||||
|
@ -103,6 +103,7 @@ class CefMenuButtonCToCpp : public CefCToCppRefCounted<CefMenuButtonCToCpp,
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=b7f89f3d93bb41c5f952ba85b6cd8ebc826dd45d$
|
||||
// $hash=0d9f8c7c00d7b2e59b4fbf35927a53ce335a8304$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/panel_ctocpp.h"
|
||||
|
@ -958,6 +958,23 @@ NO_SANITIZE("cfi-icall") bool CefPanelCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefPanelCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefPanelCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=3ab4fe06360d8ad1837683efb6ae5229b4c01f91$
|
||||
// $hash=5bd226a43d338c78c1bf8698b6160dad88794591$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_PANEL_CTOCPP_H_
|
||||
|
@ -97,6 +97,7 @@ class CefPanelCToCpp
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=f74bed30da72caaf40fb59b2e34b1c99aa647105$
|
||||
// $hash=037b63e599b503cbc2800814057d8f866473f998$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/scroll_view_ctocpp.h"
|
||||
|
@ -856,6 +856,23 @@ NO_SANITIZE("cfi-icall") bool CefScrollViewCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefScrollViewCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefScrollViewCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=1b896bea52b0d62490a5b78a86dee729a4236cda$
|
||||
// $hash=b466f3a709cc15c08f77ec31fe845fe2c7e096a7$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_SCROLL_VIEW_CTOCPP_H_
|
||||
|
@ -84,6 +84,7 @@ class CefScrollViewCToCpp : public CefCToCppRefCounted<CefScrollViewCToCpp,
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=77c2df71313e5075c9a25bde8a4cd7ee13ec5ac2$
|
||||
// $hash=15fd2f3ae41c973eccf6359eac04070d03c5e27e$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/textfield_ctocpp.h"
|
||||
|
@ -1264,6 +1264,23 @@ NO_SANITIZE("cfi-icall") bool CefTextfieldCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefTextfieldCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefTextfieldCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=70c79d683dbcf742579a22c2543d6ed1b40453ea$
|
||||
// $hash=58cc17237e5497548ee5093eaaa74102faeac62b$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_TEXTFIELD_CTOCPP_H_
|
||||
|
@ -110,6 +110,7 @@ class CefTextfieldCToCpp : public CefCToCppRefCounted<CefTextfieldCToCpp,
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=8bbe8af593158eac1cbbdaa09313216872488f86$
|
||||
// $hash=67a76403dae45d17abb6f94aec1ecea22323bca0$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/view_ctocpp.h"
|
||||
|
@ -708,6 +708,23 @@ NO_SANITIZE("cfi-icall") bool CefViewCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefViewCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefViewCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e9c4f3a121d3ab9a2d9d8a8ea8b51bddfd4845db$
|
||||
// $hash=a2b62cb88fb80659a49ece865b1d05ea422a6e40$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_VIEW_CTOCPP_H_
|
||||
|
@ -86,6 +86,7 @@ class CefViewCToCpp
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=6ebaa8a85615b3a4ea46cf32893e4297667f81a4$
|
||||
// $hash=c6c8223d5505cf28b00dcfaa1e16047d4ed45520$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/window_ctocpp.h"
|
||||
|
@ -346,6 +346,23 @@ NO_SANITIZE("cfi-icall") bool CefWindowCToCpp::IsFullscreen() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") CefRefPtr<CefView> CefWindowCToCpp::GetFocusedView() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_window_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_focused_view)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_view_t* _retval = _struct->get_focused_view(_struct);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefViewCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefWindowCToCpp::SetTitle(const CefString& title) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
@ -1669,6 +1686,23 @@ NO_SANITIZE("cfi-icall") bool CefWindowCToCpp::IsAccessibilityFocusable() {
|
|||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefWindowCToCpp::HasFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, has_focus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->has_focus(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefWindowCToCpp::RequestFocus() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d0c83991173ca5acb77c4bb8525cca3b645a2b19$
|
||||
// $hash=57275bfe260c39a2103f811886704009eb5688fd$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_CTOCPP_H_
|
||||
|
@ -23,8 +23,10 @@
|
|||
#include <vector>
|
||||
|
||||
#include "include/capi/views/cef_browser_view_capi.h"
|
||||
#include "include/capi/views/cef_view_capi.h"
|
||||
#include "include/capi/views/cef_window_capi.h"
|
||||
#include "include/views/cef_browser_view.h"
|
||||
#include "include/views/cef_view.h"
|
||||
#include "include/views/cef_window.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
|
@ -57,6 +59,7 @@ class CefWindowCToCpp
|
|||
bool IsMaximized() override;
|
||||
bool IsMinimized() override;
|
||||
bool IsFullscreen() override;
|
||||
CefRefPtr<CefView> GetFocusedView() override;
|
||||
void SetTitle(const CefString& title) override;
|
||||
CefString GetTitle() override;
|
||||
void SetWindowIcon(CefRefPtr<CefImage> image) override;
|
||||
|
@ -150,6 +153,7 @@ class CefWindowCToCpp
|
|||
void SetFocusable(bool focusable) override;
|
||||
bool IsFocusable() override;
|
||||
bool IsAccessibilityFocusable() override;
|
||||
bool HasFocus() override;
|
||||
void RequestFocus() override;
|
||||
void SetBackgroundColor(cef_color_t color) override;
|
||||
cef_color_t GetBackgroundColor() override;
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
|
||||
#include "tests/cefclient/browser/base_client_handler.h"
|
||||
|
||||
#include "include/cef_command_line.h"
|
||||
#include "tests/cefclient/browser/main_context.h"
|
||||
#include "tests/cefclient/browser/root_window_manager.h"
|
||||
#include "tests/shared/common/client_switches.h"
|
||||
|
||||
namespace client {
|
||||
|
||||
|
@ -36,6 +38,11 @@ bool BaseClientHandler::OnProcessMessageReceived(
|
|||
source_process, message);
|
||||
}
|
||||
|
||||
bool BaseClientHandler::OnSetFocus(CefRefPtr<CefBrowser> browser,
|
||||
FocusSource source) {
|
||||
return !ShouldRequestFocus();
|
||||
}
|
||||
|
||||
void BaseClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
|
@ -76,6 +83,17 @@ void BaseClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
|||
}
|
||||
}
|
||||
|
||||
void BaseClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (!isLoading && initial_navigation_) {
|
||||
initial_navigation_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool BaseClientHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
|
@ -168,4 +186,19 @@ BaseClientHandler::HangAction BaseClientHandler::GetHangAction() const {
|
|||
return hang_action_;
|
||||
}
|
||||
|
||||
bool BaseClientHandler::ShouldRequestFocus() {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (initial_navigation_) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
if (command_line->HasSwitch(switches::kNoActivate)) {
|
||||
// Don't give focus to the browser on creation.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
|
|
|
@ -14,7 +14,9 @@ namespace client {
|
|||
|
||||
// Abstract base class for client handlers.
|
||||
class BaseClientHandler : public CefClient,
|
||||
public CefFocusHandler,
|
||||
public CefLifeSpanHandler,
|
||||
public CefLoadHandler,
|
||||
public CefRequestHandler,
|
||||
public CefResourceRequestHandler {
|
||||
public:
|
||||
|
@ -28,17 +30,28 @@ class BaseClientHandler : public CefClient,
|
|||
static CefRefPtr<BaseClientHandler> GetForClient(CefRefPtr<CefClient> client);
|
||||
|
||||
// CefClient methods
|
||||
CefRefPtr<CefFocusHandler> GetFocusHandler() override { return this; }
|
||||
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override { return this; }
|
||||
CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
|
||||
CefRefPtr<CefRequestHandler> GetRequestHandler() override { return this; }
|
||||
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) override;
|
||||
|
||||
// CefFocusHandler methods
|
||||
bool OnSetFocus(CefRefPtr<CefBrowser> browser, FocusSource source) override;
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
|
||||
|
||||
// CefLoadHandler methods
|
||||
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) override;
|
||||
|
||||
// CefRequestHandler methods
|
||||
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
|
@ -95,6 +108,8 @@ class BaseClientHandler : public CefClient,
|
|||
void SetHangAction(HangAction action);
|
||||
HangAction GetHangAction() const;
|
||||
|
||||
bool ShouldRequestFocus();
|
||||
|
||||
// Used to determine the object type for each concrete implementation.
|
||||
virtual const void* GetTypeKey() const = 0;
|
||||
|
||||
|
@ -129,6 +144,9 @@ class BaseClientHandler : public CefClient,
|
|||
|
||||
HangAction hang_action_ = HangAction::kDefault;
|
||||
|
||||
// True for the initial navigation after browser creation.
|
||||
bool initial_navigation_ = true;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BaseClientHandler);
|
||||
};
|
||||
|
||||
|
|
|
@ -888,13 +888,12 @@ bool ClientHandler::OnSetFocus(CefRefPtr<CefBrowser> browser,
|
|||
FocusSource source) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (initial_navigation_) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
if (command_line->HasSwitch(switches::kNoActivate)) {
|
||||
// Don't give focus to the browser on creation.
|
||||
return true;
|
||||
}
|
||||
if (BaseClientHandler::OnSetFocus(browser, source)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (delegate_ && delegate_->OnSetFocus(source)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1009,9 +1008,8 @@ void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
|||
bool canGoForward) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (!isLoading && initial_navigation_) {
|
||||
initial_navigation_ = false;
|
||||
}
|
||||
BaseClientHandler::OnLoadingStateChange(browser, isLoading, canGoBack,
|
||||
canGoForward);
|
||||
|
||||
NotifyLoadingState(isLoading, canGoBack, canGoForward);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ class ClientHandler : public BaseClientHandler,
|
|||
public CefDisplayHandler,
|
||||
public CefDownloadHandler,
|
||||
public CefDragHandler,
|
||||
public CefFocusHandler,
|
||||
public CefKeyboardHandler,
|
||||
public CefLoadHandler,
|
||||
public CefPermissionHandler {
|
||||
public:
|
||||
// Implement this interface to receive notification of ClientHandler
|
||||
|
@ -82,6 +80,9 @@ class ClientHandler : public BaseClientHandler,
|
|||
virtual void OnSetDraggableRegions(
|
||||
const std::vector<CefDraggableRegion>& regions) = 0;
|
||||
|
||||
// Called on the UI thread to optionally handle the browser gaining focus.
|
||||
virtual bool OnSetFocus(cef_focus_source_t source) { return false; }
|
||||
|
||||
// Set focus to the next/previous control.
|
||||
virtual void OnTakeFocus(bool next) {}
|
||||
|
||||
|
@ -111,9 +112,7 @@ class ClientHandler : public BaseClientHandler,
|
|||
CefRefPtr<CefDisplayHandler> GetDisplayHandler() override { return this; }
|
||||
CefRefPtr<CefDownloadHandler> GetDownloadHandler() override { return this; }
|
||||
CefRefPtr<CefDragHandler> GetDragHandler() override { return this; }
|
||||
CefRefPtr<CefFocusHandler> GetFocusHandler() override { return this; }
|
||||
CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() override { return this; }
|
||||
CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
|
||||
CefRefPtr<CefPermissionHandler> GetPermissionHandler() override {
|
||||
return this;
|
||||
}
|
||||
|
@ -423,9 +422,6 @@ class ClientHandler : public BaseClientHandler,
|
|||
// True if an editable field currently has focus.
|
||||
bool focus_on_editable_field_ = false;
|
||||
|
||||
// True for the initial navigation after browser creation.
|
||||
bool initial_navigation_ = true;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ClientHandler);
|
||||
};
|
||||
|
||||
|
|
|
@ -451,6 +451,14 @@ void RootWindowViews::OnSetDraggableRegions(
|
|||
}
|
||||
}
|
||||
|
||||
bool RootWindowViews::OnSetFocus(cef_focus_source_t source) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
if (window_) {
|
||||
return window_->OnSetFocus(source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RootWindowViews::OnTakeFocus(bool next) {
|
||||
if (!CefCurrentlyOn(TID_UI)) {
|
||||
// Execute this method on the UI thread.
|
||||
|
|
|
@ -85,6 +85,7 @@ class RootWindowViews : public RootWindow,
|
|||
bool canGoForward) override;
|
||||
void OnSetDraggableRegions(
|
||||
const std::vector<CefDraggableRegion>& regions) override;
|
||||
bool OnSetFocus(cef_focus_source_t source) override;
|
||||
void OnTakeFocus(bool next) override;
|
||||
void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) override;
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace {
|
|||
void AddPopOutAccelerator(CefRefPtr<CefWindow> window) {
|
||||
// Add an accelerator to toggle the BrowserView popout. OnAccelerator will be
|
||||
// called when the accelerator is triggered.
|
||||
window->SetAccelerator(ID_POPOUT_OVERLAY, 'O', /*shift_pressed=*/false,
|
||||
/*ctrl_pressed=*/false, /*alt_pressed=*/true,
|
||||
window->SetAccelerator(ID_POPOUT_OVERLAY, 'O', /*shift_pressed=*/true,
|
||||
/*ctrl_pressed=*/true, /*alt_pressed=*/false,
|
||||
/*high_priority=*/true);
|
||||
}
|
||||
|
||||
|
@ -201,10 +201,15 @@ void ViewsOverlayBrowser::PopOutBrowserView() {
|
|||
void ViewsOverlayBrowser::PopInBrowserView() {
|
||||
CHECK(!browser_view_);
|
||||
|
||||
CefRefPtr<CefView> last_focused_view = window_->GetFocusedView();
|
||||
|
||||
// Resume ownership of the BrowserView and close the popout Window.
|
||||
CHECK(popout_window_);
|
||||
browser_view_ =
|
||||
PopoutWindowDelegate::GetForWindow(popout_window_)->DetachBrowserView();
|
||||
|
||||
const bool should_focus_browser =
|
||||
popout_window_->IsActive() && browser_view_->HasFocus();
|
||||
popout_window_->RemoveChildView(browser_view_);
|
||||
popout_window_->Close();
|
||||
popout_window_ = nullptr;
|
||||
|
@ -219,6 +224,14 @@ void ViewsOverlayBrowser::PopInBrowserView() {
|
|||
|
||||
// Make sure the overlay is positioned correctly.
|
||||
UpdateBounds(last_insets_);
|
||||
|
||||
if (should_focus_browser) {
|
||||
// Keep the BrowserView focused.
|
||||
browser_view_->RequestFocus();
|
||||
} else if (last_focused_view) {
|
||||
// Keep focus unchanged in the main Window.
|
||||
last_focused_view->RequestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsOverlayBrowser::UpdateBounds(CefInsets insets) {
|
||||
|
@ -270,6 +283,14 @@ void ViewsOverlayBrowser::PopOutWindowDestroyed() {
|
|||
popout_window_ = nullptr;
|
||||
}
|
||||
|
||||
bool ViewsOverlayBrowser::RequestFocus() {
|
||||
if (browser_view_) {
|
||||
browser_view_->RequestFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CefSize ViewsOverlayBrowser::GetMinimumSize(CefRefPtr<CefView> view) {
|
||||
return CefSize(200, 200);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ class ViewsOverlayBrowser : public CefBrowserViewDelegate {
|
|||
|
||||
void PopOutWindowDestroyed();
|
||||
|
||||
bool RequestFocus();
|
||||
|
||||
private:
|
||||
// CefViewDelegate methods:
|
||||
CefSize GetMinimumSize(CefRefPtr<CefView> view) override;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "include/cef_i18n_util.h"
|
||||
#include "include/views/cef_box_layout.h"
|
||||
#include "include/wrapper/cef_helpers.h"
|
||||
#include "tests/cefclient/browser/base_client_handler.h"
|
||||
#include "tests/cefclient/browser/default_client_handler.h"
|
||||
#include "tests/cefclient/browser/main_context.h"
|
||||
#include "tests/cefclient/browser/resource.h"
|
||||
|
@ -201,10 +202,7 @@ void ViewsWindow::Show() {
|
|||
window_->Show();
|
||||
}
|
||||
}
|
||||
if (browser_view_ && !window_->IsMinimized()) {
|
||||
// Give keyboard focus to the BrowserView.
|
||||
browser_view_->RequestFocus();
|
||||
}
|
||||
MaybeRequestBrowserFocus();
|
||||
}
|
||||
|
||||
void ViewsWindow::Hide() {
|
||||
|
@ -378,6 +376,18 @@ void ViewsWindow::SetDraggableRegions(
|
|||
window_->SetDraggableRegions(window_regions);
|
||||
}
|
||||
|
||||
bool ViewsWindow::OnSetFocus(cef_focus_source_t source) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// No special handling of focus requests originating from the system.
|
||||
if (source == FOCUS_SOURCE_SYSTEM) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RequestBrowserFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewsWindow::TakeFocus(bool next) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
|
@ -1396,4 +1406,31 @@ void ViewsWindow::NudgeWindow() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void ViewsWindow::MaybeRequestBrowserFocus() {
|
||||
if (browser_view_) {
|
||||
// BaseClientHandler has some state that we need to query.
|
||||
if (auto handler =
|
||||
BaseClientHandler::GetForBrowser(browser_view_->GetBrowser());
|
||||
handler->ShouldRequestFocus()) {
|
||||
RequestBrowserFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsWindow::RequestBrowserFocus() {
|
||||
if (window_->IsMinimized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Maybe give keyboard focus to the overlay BrowserView.
|
||||
if (overlay_browser_ && overlay_browser_->RequestFocus()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Give keyboard focus to the main BrowserView.
|
||||
if (browser_view_) {
|
||||
browser_view_->RequestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
|
|
|
@ -120,6 +120,7 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
|||
void SetAlwaysOnTop(bool on_top);
|
||||
void SetLoadingState(bool isLoading, bool canGoBack, bool canGoForward);
|
||||
void SetDraggableRegions(const std::vector<CefDraggableRegion>& regions);
|
||||
bool OnSetFocus(cef_focus_source_t source);
|
||||
void TakeFocus(bool next);
|
||||
void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model);
|
||||
|
||||
|
@ -253,6 +254,9 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
|||
|
||||
void NudgeWindow();
|
||||
|
||||
void MaybeRequestBrowserFocus();
|
||||
void RequestBrowserFocus();
|
||||
|
||||
const WindowType type_;
|
||||
Delegate* const delegate_; // Not owned by this object.
|
||||
const bool use_alloy_style_;
|
||||
|
|
|
@ -33,12 +33,6 @@ class SimpleWindowDelegate : public CefWindowDelegate {
|
|||
if (initial_show_state_ != CEF_SHOW_STATE_HIDDEN) {
|
||||
window->Show();
|
||||
}
|
||||
|
||||
if (initial_show_state_ != CEF_SHOW_STATE_MINIMIZED &&
|
||||
initial_show_state_ != CEF_SHOW_STATE_HIDDEN) {
|
||||
// Give keyboard focus to the browser view.
|
||||
browser_view_->RequestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override {
|
||||
|
|
Loading…
Reference in New Issue