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

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: Fix Popup tests for ChromeOS. 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..5d9a449017157493d9419020d9de56774fc84edc 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);
}
+void BrowserView::AdjustNavigateParams(browser::NavigateParams* params) {
+ if (params->disposition == NEW_POPUP) {
+ // If the popup is larger than a given fraction of the screen, turn it into
+ // a foreground tab. Also check for width or height == 0, which 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 (params->window_bounds.width() > max_width ||
+ params->window_bounds.width() == 0 ||
+ params->window_bounds.height() > max_height ||
+ params->window_bounds.height() == 0) {
+ params->disposition = NEW_FOREGROUND_TAB;
+ }
+ }
+}
+
// views::ContextMenuController overrides.
void BrowserView::ShowContextMenuForView(views::View* source,
const gfx::Point& p,

Powered by Google App Engine
This is Rietveld 408576698