summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser_navigator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/browser_navigator.cc')
-rw-r--r--chrome/browser/ui/browser_navigator.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index bbe00e4..8005699 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -647,4 +647,26 @@ bool IsURLAllowedInIncognito(const GURL& url) {
url.host() == chrome::kChromeUISyncPromoHost));
}
+#if defined(OS_CHROMEOS) || defined(USE_AURA)
+// On Chrome desktop platforms (Aura, ChromeOS), if a popup window is larger
+// than this fraction of the screen, create a foreground tab instead.
+const float kPopupMaxWidthFactor = 0.5;
+const float kPopupMaxHeightFactor = 0.6;
+
+WindowOpenDisposition DispositionForPopupBounds(
+ const gfx::Rect& popup_bounds, int window_width, int window_height) {
+ // Check against scaled window bounds. Also check for width or height == 0,
+ // which would indicate a tab sized popup window.
+ int max_width = window_width * kPopupMaxWidthFactor;
+ int max_height = window_height * kPopupMaxHeightFactor;
+ if (popup_bounds.width() > max_width ||
+ popup_bounds.height() > max_height ||
+ popup_bounds.width() == 0 ||
+ popup_bounds.height() == 0) {
+ return NEW_FOREGROUND_TAB;
+ }
+ return NEW_POPUP;
+}
+#endif
+
} // namespace browser