Commit 133966f3 authored by sadrul@chromium.org's avatar sadrul@chromium.org

aura: Popup windows too large to fit into the screen (or too small) gets opened in a tab instead.

ChromeOS with aura uses the normal BrowserView, and not chromeos::BrowserView,
so it is necessary to dup this logic in here.

BUG=103484
TEST=browser_tests:BrowserNavigatorTest.Disposition_LargePopup*

Review URL: http://codereview.chromium.org/8595017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110755 0039d316-1c4b-4281-b951-d872f2087c98
parent c219b794
......@@ -112,6 +112,7 @@
#include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/launcher/launcher_model.h"
#include "ui/aura_shell/shell.h"
#include "ui/gfx/screen.h"
#elif defined(OS_WIN)
#include "chrome/browser/aeropeek_manager.h"
#include "chrome/browser/jumplist_win.h"
......@@ -1292,6 +1293,19 @@ gfx::Rect BrowserView::GetInstantBounds() {
WindowOpenDisposition BrowserView::GetDispositionForPopupBounds(
const gfx::Rect& bounds) {
#if defined(USE_AURA) && defined(OS_CHROMEOS)
// If a popup is larger than a given fraction of the screen, turn it into
// a foreground tab. Also check for width or height == 0, which would
// indicate a tab sized popup window.
gfx::Size size = gfx::Screen::GetMonitorAreaNearestWindow(
GetWidget()->GetNativeView()).size();
if (bounds.width() > size.width() ||
bounds.width() == 0 ||
bounds.height() > size.height() ||
bounds.height() == 0) {
return NEW_FOREGROUND_TAB;
}
#endif
return NEW_POPUP;
}
......
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