mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-25 16:37:51 +01:00
Add workaround for crash on Views popup window creation (see issue #3040)
This commit is contained in:
parent
9d4f862210
commit
d06fdcff85
@ -132,6 +132,14 @@ void CefBrowserViewImpl::SetPreferAccelerators(bool prefer_accelerators) {
|
|||||||
root_view()->set_allow_accelerators(prefer_accelerators);
|
root_view()->set_allow_accelerators(prefer_accelerators);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserViewImpl::SetBackgroundColor(cef_color_t color) {
|
void CefBrowserViewImpl::SetBackgroundColor(cef_color_t color) {
|
||||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||||
ParentClass::SetBackgroundColor(color);
|
ParentClass::SetBackgroundColor(color);
|
||||||
@ -182,7 +190,7 @@ void CefBrowserViewImpl::OnBoundsChanged() {
|
|||||||
|
|
||||||
CefBrowserViewImpl::CefBrowserViewImpl(
|
CefBrowserViewImpl::CefBrowserViewImpl(
|
||||||
CefRefPtr<CefBrowserViewDelegate> delegate)
|
CefRefPtr<CefBrowserViewDelegate> delegate)
|
||||||
: ParentClass(delegate) {}
|
: ParentClass(delegate), weak_ptr_factory_(this) {}
|
||||||
|
|
||||||
void CefBrowserViewImpl::SetPendingBrowserCreateParams(
|
void CefBrowserViewImpl::SetPendingBrowserCreateParams(
|
||||||
CefRefPtr<CefClient> client,
|
CefRefPtr<CefClient> client,
|
||||||
@ -248,3 +256,7 @@ bool CefBrowserViewImpl::HandleAccelerator(
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserViewImpl::RequestFocusInternal() {
|
||||||
|
ParentClass::RequestFocus();
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "libcef/browser/views/view_impl.h"
|
#include "libcef/browser/views/view_impl.h"
|
||||||
|
|
||||||
#include "base/callback_forward.h"
|
#include "base/callback_forward.h"
|
||||||
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
|
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
|
||||||
|
|
||||||
class CefBrowserHostBase;
|
class CefBrowserHostBase;
|
||||||
@ -59,6 +60,7 @@ class CefBrowserViewImpl : public CefViewImpl<CefBrowserViewView,
|
|||||||
|
|
||||||
// CefView methods:
|
// CefView methods:
|
||||||
CefRefPtr<CefBrowserView> AsBrowserView() override { return this; }
|
CefRefPtr<CefBrowserView> AsBrowserView() override { return this; }
|
||||||
|
void RequestFocus() override;
|
||||||
void SetBackgroundColor(cef_color_t color) override;
|
void SetBackgroundColor(cef_color_t color) override;
|
||||||
|
|
||||||
// CefViewAdapter methods:
|
// CefViewAdapter methods:
|
||||||
@ -96,6 +98,8 @@ class CefBrowserViewImpl : public CefViewImpl<CefBrowserViewView,
|
|||||||
bool HandleAccelerator(const content::NativeWebKeyboardEvent& event,
|
bool HandleAccelerator(const content::NativeWebKeyboardEvent& event,
|
||||||
views::FocusManager* focus_manager);
|
views::FocusManager* focus_manager);
|
||||||
|
|
||||||
|
void RequestFocusInternal();
|
||||||
|
|
||||||
std::unique_ptr<CefBrowserCreateParams> pending_browser_create_params_;
|
std::unique_ptr<CefBrowserCreateParams> pending_browser_create_params_;
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostBase> browser_;
|
CefRefPtr<CefBrowserHostBase> browser_;
|
||||||
@ -105,6 +109,8 @@ class CefBrowserViewImpl : public CefViewImpl<CefBrowserViewView,
|
|||||||
|
|
||||||
base::RepeatingClosure on_bounds_changed_;
|
base::RepeatingClosure on_bounds_changed_;
|
||||||
|
|
||||||
|
base::WeakPtrFactory<CefBrowserViewImpl> weak_ptr_factory_;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBrowserViewImpl);
|
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBrowserViewImpl);
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserViewImpl);
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserViewImpl);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user