Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 987af6c2271b886ff7cef3465471b2785fb1e1a5..f7ca245b41ef933472983d5d51091d02ee59ad33 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -2697,7 +2697,9 @@ 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 window and tab are active and the call was |
+ // triggered by an automated page refresh. |
+ if (user_initiated && contents_is_selected && window()->IsActive()) |
sky
2012/05/21 20:42:52
Shouldn' this be an or, eg:
if (content_is_select
Mr4D (OOO till 08-26)
2012/05/21 21:27:12
Done. (Wow good catch - somehow didn't think strai
|
contents->web_contents()->Focus(); |
} |
@@ -3409,7 +3411,14 @@ 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 either the tab and window are already active, or this |
+ // was not triggered by an update tab function (through e.g. an automated |
+ // update). |
+ if (params.disposition != CURRENT_TAB || |
+ (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; |