check for renderviewhost availability before using
This commit is contained in:
parent
be57151037
commit
4fe294ed04
2 changed files with 17 additions and 11 deletions
|
@ -215,20 +215,26 @@ void WebContents::HandleKeyboardEvent(
|
||||||
web_contents(), event);
|
web_contents(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::EnterFullscreenModeForTab(content::WebContents* web_contents,
|
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
||||||
const GURL& origin) {
|
const GURL& origin) {
|
||||||
GetWindowFromGuest(web_contents)->SetFullScreen(true);
|
auto window = GetWindowFromGuest(source);
|
||||||
web_contents->GetRenderViewHost()->WasResized();
|
if (window) {
|
||||||
|
window->SetFullScreen(true);
|
||||||
|
source->GetRenderViewHost()->WasResized();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::ExitFullscreenModeForTab(content::WebContents* web_contents) {
|
void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||||
GetWindowFromGuest(web_contents)->SetFullScreen(false);
|
auto window = GetWindowFromGuest(source);
|
||||||
web_contents->GetRenderViewHost()->WasResized();
|
if (window) {
|
||||||
|
window->SetFullScreen(false);
|
||||||
|
source->GetRenderViewHost()->WasResized();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContents::IsFullscreenForTabOrPending(
|
bool WebContents::IsFullscreenForTabOrPending(
|
||||||
const content::WebContents* web_contents) const {
|
const content::WebContents* source) const {
|
||||||
auto window = GetWindowFromGuest(web_contents);
|
auto window = GetWindowFromGuest(source);
|
||||||
if (window)
|
if (window)
|
||||||
return window->IsFullscreen();
|
return window->IsFullscreen();
|
||||||
else
|
else
|
||||||
|
|
|
@ -151,11 +151,11 @@ class WebContents : public mate::EventEmitter,
|
||||||
void HandleKeyboardEvent(
|
void HandleKeyboardEvent(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
const content::NativeWebKeyboardEvent& event) override;
|
const content::NativeWebKeyboardEvent& event) override;
|
||||||
void EnterFullscreenModeForTab(content::WebContents* web_contents,
|
void EnterFullscreenModeForTab(content::WebContents* source,
|
||||||
const GURL& origin) override;
|
const GURL& origin) override;
|
||||||
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
|
void ExitFullscreenModeForTab(content::WebContents* source) override;
|
||||||
bool IsFullscreenForTabOrPending(
|
bool IsFullscreenForTabOrPending(
|
||||||
const content::WebContents* web_contents) const override;
|
const content::WebContents* source) const override;
|
||||||
|
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
void RenderViewDeleted(content::RenderViewHost*) override;
|
void RenderViewDeleted(content::RenderViewHost*) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue