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

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: Second 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..ad319298cebb406c825f68dfc04a66c00a805481 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -2697,6 +2697,14 @@ void Browser::UpdateUIForNavigationInTab(TabContentsWrapper* contents,
// navigating away from the new tab page.
ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL);
+ // In case of multiple windows we do not want to switch windows when this is
sky 2012/05/21 17:29:15 This comment is confusing.
+ // not user initiated (e.g. automatic page refresh) and the current window
+ // is not the window we are targeting.
+ if (!user_initiated &&
sky 2012/05/21 17:29:15 I think you missed a comment from last round: "Com
Mr4D (OOO till 08-26) 2012/05/21 18:18:37 Ahh. In that case I have misunderstood. Done.
+ (GetSelectedWebContents() != contents->web_contents() ||
+ !window()->IsActive()))
+ return;
+
if (contents_is_selected)
contents->web_contents()->Focus();
}
@@ -3409,7 +3417,13 @@ 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;
+
+ // If the current tab is initiating this, we don't want to update.
sky 2012/05/21 17:29:15 You comment doesn't match what you're doing.
Mr4D (OOO till 08-26) 2012/05/21 18:18:37 Done.
+ if (nav_params.window_action != browser::NavigateParams::NO_ACTION ||
sky 2012/05/21 17:29:15 I don't understand this first check. The default i
Mr4D (OOO till 08-26) 2012/05/21 18:18:37 Done. Yes, that is correct (forgotten to remove th
+ params.disposition != CURRENT_TAB ||
sky 2012/05/21 17:29:15 Why are you checking this?
Mr4D (OOO till 08-26) 2012/05/21 18:18:37 Because when a new thing (Popup / Window / Tab) ge
sky 2012/05/21 20:42:52 I believe Navigate takes care of that for you. See
Mr4D (OOO till 08-26) 2012/05/21 21:27:12 Okay, I removed the special check for the current_
+ (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