summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/window_open_apitest.cc6
-rw-r--r--chrome/browser/ui/browser_navigator.cc24
-rw-r--r--chrome/browser/ui/browser_navigator.h7
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest_chromeos.cc40
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc9
5 files changed, 5 insertions, 81 deletions
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index e662447..a0000f7 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -103,15 +103,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupLarge) {
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("window_open").AppendASCII("popup_large")));
-#if defined(OS_CHROMEOS)
- // On ChromeOS this should open a new tab.
- const int num_tabs = 1;
- const int num_popups = 0;
-#else
// On other systems this should open a new popup window.
const int num_tabs = 0;
const int num_popups = 1;
-#endif
WaitForTabsAndPopups(browser(), num_tabs, num_popups, 0);
}
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index c9da239..b9a4f7b 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -427,7 +427,7 @@ void Navigate(NavigateParams* params) {
if (!AdjustNavigateParamsForURL(params))
return;
- // Adjust disposition based on size of popup window.
+ // The browser window may want to adjust the disposition.
if (params->disposition == NEW_POPUP &&
(source_browser && source_browser->window())) {
params->disposition =
@@ -685,26 +685,4 @@ bool IsURLAllowedInIncognito(const GURL& url) {
url.host() == chrome::kChromeUIUberHost));
}
-#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.5f;
-const float kPopupMaxHeightFactor = 0.6f;
-
-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
diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h
index 97eb93f..a6c377e 100644
--- a/chrome/browser/ui/browser_navigator.h
+++ b/chrome/browser/ui/browser_navigator.h
@@ -201,13 +201,6 @@ int GetIndexOfSingletonTab(NavigateParams* params);
// Returns true if the url is allowed to open in incognito window.
bool IsURLAllowedInIncognito(const GURL& url);
-#if defined(OS_CHROMEOS) || defined(USE_AURA)
-// Returns NEW_FOREGROUND_TAB if popup_bounds exceeds a specified percentage
-// of the window size, otherwise returns NEW_POPUP.
-WindowOpenDisposition DispositionForPopupBounds(
- const gfx::Rect& popup_bounds, int window_width, int window_height);
-#endif
-
} // namespace browser
#endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_
diff --git a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
index 4b831e3..478fb4c 100644
--- a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
@@ -57,44 +57,4 @@ IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest,
incognito_browser->GetSelectedWebContents()->GetURL());
}
-// This test verifies that navigating to a large window with
-// WindowOpenDisposition = NEW_POPUP from a normal Browser results in a new tab.
-IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_LargePopup) {
- browser::NavigateParams p(MakeNavigateParams());
- p.disposition = NEW_POPUP;
- p.window_bounds = gfx::Rect(0, 0, 10000, 10000);
- ui_test_utils::NavigateToURL(&p);
-
- // NavigateToURL() should have opened a new tab.
- EXPECT_EQ(browser(), p.browser);
-
- // We should have one window with two tabs.
- EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
-}
-
-// This test verifies that navigating to a large window with
-// WindowOpenDisposition = NEW_POPUP from a popup window results in a new tab
-// in the parent browser.
-IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_LargePopupFromPopup) {
- // Open a popup.
- browser::NavigateParams p1(MakeNavigateParams());
- p1.disposition = NEW_POPUP;
- p1.window_bounds = gfx::Rect(0, 0, 200, 200);
- ui_test_utils::NavigateToURL(&p1);
-
- // Open a large popup from the popup.
- browser::NavigateParams p2(MakeNavigateParams(p1.browser));
- p2.disposition = NEW_POPUP;
- p2.window_bounds = gfx::Rect(0, 0, 10000, 10000);
- ui_test_utils::NavigateToURL(&p2);
-
- // NavigateToURL() should have opened a new tab in the primary browser.
- EXPECT_EQ(browser(), p2.browser);
-
- // We should have two windows. browser() should have two tabs.
- EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
-}
-
} // namespace
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 716b33b..8bbbf16 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1304,14 +1304,13 @@ gfx::Rect BrowserView::GetInstantBounds() {
WindowOpenDisposition BrowserView::GetDispositionForPopupBounds(
const gfx::Rect& bounds) {
+#if defined(OS_WIN)
#if defined(USE_AURA)
- gfx::Size window_size = gfx::Screen::GetMonitorNearestWindow(
- GetWidget()->GetNativeView()).size();
- return browser::DispositionForPopupBounds(
- bounds, window_size.width(), window_size.height());
-#elif defined(OS_WIN)
+ return NEW_POPUP;
+#else
// If we are in windows metro-mode, we can't allow popup windows.
return (base::win::GetMetroModule() == NULL) ? NEW_POPUP : NEW_BACKGROUND_TAB;
+#endif
#else
return NEW_POPUP;
#endif