Skip to content

Commit

Permalink
Reapply 266653 "[Mac] Allow fullscreen transitions while constrai..."
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ajwong@chromium.org committed Apr 29, 2014
1 parent dd50993 commit aeafc38
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 39 deletions.
8 changes: 1 addition & 7 deletions chrome/browser/ui/browser_command_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/ui/cocoa/browser_window_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2083,9 +2083,6 @@ - (void)setFullscreen:(BOOL)fullscreen {
if (fullscreen == [self isFullscreen])
return;

if (!chrome::IsCommandEnabled(browser_.get(), IDC_FULLSCREEN))
return;

if (fullscreen) {
const BOOL shouldUseSystemFullscreen =
chrome::mac::SupportsSystemFullscreen() && !fullscreenWindow_ &&
Expand Down
14 changes: 14 additions & 0 deletions chrome/browser/ui/cocoa/browser_window_controller_private.mm
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ - (void)layoutSubviews {
// 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -157,16 +155,3 @@ virtual void SetUpOnMainThread() OVERRIDE {
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 changes: 0 additions & 10 deletions chrome/browser/ui/tabs/tab_strip_model_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/ui/tabs/tab_strip_model_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit aeafc38

Please sign in to comment.