Fix crash when sending programmatic event to a Views-hosted browser window.
The |web_contents_| member was nullptr in CefBrowserPlatformDelegateNativeAura when calling methods like SendKeyEvent from CefBrowserPlatformDelegateViews.
This commit is contained in:
parent
8796d3cd95
commit
5f9bd3ecbd
|
@ -62,7 +62,6 @@ class CefBrowserPlatformDelegateNative
|
|||
void set_windowless_handler(WindowlessHandler* handler) {
|
||||
windowless_handler_ = handler;
|
||||
}
|
||||
void set_browser(CefBrowserHostImpl* browser) { browser_ = browser; }
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
const SkColor background_color_;
|
||||
|
|
|
@ -225,6 +225,8 @@ int CefBrowserPlatformDelegateNativeAura::TranslateUiChangedButtonFlags(
|
|||
|
||||
content::RenderWidgetHostViewAura*
|
||||
CefBrowserPlatformDelegateNativeAura::GetHostView() const {
|
||||
if (!web_contents_)
|
||||
return nullptr;
|
||||
return static_cast<content::RenderWidgetHostViewAura*>(
|
||||
web_contents_->GetRenderWidgetHostView());
|
||||
}
|
||||
|
|
|
@ -69,15 +69,21 @@ void CefBrowserPlatformDelegateViews::WebContentsCreated(
|
|||
content::WebContents* web_contents,
|
||||
bool owned) {
|
||||
CefBrowserPlatformDelegateAlloy::WebContentsCreated(web_contents, owned);
|
||||
|
||||
native_delegate_->WebContentsCreated(web_contents, /*owned=*/false);
|
||||
browser_view_->WebContentsCreated(web_contents);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::WebContentsDestroyed(
|
||||
content::WebContents* web_contents) {
|
||||
CefBrowserPlatformDelegateAlloy::WebContentsDestroyed(web_contents);
|
||||
native_delegate_->WebContentsDestroyed(web_contents);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::BrowserCreated(
|
||||
CefBrowserHostImpl* browser) {
|
||||
CefBrowserPlatformDelegateAlloy::BrowserCreated(browser);
|
||||
|
||||
native_delegate_->set_browser(browser);
|
||||
native_delegate_->BrowserCreated(browser);
|
||||
browser_view_->BrowserCreated(browser, GetBoundsChangedCallback());
|
||||
}
|
||||
|
||||
|
@ -99,9 +105,9 @@ void CefBrowserPlatformDelegateViews::BrowserDestroyed(
|
|||
CefBrowserHostImpl* browser) {
|
||||
CefBrowserPlatformDelegateAlloy::BrowserDestroyed(browser);
|
||||
|
||||
native_delegate_->set_browser(nullptr);
|
||||
browser_view_->BrowserDestroyed(browser);
|
||||
browser_view_ = nullptr;
|
||||
native_delegate_->BrowserDestroyed(browser);
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateViews::CreateHostWindow() {
|
||||
|
|
|
@ -23,6 +23,7 @@ class CefBrowserPlatformDelegateViews
|
|||
// CefBrowserPlatformDelegate methods:
|
||||
void WebContentsCreated(content::WebContents* web_contents,
|
||||
bool owned) override;
|
||||
void WebContentsDestroyed(content::WebContents* web_contents) override;
|
||||
void BrowserCreated(CefBrowserHostImpl* browser) override;
|
||||
void NotifyBrowserCreated() override;
|
||||
void NotifyBrowserDestroyed() override;
|
||||
|
|
Loading…
Reference in New Issue