Commit aeafc385 authored by ajwong@chromium.org's avatar ajwong@chromium.org

Reapply 266653 "[Mac] Allow fullscreen transitions while constrai..."

PrintPreviewTest.TaskManagerNewPrintPreview was something else's fault.

> Revert 266653 "[Mac] Allow fullscreen transitions while constrai..."
> 
> Mac Tests (dbg) failing for PrintPreviewTest.TaskManagerNewPrintPreview
> http://build.chromium.org/p/chromium.mac/builders/Mac%2010.7%20Tests%20%28dbg%29%281%29/builds/23012
> 
> 
> > [Mac] Allow fullscreen transitions while constrained windows are open.
> > 
> > r166410 disabled the browser from entering fullscreen mode when any one
> > tab has a constrained window open (e.g., Print dialog).  However, this
> > is inconsistent with the behavior on all other desktop platforms.  This
> > change removes the restriction.
> > 
> > Landing on behalf of miu@chromium.org manually, as to make a branch cut.
> > 
> > BUG=366567,146451
> > TEST=Repro steps in bug 366567 (easier to understand from the multiple demo videos).  Also, manual testing of browser transition into and out of fullscreen before/after a print dialog is open.
> > R=avi@chromium.org, sky@chromium.org
> > 
> > Review URL: https://codereview.chromium.org/253493005
> 
> TBR=avi@chromium.org
> 
> Review URL: https://codereview.chromium.org/252693007

TBR=ajwong@chromium.org

Review URL: https://codereview.chromium.org/252233003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266899 0039d316-1c4b-4281-b951-d872f2087c98
parent dd509933
......@@ -1260,13 +1260,7 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode() {
// Disable explicit fullscreen toggling when in metro snap mode.
bool fullscreen_enabled = window_state != WINDOW_STATE_METRO_SNAP;
#if defined(OS_MACOSX)
// The Mac implementation doesn't support switching to fullscreen while
// a tab modal dialog is displayed.
int tab_index = chrome::IndexOfFirstBlockedTab(browser_->tab_strip_model());
bool has_blocked_tab = tab_index != browser_->tab_strip_model()->count();
fullscreen_enabled &= !has_blocked_tab;
#else
#if !defined(OS_MACOSX)
if (window_state == WINDOW_STATE_NOT_FULLSCREEN &&
!profile()->GetPrefs()->GetBoolean(prefs::kFullscreenAllowed)) {
// Disable toggling into fullscreen mode if disallowed by pref.
......
......@@ -2083,9 +2083,6 @@ willAnimateFromState:(BookmarkBar::State)oldState
if (fullscreen == [self isFullscreen])
return;
if (!chrome::IsCommandEnabled(browser_.get(), IDC_FULLSCREEN))
return;
if (fullscreen) {
const BOOL shouldUseSystemFullscreen =
chrome::mac::SupportsSystemFullscreen() && !fullscreenWindow_ &&
......
......@@ -277,6 +277,20 @@ willPositionSheet:(NSWindow*)sheet
// Normally, we don't need to tell the toolbar whether or not to show the
// divider, but things break down during animation.
[toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
// Update the position of the active constrained window sheet. We force this
// here because the |sheetParentView| may not have been resized (e.g., to
// prevent jank during a fullscreen mode transition), but constrained window
// sheets also compute their position based on the bookmark bar and toolbar.
content::WebContents* const activeWebContents =
browser_->tab_strip_model()->GetActiveWebContents();
NSView* const sheetParentView = activeWebContents ?
GetSheetParentViewForWebContents(activeWebContents) : nil;
if (sheetParentView) {
[[NSNotificationCenter defaultCenter]
postNotificationName:NSViewFrameDidChangeNotification
object:sheetParentView];
}
}
- (CGFloat)floatingBarHeight {
......
......@@ -4,10 +4,8 @@
#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
......@@ -157,16 +155,3 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabClose) {
TabStripModel::CLOSE_USER_GESTURE));
EXPECT_EQ(1, tab_strip->count());
}
// Test that adding a sheet disables fullscreen.
IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, Fullscreen) {
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
// Dialog will delete it self when closed.
NiceMock<ConstrainedWindowDelegateMock> delegate;
ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
dialog.CloseWebContentsModalDialog();
}
......@@ -10,16 +10,6 @@
namespace chrome {
int IndexOfFirstBlockedTab(const TabStripModel* model) {
DCHECK(model);
for (int i = 0; i < model->count(); ++i) {
if (model->IsTabBlocked(i))
return i;
}
// No blocked tabs.
return model->count();
}
void GetOpenUrls(const TabStripModel& tabs,
const history::TopSites& top_sites,
std::set<std::string>* urls) {
......
......@@ -16,10 +16,6 @@ class TopSites;
namespace chrome {
// Returns the index of the first tab that is blocked. This returns
// |model->count()| if no tab is blocked.
int IndexOfFirstBlockedTab(const TabStripModel* model);
// Creates a set containing the canonical URLs of the currently open tabs.
void GetOpenUrls(const TabStripModel& tabs,
const history::TopSites& top_sites,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment