mirror of
https://github.com/HackPlan/atom-shell.git
synced 2026-01-12 22:44:10 +08:00
check for renderviewhost availability before using
This commit is contained in:
@@ -215,20 +215,26 @@ void WebContents::HandleKeyboardEvent(
|
||||
web_contents(), event);
|
||||
}
|
||||
|
||||
void WebContents::EnterFullscreenModeForTab(content::WebContents* web_contents,
|
||||
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
||||
const GURL& origin) {
|
||||
GetWindowFromGuest(web_contents)->SetFullScreen(true);
|
||||
web_contents->GetRenderViewHost()->WasResized();
|
||||
auto window = GetWindowFromGuest(source);
|
||||
if (window) {
|
||||
window->SetFullScreen(true);
|
||||
source->GetRenderViewHost()->WasResized();
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::ExitFullscreenModeForTab(content::WebContents* web_contents) {
|
||||
GetWindowFromGuest(web_contents)->SetFullScreen(false);
|
||||
web_contents->GetRenderViewHost()->WasResized();
|
||||
void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||
auto window = GetWindowFromGuest(source);
|
||||
if (window) {
|
||||
window->SetFullScreen(false);
|
||||
source->GetRenderViewHost()->WasResized();
|
||||
}
|
||||
}
|
||||
|
||||
bool WebContents::IsFullscreenForTabOrPending(
|
||||
const content::WebContents* web_contents) const {
|
||||
auto window = GetWindowFromGuest(web_contents);
|
||||
const content::WebContents* source) const {
|
||||
auto window = GetWindowFromGuest(source);
|
||||
if (window)
|
||||
return window->IsFullscreen();
|
||||
else
|
||||
|
||||
@@ -151,11 +151,11 @@ class WebContents : public mate::EventEmitter,
|
||||
void HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void EnterFullscreenModeForTab(content::WebContents* web_contents,
|
||||
void EnterFullscreenModeForTab(content::WebContents* source,
|
||||
const GURL& origin) override;
|
||||
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
|
||||
void ExitFullscreenModeForTab(content::WebContents* source) override;
|
||||
bool IsFullscreenForTabOrPending(
|
||||
const content::WebContents* web_contents) const override;
|
||||
const content::WebContents* source) const override;
|
||||
|
||||
// content::WebContentsObserver:
|
||||
void RenderViewDeleted(content::RenderViewHost*) override;
|
||||
|
||||
Reference in New Issue
Block a user