Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: chrome/browser/ui/browser.cc

Issue 10409034: Fixing activation problem: Pages which refresh themselves should not get focus (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Third review addressed Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698