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

Unified Diff: chrome/browser/chromeos/frame/browser_view.cc

Issue 6881073: Cleanup popup related browser navigation code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and merge with avi's popup block changes. Created 9 years, 8 months 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
Index: chrome/browser/chromeos/frame/browser_view.cc
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index 8d02d6bd5eba51f12a5fd870d60200bce22834a6..d3362980a2464f3b1582bd4362719b8044df52f9 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -42,6 +42,9 @@ namespace {
// Amount to offset the toolbar by when vertical tabs are enabled.
const int kVerticalTabStripToolbarOffset = 2;
+// If a popup window is larger than this fraction of the screen, create a tab.
+const float kPopupMaxWidthFactor = 0.5;
+const float kPopupMaxHeightFactor = 0.6;
} // namespace
@@ -315,6 +318,23 @@ void BrowserView::Paste() {
gtk_util::DoPaste(this);
}
+WindowOpenDisposition BrowserView::GetDispositionForPopupBounds(
+ const gfx::Rect& bounds) {
+ // 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.
+ GdkScreen* screen = gdk_screen_get_default();
+ int max_width = gdk_screen_get_width(screen) * kPopupMaxWidthFactor;
+ int max_height = gdk_screen_get_height(screen) * kPopupMaxHeightFactor;
+ if (bounds.width() > max_width ||
+ bounds.width() == 0 ||
+ bounds.height() > max_height ||
+ bounds.height() == 0) {
+ return NEW_FOREGROUND_TAB;
+ }
+ return NEW_POPUP;
+}
+
// views::ContextMenuController overrides.
void BrowserView::ShowContextMenuForView(views::View* source,
const gfx::Point& p,

Powered by Google App Engine
This is Rietveld 408576698