Implement HTML5 fullscreen in CommonWebContentsDelegate

This commit is contained in:
Cheng Zhao 2015-06-05 17:27:24 +08:00
parent 05468cc3fa
commit 8f9a109fa6
6 changed files with 72 additions and 86 deletions

View file

@ -223,32 +223,13 @@ void WebContents::HandleKeyboardEvent(
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin) {
auto window = GetWindowFromGuest(source);
if (window) {
window->SetHtmlApiFullscreen(true);
window->NotifyWindowEnterHtmlFullScreen();
source->GetRenderViewHost()->WasResized();
Emit("enter-html-full-screen");
}
CommonWebContentsDelegate::EnterFullscreenModeForTab(source, origin);
Emit("enter-html-full-screen");
}
void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
auto window = GetWindowFromGuest(source);
if (window) {
window->SetHtmlApiFullscreen(false);
window->NotifyWindowLeaveHtmlFullScreen();
source->GetRenderViewHost()->WasResized();
Emit("leave-html-full-screen");
}
}
bool WebContents::IsFullscreenForTabOrPending(
const content::WebContents* source) const {
auto window = GetWindowFromGuest(source);
if (window)
return window->is_html_api_fullscreen();
else
return false;
CommonWebContentsDelegate::ExitFullscreenModeForTab(source);
Emit("leave-html-full-screen");
}
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {