Index: chrome/browser/ui/fullscreen/fullscreen_controller.cc |
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.cc b/chrome/browser/ui/fullscreen/fullscreen_controller.cc |
index c84260cbf1ad6cbc2091848882d1e2388d0c8454..ffd08bff3a030e696062410a776d12724c1b7809 100644 |
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.cc |
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.cc |
@@ -47,6 +47,7 @@ FullscreenController::FullscreenController(Browser* browser) |
tab_fullscreen_accepted_(false), |
toggled_into_fullscreen_(false), |
mouse_lock_tab_(NULL), |
+ is_presentation_browser_fullscreen(false), |
mouse_lock_state_(MOUSELOCK_NOT_REQUESTED), |
reentrant_window_state_change_call_check_(false), |
is_privileged_fullscreen_for_testing_(false), |
@@ -167,6 +168,15 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents, |
} |
} |
+void FullscreenController::TogglePresentationMode() { |
+ extension_caused_fullscreen_ = GURL(); |
+ ToggleFullscreenModeInternal(PRESENTATION); |
+} |
+ |
+bool FullscreenController::IsPresentationFullscreen() { |
+ return is_presentation_browser_fullscreen; |
+} |
+ |
void FullscreenController::ToggleFullscreenModeWithExtension( |
const GURL& extension_url) { |
// |extension_caused_fullscreen_| will be reset if this causes fullscreen to |
@@ -312,6 +322,11 @@ bool FullscreenController::HandleUserPressedEscape() { |
return true; |
} |
+ if (IsPresentationFullscreen()) { |
+ ExitFullscreenModeInternal(); |
+ return true; |
+ } |
+ |
return false; |
} |
@@ -464,8 +479,11 @@ FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() |
} else { |
if (!extension_caused_fullscreen_.is_empty()) { |
return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; |
- } else if (toggled_into_fullscreen_ && !app_mode) { |
+ } else if (toggled_into_fullscreen_ && !app_mode && |
+ !is_presentation_browser_fullscreen) { |
return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; |
+ } else if (is_presentation_browser_fullscreen) { |
+ return FEB_TYPE_PRESENTATION_FULLSCREEN_EXIT_INSTRUCTION; |
} else { |
return FEB_TYPE_NONE; |
} |
@@ -590,7 +608,7 @@ void FullscreenController::EnterFullscreenModeInternal( |
url = extension_caused_fullscreen_; |
} |
- if (option == BROWSER) |
+ if (option == BROWSER || option == PRESENTATION) |
content::RecordAction(UserMetricsAction("ToggleFullscreen")); |
// TODO(scheib): Record metrics for WITH_CHROME, without counting transitions |
// from tab fullscreen out to browser with chrome. |
@@ -603,6 +621,10 @@ void FullscreenController::EnterFullscreenModeInternal( |
#else |
{ |
#endif |
+ |
+ if (option == PRESENTATION) |
+ is_presentation_browser_fullscreen = true; |
+ |
window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); |
} |
@@ -622,8 +644,12 @@ void FullscreenController::ExitFullscreenModeInternal() { |
// state_prior_to_tab_fullscreen_ will be incorrect. |
NotifyTabOfExitIfNecessary(); |
#endif |
- window_->ExitFullscreen(); |
+ if (is_presentation_browser_fullscreen) |
+ window_->Close(); |
+ else |
+ window_->ExitFullscreen(); |
extension_caused_fullscreen_ = GURL(); |
+ is_presentation_browser_fullscreen = false; |
UpdateFullscreenExitBubbleContent(); |
} |