| Index: chrome/browser/ui/browser.cc
|
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
| index 987af6c2271b886ff7cef3465471b2785fb1e1a5..3318e54f18c6a60cc19365fc783da0d6664817a2 100644
|
| --- a/chrome/browser/ui/browser.cc
|
| +++ b/chrome/browser/ui/browser.cc
|
| @@ -2697,7 +2697,11 @@ void Browser::UpdateUIForNavigationInTab(TabContentsWrapper* contents,
|
| // navigating away from the new tab page.
|
| ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL);
|
|
|
| - if (contents_is_selected)
|
| + // Focus on the content if the content is active and it is user initated
|
| + // or if the window is active as well as the tab - or in other words:
|
| + // Don't focus when the user did not initate the navigation or the window
|
| + // and tab are not active.
|
| + if (contents_is_selected && (user_initiated || window()->IsActive()))
|
| contents->web_contents()->Focus();
|
| }
|
|
|
| @@ -3409,7 +3413,11 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
|
| nav_params.referrer = params.referrer;
|
| nav_params.disposition = params.disposition;
|
| nav_params.tabstrip_add_types = TabStripModel::ADD_NONE;
|
| - nav_params.window_action = browser::NavigateParams::SHOW_WINDOW;
|
| +
|
| + // Show the tab if the window and tab was already active.
|
| + if (GetSelectedWebContents() == source && window()->IsActive())
|
| + nav_params.window_action = browser::NavigateParams::SHOW_WINDOW;
|
| +
|
| nav_params.user_gesture = true;
|
| nav_params.override_encoding = params.override_encoding;
|
| nav_params.is_renderer_initiated = params.is_renderer_initiated;
|
|
|