summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/browser_window.h15
-rw-r--r--chrome/browser/ui/cocoa/applescript/window_applescript.mm6
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.h8
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm25
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm45
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.h3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm14
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_unittest.mm6
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller.cc44
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc18
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc36
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc60
-rw-r--r--chrome/test/base/test_browser_window.cc6
-rw-r--r--chrome/test/base/test_browser_window.h8
14 files changed, 177 insertions, 117 deletions
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index d6d2fce..6cd817d 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -301,13 +301,14 @@ class BrowserWindow : public BaseWindow {
// Opens the tabpose view.
virtual void OpenTabpose() = 0;
- // Sets the presentation mode for the window. If the window is not already in
- // fullscreen, also enters fullscreen mode.
- virtual void EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) = 0;
- virtual void ExitPresentationMode() = 0;
- virtual bool InPresentationMode() = 0;
+ // Enters Mac specific fullscreen mode with chrome displayed (e.g. omnibox)
+ // on OSX 10.7+, a.k.a. Lion Fullscreen mode.
+ // Invalid to call on OSX earlier than 10.7.
+ // Enters either from non fullscreen, or from fullscreen without chrome.
+ // Exit to normal fullscreen with EnterFullscreen().
+ virtual void EnterFullscreenWithChrome() = 0;
+ virtual bool IsFullscreenWithChrome() = 0;
+ virtual bool IsFullscreenWithoutChrome() = 0;
#endif
// Returns the desired bounds for Instant in screen coordinates. Note that if
diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
index abb38d4..1f3b7bb 100644
--- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
@@ -249,20 +249,20 @@
- (NSNumber*)presenting {
BOOL presentingValue = NO;
if (browser_->window())
- presentingValue = browser_->window()->InPresentationMode();
+ presentingValue = browser_->window()->IsFullscreenWithoutChrome();
return [NSNumber numberWithBool:presentingValue];
}
- (void)handlesEnterPresentationMode:(NSScriptCommand*)command {
if (browser_->window()) {
- browser_->window()->EnterPresentationMode(
+ browser_->window()->EnterFullscreen(
GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION);
}
}
- (void)handlesExitPresentationMode:(NSScriptCommand*)command {
if (browser_->window())
- browser_->window()->ExitPresentationMode();
+ browser_->window()->ExitFullscreen();
}
@end
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h
index 060972d..59095c3 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h
@@ -127,11 +127,9 @@ class BrowserWindowCocoa :
virtual void Copy() OVERRIDE;
virtual void Paste() OVERRIDE;
virtual void OpenTabpose() OVERRIDE;
- virtual void EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) OVERRIDE;
- virtual void ExitPresentationMode() OVERRIDE;
- virtual bool InPresentationMode() OVERRIDE;
+ virtual void EnterFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithoutChrome() OVERRIDE;
virtual gfx::Rect GetInstantBounds() OVERRIDE;
virtual WindowOpenDisposition GetDispositionForPopupBounds(
const gfx::Rect& bounds) OVERRIDE;
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 9ea43b82..2099c1e 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -339,8 +339,8 @@ void BrowserWindowCocoa::Restore() {
void BrowserWindowCocoa::EnterFullscreen(
const GURL& url, FullscreenExitBubbleType bubble_type) {
- [controller_ enterFullscreenForURL:url
- bubbleType:bubble_type];
+ [controller_ enterPresentationModeForURL:url
+ bubbleType:bubble_type];
}
void BrowserWindowCocoa::ExitFullscreen() {
@@ -354,6 +354,8 @@ void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent(
}
bool BrowserWindowCocoa::IsFullscreen() const {
+ if ([controller_ inPresentationMode])
+ CHECK([controller_ isFullscreen]); // Presentation mode must be fullscreen.
return [controller_ isFullscreen];
}
@@ -586,19 +588,20 @@ void BrowserWindowCocoa::OpenTabpose() {
[controller_ openTabpose];
}
-void BrowserWindowCocoa::EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) {
- [controller_ enterPresentationModeForURL:url
- bubbleType:bubble_type];
+void BrowserWindowCocoa::EnterFullscreenWithChrome() {
+ CHECK(base::mac::IsOSLionOrLater());
+ if ([controller_ inPresentationMode])
+ [controller_ exitPresentationMode];
+ else
+ [controller_ enterFullscreen];
}
-void BrowserWindowCocoa::ExitPresentationMode() {
- [controller_ exitPresentationMode];
+bool BrowserWindowCocoa::IsFullscreenWithChrome() {
+ return IsFullscreen() && ![controller_ inPresentationMode];
}
-bool BrowserWindowCocoa::InPresentationMode() {
- return [controller_ inPresentationMode];
+bool BrowserWindowCocoa::IsFullscreenWithoutChrome() {
+ return IsFullscreen() && [controller_ inPresentationMode];
}
gfx::Rect BrowserWindowCocoa::GetInstantBounds() {
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm b/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm
index 402aa79..77d8b0d 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/mac/mac_util.h"
#include "base/memory/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
@@ -48,20 +49,29 @@ TEST_F(BrowserWindowCocoaTest, TestBookmarkBarVisible) {
}
@interface FakeController : NSWindowController {
- BOOL fullscreen_;
+ enum { kNormal, kFullscreen, kPresentation } windowState_;
}
@end
@implementation FakeController
-- (void)enterFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType {
- fullscreen_ = YES;
+- (void)enterFullscreen {
+ windowState_ = kFullscreen;
}
- (void)exitFullscreen {
- fullscreen_ = NO;
+ windowState_ = kNormal;
}
- (BOOL)isFullscreen {
- return fullscreen_;
+ return windowState_ != kNormal;
+}
+- (void)enterPresentationModeForURL:(const GURL&)url
+ bubbleType:(FullscreenExitBubbleType)bubbleType {
+ windowState_ = kPresentation;
+}
+- (void)exitPresentationMode {
+ windowState_ = kNormal;
+}
+- (BOOL)inPresentationMode {
+ return windowState_ == kPresentation;
}
@end
@@ -76,7 +86,28 @@ TEST_F(BrowserWindowCocoaTest, TestFullscreen) {
EXPECT_FALSE(bwc->IsFullscreen());
bwc->EnterFullscreen(GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION);
- EXPECT_TRUE(bwc->IsFullscreen());
+ EXPECT_FALSE(bwc->IsFullscreenWithChrome());
+ EXPECT_TRUE(bwc->IsFullscreenWithoutChrome());
+ bwc->ExitFullscreen();
+ EXPECT_FALSE(bwc->IsFullscreen());
+ [fake_controller close];
+}
+
+TEST_F(BrowserWindowCocoaTest, TestFullscreenWithChrome) {
+ if (!base::mac::IsOSLionOrLater())
+ return;
+ // Wrap the FakeController in a scoped_nsobject instead of autoreleasing in
+ // windowWillClose: because we never actually open a window in this test (so
+ // windowWillClose: never gets called).
+ scoped_nsobject<FakeController> fake_controller(
+ [[FakeController alloc] init]);
+ scoped_ptr<BrowserWindowCocoa> bwc(new BrowserWindowCocoa(
+ browser(), static_cast<BrowserWindowController*>(fake_controller.get())));
+
+ EXPECT_FALSE(bwc->IsFullscreen());
+ bwc->EnterFullscreenWithChrome();
+ EXPECT_TRUE(bwc->IsFullscreenWithChrome());
+ EXPECT_FALSE(bwc->IsFullscreenWithoutChrome());
bwc->ExitFullscreen();
EXPECT_FALSE(bwc->IsFullscreen());
[fake_controller close];
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h
index 35921dc..a395044 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller.h
@@ -390,8 +390,7 @@ class WebContents;
// Enters (or exits) fullscreen mode. This method is safe to call on all OS
// versions.
-- (void)enterFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType;
+- (void)enterFullscreen;
- (void)exitFullscreen;
// Updates the contents of the fullscreen exit bubble with |url| and
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 384a536..70f8209 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -2007,9 +2007,7 @@ willAnimateFromState:(BookmarkBar::State)oldState
// "Enter Full Screen" menu item. On Snow Leopard, this function is never
// called by the UI directly, but it provides the implementation for
// |-setPresentationMode:|.
-- (void)setFullscreen:(BOOL)fullscreen
- url:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType {
+- (void)setFullscreen:(BOOL)fullscreen {
if (fullscreen == [self isFullscreen])
return;
@@ -2028,14 +2026,12 @@ willAnimateFromState:(BookmarkBar::State)oldState
}
}
-- (void)enterFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType {
- [self setFullscreen:YES url:url bubbleType:bubbleType];
+- (void)enterFullscreen {
+ [self setFullscreen:YES];
}
- (void)exitFullscreen {
- // url: and bubbleType: are ignored when leaving fullscreen.
- [self setFullscreen:NO url:GURL() bubbleType:FEB_TYPE_NONE];
+ [self setFullscreen:NO];
}
- (void)updateFullscreenExitBubbleURL:(const GURL&)url
@@ -2065,7 +2061,7 @@ willAnimateFromState:(BookmarkBar::State)oldState
// Presentation mode on Snow Leopard maps directly to fullscreen mode.
if (base::mac::IsOSSnowLeopard()) {
- [self setFullscreen:presentationMode url:url bubbleType:bubbleType];
+ [self setFullscreen:presentationMode];
return;
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
index dad7acf..f0ce63a 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
@@ -850,8 +850,7 @@ TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreen) {
[controller_ showWindow:nil];
EXPECT_FALSE([controller_ isFullscreen]);
- [controller_ enterFullscreenForURL:GURL()
- bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION];
+ [controller_ enterFullscreen];
WaitForFullScreenTransition();
EXPECT_TRUE([controller_ isFullscreen]);
@@ -872,8 +871,7 @@ TEST_F(BrowserWindowFullScreenControllerTest, TestActivate) {
[controller_ activate];
EXPECT_TRUE(IsFrontWindow([controller_ window]));
- [controller_ enterFullscreenForURL:GURL()
- bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION];
+ [controller_ enterFullscreen];
WaitForFullScreenTransition();
[controller_ activate];
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.cc b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
index 5f9ab4e..080bfb8 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
@@ -24,6 +24,10 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif
+
using content::RenderViewHost;
using content::UserMetricsAction;
using content::WebContents;
@@ -83,9 +87,6 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents,
#endif
bool in_browser_or_tab_fullscreen_mode = window_->IsFullscreen();
-#if defined(OS_MACOSX)
- in_browser_or_tab_fullscreen_mode |= window_->InPresentationMode();
-#endif
if (enter_fullscreen) {
SetFullscreenedTab(web_contents);
@@ -252,9 +253,7 @@ void FullscreenController::WindowFullscreenStateChanged() {
reentrant_window_state_change_call_check_ = true;
bool exiting_fullscreen = !window_->IsFullscreen();
-#if defined(OS_MACOSX)
- exiting_fullscreen &= !window_->InPresentationMode();
-#endif
+
PostFullscreenChangeNotification(!exiting_fullscreen);
if (exiting_fullscreen)
NotifyTabOfExitIfNecessary();
@@ -275,10 +274,15 @@ bool FullscreenController::HandleUserPressedEscape() {
}
void FullscreenController::ExitTabOrBrowserFullscreenToPreviousState() {
- if (IsFullscreenForTabOrPending())
+ if (IsFullscreenForTabOrPending()) {
ExitTabFullscreenOrMouseLockIfNecessary();
- else if (IsFullscreenForBrowser())
+ } else if (IsFullscreenForBrowser()) {
+#if defined(OS_MACOSX)
+ TogglePresentationMode();
+#else
ToggleFullscreenMode();
+#endif
+ }
}
void FullscreenController::OnAcceptFullscreenPermission() {
@@ -501,6 +505,12 @@ void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) {
#endif
toggled_into_fullscreen_ = !window_->IsFullscreen();
+#if defined(OS_MACOSX)
+ // When a Mac user requests a toggle they may be transitioning from
+ // FullscreenWithoutChrome to FullscreenWithChrome.
+ if (!IsFullscreenForTabOrPending())
+ toggled_into_fullscreen_ |= window_->IsFullscreenWithoutChrome();
+#endif
// In kiosk mode, we always want to be fullscreen. When the browser first
// starts we're not yet fullscreen, so let the initial toggle go through.
@@ -519,19 +529,21 @@ void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) {
content::RecordAction(UserMetricsAction("ToggleFullscreen"));
}
if (toggled_into_fullscreen_) {
+#if defined(OS_MACOSX)
+ CHECK(!for_tab); // EnterFullscreenWithChrome invalid for tab fullscreen.
+ CHECK(base::mac::IsOSLionOrLater());
+ window_->EnterFullscreenWithChrome();
+#else
window_->EnterFullscreen(url, GetFullscreenExitBubbleType());
+#endif
} else {
#if defined(OS_MACOSX)
// Mac windows report a state change instantly, and so we must also clear
// tab_caused_fullscreen_ to match them else other logic using
// tab_caused_fullscreen_ will be incorrect.
NotifyTabOfExitIfNecessary();
-
- if (window_->InPresentationMode() && !for_tab)
- window_->ExitPresentationMode();
- else
#endif
- window_->ExitFullscreen();
+ window_->ExitFullscreen();
extension_caused_fullscreen_ = GURL();
}
UpdateFullscreenExitBubbleContent();
@@ -544,15 +556,15 @@ void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) {
#if defined(OS_MACOSX)
void FullscreenController::TogglePresentationModeInternal(bool for_tab) {
- toggled_into_fullscreen_ = !window_->InPresentationMode();
+ toggled_into_fullscreen_ = !window_->IsFullscreenWithoutChrome();
GURL url;
if (for_tab) {
url = chrome::GetActiveWebContents(browser_)->GetURL();
tab_fullscreen_accepted_ = toggled_into_fullscreen_ &&
GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW;
}
- if (!window_->InPresentationMode()) {
- window_->EnterPresentationMode(url, GetFullscreenExitBubbleType());
+ if (!window_->IsFullscreenWithoutChrome()) {
+ window_->EnterFullscreen(url, GetFullscreenExitBubbleType());
} else {
window_->ExitFullscreen();
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc
index ff74c5d..7fa124a 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc
@@ -368,19 +368,22 @@ IN_PROC_BROWSER_TEST_F(
{
FullscreenNotificationObserver fullscreen_observer;
EXPECT_FALSE(browser()->window()->IsFullscreen());
- EXPECT_FALSE(browser()->window()->InPresentationMode());
+ EXPECT_FALSE(browser()->window()->IsFullscreenWithChrome());
+ EXPECT_FALSE(browser()->window()->IsFullscreenWithoutChrome());
browser()->ToggleFullscreenModeForTab(tab, true);
fullscreen_observer.Wait();
- ASSERT_TRUE(browser()->window()->IsFullscreen());
- ASSERT_TRUE(browser()->window()->InPresentationMode());
+ EXPECT_TRUE(browser()->window()->IsFullscreen());
+ EXPECT_FALSE(browser()->window()->IsFullscreenWithChrome());
+ EXPECT_TRUE(browser()->window()->IsFullscreenWithoutChrome());
}
{
FullscreenNotificationObserver fullscreen_observer;
browser()->TogglePresentationMode();
fullscreen_observer.Wait();
- ASSERT_FALSE(browser()->window()->IsFullscreen());
- ASSERT_FALSE(browser()->window()->InPresentationMode());
+ EXPECT_FALSE(browser()->window()->IsFullscreen());
+ EXPECT_FALSE(browser()->window()->IsFullscreenWithChrome());
+ EXPECT_FALSE(browser()->window()->IsFullscreenWithoutChrome());
}
if (base::mac::IsOSLionOrLater()) {
@@ -389,8 +392,9 @@ IN_PROC_BROWSER_TEST_F(
FullscreenNotificationObserver fullscreen_observer;
chrome::ToggleFullscreenMode(browser());
fullscreen_observer.Wait();
- ASSERT_TRUE(browser()->window()->IsFullscreen());
- ASSERT_FALSE(browser()->window()->InPresentationMode());
+ EXPECT_TRUE(browser()->window()->IsFullscreen());
+ EXPECT_TRUE(browser()->window()->IsFullscreenWithChrome());
+ EXPECT_FALSE(browser()->window()->IsFullscreenWithoutChrome());
}
}
#endif
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc
index 3a91341..1696e20 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc
@@ -16,6 +16,10 @@
#include "content/public/common/url_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif
+
FullscreenControllerStateTest::FullscreenControllerStateTest()
: state_(STATE_NORMAL),
reentrant_(false) {
@@ -293,7 +297,11 @@ bool FullscreenControllerStateTest::InvokeEvent(Event event) {
switch (event) {
case TOGGLE_FULLSCREEN:
+#if defined(OS_MACOSX)
+ GetFullscreenController()->TogglePresentationMode();
+#else
GetFullscreenController()->ToggleFullscreenMode();
+#endif
break;
case TAB_FULLSCREEN_TRUE:
GetFullscreenController()->ToggleFullscreenModeForTab(
@@ -343,7 +351,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
switch (state_) {
case STATE_NORMAL:
#if defined(OS_MACOSX)
- EXPECT_FALSE(GetBrowser()->window()->InPresentationMode())
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithChrome())
+ << GetAndClearDebugLog();
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithoutChrome())
<< GetAndClearDebugLog();
#endif
EXPECT_FALSE(GetFullscreenController()->IsFullscreenForBrowser())
@@ -355,7 +365,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
break;
case STATE_BROWSER_FULLSCREEN_NO_CHROME:
#if defined(OS_MACOSX)
- EXPECT_FALSE(GetBrowser()->window()->InPresentationMode())
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithChrome())
+ << GetAndClearDebugLog();
+ EXPECT_TRUE(GetBrowser()->window()->IsFullscreenWithoutChrome())
<< GetAndClearDebugLog();
#endif
EXPECT_TRUE(GetFullscreenController()->IsFullscreenForBrowser())
@@ -367,7 +379,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
break;
#if defined(OS_WIN)
case STATE_METRO_SNAP:
- // No expectation for InPresentationMode.
+ // http://crbug.com/169138
+ // No expectation for IsFullscreenWithChrome() or
+ // IsFullscreenWithoutChrome()
// TODO(scheib) IsFullscreenForBrowser and IsFullscreenForTabOrPending
// are returning true and false in interactive tests with real window.
@@ -382,7 +396,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
#endif
case STATE_TAB_FULLSCREEN:
#if defined(OS_MACOSX)
- EXPECT_TRUE(GetBrowser()->window()->InPresentationMode())
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithChrome())
+ << GetAndClearDebugLog();
+ EXPECT_TRUE(GetBrowser()->window()->IsFullscreenWithoutChrome())
<< GetAndClearDebugLog();
#endif
EXPECT_FALSE(GetFullscreenController()->IsFullscreenForBrowser())
@@ -394,7 +410,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
break;
case STATE_TAB_BROWSER_FULLSCREEN:
#if defined(OS_MACOSX)
- EXPECT_FALSE(GetBrowser()->window()->InPresentationMode())
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithChrome())
+ << GetAndClearDebugLog();
+ EXPECT_TRUE(GetBrowser()->window()->IsFullscreenWithoutChrome())
<< GetAndClearDebugLog();
#endif
EXPECT_TRUE(GetFullscreenController()->IsFullscreenForBrowser())
@@ -406,7 +424,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
break;
case STATE_TO_NORMAL:
#if defined(OS_MACOSX)
- EXPECT_FALSE(GetBrowser()->window()->InPresentationMode())
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithChrome())
+ << GetAndClearDebugLog();
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithoutChrome())
<< GetAndClearDebugLog();
#endif
// No expectation for IsFullscreenForBrowser.
@@ -416,7 +436,9 @@ void FullscreenControllerStateTest::VerifyWindowState() {
break;
case STATE_TO_BROWSER_FULLSCREEN_NO_CHROME:
#if defined(OS_MACOSX)
- EXPECT_FALSE(GetBrowser()->window()->InPresentationMode())
+ EXPECT_FALSE(GetBrowser()->window()->IsFullscreenWithChrome())
+ << GetAndClearDebugLog();
+ EXPECT_TRUE(GetBrowser()->window()->IsFullscreenWithoutChrome())
<< GetAndClearDebugLog();
EXPECT_TRUE(GetFullscreenController()->IsFullscreenForBrowser())
<< GetAndClearDebugLog();
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
index 791a9dc..92695b4 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
@@ -51,11 +51,9 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
virtual bool IsInMetroSnapMode() const OVERRIDE;
#endif
#if defined(OS_MACOSX)
- virtual void EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) OVERRIDE;
- virtual void ExitPresentationMode() OVERRIDE;
- virtual bool InPresentationMode() OVERRIDE;
+ virtual void EnterFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithoutChrome() OVERRIDE;
#endif
static const char* GetWindowStateString(WindowState state);
@@ -71,7 +69,7 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
private:
WindowState state_;
- bool mac_presentation_mode_;
+ bool mac_with_chrome_mode_;
Browser* browser_;
// Causes reentrant calls to be made by calling
@@ -82,7 +80,7 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
FullscreenControllerTestWindow::FullscreenControllerTestWindow()
: state_(NORMAL),
- mac_presentation_mode_(false),
+ mac_with_chrome_mode_(false),
browser_(NULL),
reentrant_(false) {
}
@@ -93,6 +91,7 @@ void FullscreenControllerTestWindow::EnterFullscreen(
}
void FullscreenControllerTestWindow::EnterFullscreen() {
+ mac_with_chrome_mode_ = false;
if (!IsFullscreen()) {
state_ = TO_FULLSCREEN;
ChangeWindowFullscreenStateIfReentrant();
@@ -102,7 +101,7 @@ void FullscreenControllerTestWindow::EnterFullscreen() {
void FullscreenControllerTestWindow::ExitFullscreen() {
if (IsFullscreen()) {
state_ = TO_NORMAL;
- mac_presentation_mode_ = false;
+ mac_with_chrome_mode_ = false;
ChangeWindowFullscreenStateIfReentrant();
}
}
@@ -132,22 +131,17 @@ bool FullscreenControllerTestWindow::IsInMetroSnapMode() const {
#endif
#if defined(OS_MACOSX)
-void FullscreenControllerTestWindow::EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) {
- mac_presentation_mode_ = true;
+void FullscreenControllerTestWindow::EnterFullscreenWithChrome() {
EnterFullscreen();
+ mac_with_chrome_mode_ = true;
}
-void FullscreenControllerTestWindow::ExitPresentationMode() {
- if (InPresentationMode()) {
- mac_presentation_mode_ = false;
- ExitFullscreen();
- }
+bool FullscreenControllerTestWindow::IsFullscreenWithChrome() {
+ return IsFullscreen() && mac_with_chrome_mode_;
}
-bool FullscreenControllerTestWindow::InPresentationMode() {
- return mac_presentation_mode_;
+bool FullscreenControllerTestWindow::IsFullscreenWithoutChrome() {
+ return IsFullscreen() && !mac_with_chrome_mode_;
}
#endif
@@ -317,6 +311,20 @@ Browser* FullscreenControllerStateUnitTest::GetBrowser() {
// Tests -----------------------------------------------------------------------
+#define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \
+ TEST_F(FullscreenControllerStateUnitTest, \
+ state##__##event##reentrant_id) { \
+ AddTab(browser(), GURL(chrome::kAboutBlankURL)); \
+ ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \
+ << GetAndClearDebugLog(); \
+ }
+ // Progress of tests can be examined by inserting the following line:
+ // LOG(INFO) << GetAndClearDebugLog(); }
+
+#define TEST_EVENT(state, event) \
+ TEST_EVENT_INNER(state, event, false, ); \
+ TEST_EVENT_INNER(state, event, true, _Reentrant);
+
// Soak tests:
// Tests all states with all permutations of multiple events to detect lingering
@@ -337,20 +345,6 @@ TEST_F(FullscreenControllerStateUnitTest, TransitionsForEachState) {
// Individual tests for each pair of state and event:
-#define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \
- TEST_F(FullscreenControllerStateUnitTest, \
- state##__##event##reentrant_id) { \
- AddTab(browser(), GURL(chrome::kAboutBlankURL)); \
- ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \
- << GetAndClearDebugLog(); \
- }
- // Progress of tests can be examined by inserting the following line:
- // LOG(INFO) << GetAndClearDebugLog(); }
-
-#define TEST_EVENT(state, event) \
- TEST_EVENT_INNER(state, event, false, ); \
- TEST_EVENT_INNER(state, event, true, _Reentrant);
-
TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN);
TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE);
TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE);
diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc
index 0879ea0..3a90f6b 100644
--- a/chrome/test/base/test_browser_window.cc
+++ b/chrome/test/base/test_browser_window.cc
@@ -111,7 +111,11 @@ int TestBrowserWindow::GetExtraRenderViewHeight() const {
}
#if defined(OS_MACOSX)
-bool TestBrowserWindow::InPresentationMode() {
+bool TestBrowserWindow::IsFullscreenWithChrome() {
+ return false;
+}
+
+bool TestBrowserWindow::IsFullscreenWithoutChrome() {
return false;
}
#endif
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index 2556eb4..cbb12d4 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -120,11 +120,9 @@ class TestBrowserWindow : public BrowserWindow {
virtual void Paste() OVERRIDE {}
#if defined(OS_MACOSX)
virtual void OpenTabpose() OVERRIDE {}
- virtual void EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) OVERRIDE {}
- virtual void ExitPresentationMode() OVERRIDE {}
- virtual bool InPresentationMode() OVERRIDE;
+ virtual void EnterFullscreenWithChrome() OVERRIDE {}
+ virtual bool IsFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithoutChrome() OVERRIDE;
#endif
virtual gfx::Rect GetInstantBounds() OVERRIDE;