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

@ -94,8 +94,6 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
is_closed_(false),
node_integration_(true),
has_dialog_attached_(false),
html_fullscreen_(false),
native_fullscreen_(false),
zoom_factor_(1.0),
weak_factory_(this) {
printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
@ -431,25 +429,6 @@ void NativeWindow::OverrideWebkitPrefs(content::WebPreferences* prefs) {
}
}
void NativeWindow::SetHtmlApiFullscreen(bool enter_fullscreen) {
// Window is already in fullscreen mode, save the state.
if (enter_fullscreen && IsFullscreen()) {
native_fullscreen_ = true;
html_fullscreen_ = true;
return;
}
// Exit html fullscreen state but not window's fullscreen mode.
if (!enter_fullscreen && native_fullscreen_) {
html_fullscreen_ = false;
return;
}
SetFullScreen(enter_fullscreen);
html_fullscreen_ = enter_fullscreen;
native_fullscreen_ = false;
}
void NativeWindow::NotifyWindowClosed() {
if (is_closed_)
return;
@ -647,20 +626,6 @@ void NativeWindow::RendererResponsive(content::WebContents* source) {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererResponsive());
}
void NativeWindow::EnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin) {
SetHtmlApiFullscreen(true);
}
void NativeWindow::ExitFullscreenModeForTab(content::WebContents* source) {
SetHtmlApiFullscreen(false);
}
bool NativeWindow::IsFullscreenForTabOrPending(
const content::WebContents* source) const {
return is_html_api_fullscreen();
}
void NativeWindow::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
// Do nothing, we override this method just to avoid compilation error since
// there are two virtual functions named BeforeUnloadFired.