diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-10 23:31:48 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-10 23:31:48 +0000 |
commit | 637b3444246416fe4c68cd43e53c8ac8a3cc9d3a (patch) | |
tree | 46b4dd13c2416bbf3bb7d40544c58737b3a51e53 /chrome/browser/ui/browser_navigator.cc | |
parent | 9e78974689a785e035d107fcf793880fd338e416 (diff) | |
download | chromium_src-637b3444246416fe4c68cd43e53c8ac8a3cc9d3a.zip chromium_src-637b3444246416fe4c68cd43e53c8ac8a3cc9d3a.tar.gz chromium_src-637b3444246416fe4c68cd43e53c8ac8a3cc9d3a.tar.bz2 |
Fix singleton tab handling with ignore_path when the tab is selected.
The previous fix was in a branch that was only executed when the tab was not selected, so path mismatches weren't being fixed up.
BUG=66084
TEST=Open DOMUI settings, then pick something in the browser UI that should open a specific settings page; it should open in the current tab.
Review URL: http://codereview.chromium.org/6196003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_navigator.cc')
-rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 9f50a36..3c082d8 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -442,35 +442,36 @@ void Navigate(NavigateParams* params) { params->target_contents, params->transition, user_initiated); - } else { - if (params->disposition == SINGLETON_TAB && singleton_index >= 0) { - TabContents* target = params->browser->GetTabContentsAt(singleton_index); - - // Load the URL if the target contents URL doesn't match. This can happen - // if the URL path is ignored when locating the singleton tab. - if (target->GetURL() != params->url) { - target->controller().LoadURL( - params->url, params->referrer, params->transition); - } + } else if (singleton_index == -1) { + // If some non-default value is set for the index, we should tell the + // TabStripModel to respect it. + if (params->tabstrip_index != -1) + params->tabstrip_add_types |= TabStripModel::ADD_FORCE_INDEX; + + // The navigation should insert a new tab into the target Browser. + params->browser->tabstrip_model()->AddTabContents( + params->target_contents, + params->tabstrip_index, + params->transition, + params->tabstrip_add_types); + // Now that the |params->target_contents| is safely owned by the target + // Browser's TabStripModel, we can release ownership. + target_contents_owner.ReleaseOwnership(); + } - // The navigation should re-select an existing tab in the target Browser. - params->browser->SelectTabContentsAt(singleton_index, user_initiated); - } else { - // If some non-default value is set for the index, we should tell the - // TabStripModel to respect it. - if (params->tabstrip_index != -1) - params->tabstrip_add_types |= TabStripModel::ADD_FORCE_INDEX; - - // The navigation should insert a new tab into the target Browser. - params->browser->tabstrip_model()->AddTabContents( - params->target_contents, - params->tabstrip_index, - params->transition, - params->tabstrip_add_types); - // Now that the |params->target_contents| is safely owned by the target - // Browser's TabStripModel, we can release ownership. - target_contents_owner.ReleaseOwnership(); + if (singleton_index >= 0) { + TabContents* target = params->browser->GetTabContentsAt(singleton_index); + + // Load the URL if the target contents URL doesn't match. This can happen + // if the URL path is ignored when locating the singleton tab. + if (target->GetURL() != params->url) { + target->controller().LoadURL( + params->url, params->referrer, params->transition); } + + // If the singleton tab isn't already selected, select it. + if (params->source_contents != params->target_contents) + params->browser->SelectTabContentsAt(singleton_index, user_initiated); } } |