summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 17:39:58 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 17:39:58 +0000
commit0b17b7dce8c421c318dab5722b9a28f1c6153f39 (patch)
tree70bc61d81d08514cadc95c0fb8877d2007ed550f
parent56e68c8b867337cf5d3661935a08b1172aba4a63 (diff)
downloadchromium_src-0b17b7dce8c421c318dab5722b9a28f1c6153f39.zip
chromium_src-0b17b7dce8c421c318dab5722b9a28f1c6153f39.tar.gz
chromium_src-0b17b7dce8c421c318dab5722b9a28f1c6153f39.tar.bz2
Fix some navigation bugs.
Set ADD_SELECTED to foreground/singleton tabs, and set show_window when a new window is created during Navigate(). BUG=62022,62137,62545,62923,63019 TEST=see bugs Review URL: http://codereview.chromium.org/4647007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66457 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/browser_navigator.cc39
-rw-r--r--chrome/browser/ui/browser_navigator.h7
2 files changed, 33 insertions, 13 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 4a40d0e..c9c0d5a 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -203,17 +203,27 @@ void NormalizeDisposition(browser::NavigateParams* params) {
params->disposition = NEW_FOREGROUND_TAB;
}
- // Disposition trumps add types. ADD_SELECTED is a default, so we need to
- // remove it if disposition implies the tab is going to open in the
- // background.
- if (params->disposition == NEW_BACKGROUND_TAB)
- params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED;
-
- // Code that wants to open a new window typically expects it to be shown
- // automatically.
- if (params->disposition == NEW_WINDOW || params->disposition == NEW_POPUP) {
- params->show_window = true;
- params->tabstrip_add_types |= TabStripModel::ADD_SELECTED;
+ switch (params->disposition) {
+ case NEW_BACKGROUND_TAB:
+ // Disposition trumps add types. ADD_SELECTED is a default, so we need to
+ // remove it if disposition implies the tab is going to open in the
+ // background.
+ params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED;
+ break;
+
+ case NEW_WINDOW:
+ case NEW_POPUP:
+ // Code that wants to open a new window typically expects it to be shown
+ // automatically.
+ params->show_window = true;
+ // Fall-through.
+ case NEW_FOREGROUND_TAB:
+ case SINGLETON_TAB:
+ params->tabstrip_add_types |= TabStripModel::ADD_SELECTED;
+ break;
+
+ default:
+ break;
}
}
@@ -304,6 +314,7 @@ NavigateParams::~NavigateParams() {
}
void Navigate(NavigateParams* params) {
+ Browser* browser = params->browser;
AdjustNavigateParamsForURL(params);
params->browser = GetBrowserForDisposition(params);
@@ -311,6 +322,12 @@ void Navigate(NavigateParams* params) {
return;
// Navigate() must not return early after this point.
+ if (browser != params->browser &&
+ params->browser->tabstrip_model()->empty()) {
+ // A new window has been created. So it needs to be displayed.
+ params->show_window = true;
+ }
+
// Make sure the Browser is shown if params call for it.
ScopedBrowserDisplayer displayer(params);
diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h
index aee08db..1d3020d4 100644
--- a/chrome/browser/ui/browser_navigator.h
+++ b/chrome/browser/ui/browser_navigator.h
@@ -80,10 +80,11 @@ struct NavigateParams {
// CURRENT_TAB " " " NEW_FOREGROUND_TAB
// OFF_THE_RECORD target browser profile is incog. NEW_FOREGROUND_TAB
//
- // If disposition is NEW_WINDOW or NEW_POPUP, |show_window| is set to true
- // automatically.
// If disposition is NEW_BACKGROUND_TAB, TabStripModel::ADD_SELECTED is
// removed from |tabstrip_add_types| automatically.
+ // If disposition is one of NEW_WINDOW, NEW_POPUP, NEW_FOREGROUND_TAB or
+ // SINGLETON_TAB, then TabStripModel::ADD_SELECTED is automatically added to
+ // |tabstrip_add_types|.
WindowOpenDisposition disposition;
// The transition type of the navigation. Default is PageTransition::LINK
@@ -114,6 +115,8 @@ struct NavigateParams {
// True if the target window should be made visible at the end of the call
// to Navigate(). This activates the window if it was already visible.
// Default is false.
+ // If disposition is NEW_WINDOW or NEW_POPUP, |show_window| is set to true
+ // automatically.
bool show_window;
// [in] Specifies a Browser object where the navigation could occur or the