Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3653)

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 8595017: aura: Popup windows too large to fit into the screen (or too small) gets opened in a tab instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 711715d5705a956aa711c98732be20974088ba6e..edc1ea11406d75e8d8baa34b3c78e2ebee3e22d1 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698