diff options
6 files changed, 15 insertions, 39 deletions
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 9982ef7..fc95256 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -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. diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 2790cbf..5fd720a 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -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_ && diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index f261abb..65c4c4a 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -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 { diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm index b36e596..76593a3 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm @@ -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(); -} diff --git a/chrome/browser/ui/tabs/tab_strip_model_utils.cc b/chrome/browser/ui/tabs/tab_strip_model_utils.cc index ed09b85..d3ef0d3 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_utils.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_utils.cc @@ -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) { diff --git a/chrome/browser/ui/tabs/tab_strip_model_utils.h b/chrome/browser/ui/tabs/tab_strip_model_utils.h index b66ca39..a21ea4d 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_utils.h +++ b/chrome/browser/ui/tabs/tab_strip_model_utils.h @@ -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, |