Chromium Code Reviews| Index: chrome/browser/ui/fullscreen_controller.cc |
| diff --git a/chrome/browser/ui/fullscreen_controller.cc b/chrome/browser/ui/fullscreen_controller.cc |
| index c1636ad58f83297aa5fbec936199438f218ecde4..8db75956deefbd894f50bc71ea9659ac59a03a43 100644 |
| --- a/chrome/browser/ui/fullscreen_controller.cc |
| +++ b/chrome/browser/ui/fullscreen_controller.cc |
| @@ -15,6 +15,7 @@ |
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/chrome_switches.h" |
| +#include "chrome/common/extensions/extension.h" |
| #include "content/browser/renderer_host/render_view_host.h" |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/browser/user_metrics.h" |
| @@ -110,9 +111,9 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, |
| if (!in_browser_or_tab_fullscreen_mode) { |
| tab_caused_fullscreen_ = true; |
| #if defined(OS_MACOSX) |
| - TogglePresentationMode(true); |
| + TogglePresentationModeInternal(true); |
| #else |
| - ToggleFullscreenMode(true); |
| + ToggleFullscreenModeInternal(true, NULL); |
| #endif |
| } else { |
| // We need to update the fullscreen exit bubble, e.g., going from browser |
| @@ -128,9 +129,9 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, |
| if (in_browser_or_tab_fullscreen_mode) { |
| if (tab_caused_fullscreen_) { |
| #if defined(OS_MACOSX) |
| - TogglePresentationMode(true); |
| + TogglePresentationModeInternal(true); |
| #else |
| - ToggleFullscreenMode(true); |
| + ToggleFullscreenModeInternal(true, NULL); |
| #endif |
| } else { |
| // If currently there is a tab in "tab fullscreen" mode and fullscreen |
| @@ -145,7 +146,11 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, |
| } |
| #if defined(OS_MACOSX) |
| -void FullscreenController::TogglePresentationMode(bool for_tab) { |
| +void FullscreenController::TogglePresentationMode() { |
| + TogglePresentationModeInternal(false); |
| +} |
| + |
| +void FullscreenController::TogglePresentationModeInternal(bool for_tab) { |
| bool entering_fullscreen = !window_->InPresentationMode(); |
| GURL url; |
| if (for_tab) { |
| @@ -161,8 +166,18 @@ void FullscreenController::TogglePresentationMode(bool for_tab) { |
| } |
| #endif |
| +void FullscreenController::ToggleFullscreenMode() { |
| + ToggleFullscreenModeInternal(false, NULL); |
| +} |
| + |
| +void FullscreenController::ToggleFullscreenModeWithExtension( |
| + const Extension& extension) { |
| + ToggleFullscreenModeInternal(false, &extension); |
| +} |
| + |
| // TODO(koz): Change |for_tab| to an enum. |
| -void FullscreenController::ToggleFullscreenMode(bool for_tab) { |
| +void FullscreenController::ToggleFullscreenModeInternal( |
| + bool for_tab, const Extension* extension) { |
| bool entering_fullscreen = !window_->IsFullscreen(); |
| #if !defined(OS_MACOSX) |
| @@ -179,12 +194,18 @@ void FullscreenController::ToggleFullscreenMode(bool for_tab) { |
| tab_fullscreen_accepted_ = entering_fullscreen && |
| GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
| } else { |
| + if (extension) |
| + url = extension->url(); |
| content::RecordAction(UserMetricsAction("ToggleFullscreen")); |
| } |
| - if (entering_fullscreen) |
| - window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); |
| - else |
| + if (entering_fullscreen) { |
| + const FullscreenExitBubbleType exit_bubble_type = |
| + extension ? FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION : |
| + GetFullscreenExitBubbleType(); |
|
scheib
2012/02/07 18:55:10
Can this logic be kept inside GetFullscreenExitBub
hashimoto
2012/02/08 02:43:18
Done.
|
| + window_->EnterFullscreen(url, exit_bubble_type); |
| + } else { |
| window_->ExitFullscreen(); |
| + } |
| // Once the window has become fullscreen it'll call back to |
| // WindowFullscreenStateChanged(). We don't do this immediately as |
| @@ -314,7 +335,7 @@ void FullscreenController::NotifyTabOfFullscreenExitIfNecessary() { |
| void FullscreenController::ExitTabbedFullscreenModeIfNecessary() { |
| if (tab_caused_fullscreen_) |
| - ToggleFullscreenMode(false); |
| + ToggleFullscreenMode(); |
| else |
| NotifyTabOfFullscreenExitIfNecessary(); |
| } |