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

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: Addressed first review 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 42a2b071bc2c148683ed48bfcc60a67688f6b220..43181e73f06a69df2f1166541e7d7fb7477cb953 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -183,6 +183,7 @@
#include "net/base/registry_controlled_domain.h"
#include "net/cookies/cookie_monster.h"
#include "net/url_request/url_request_context.h"
+#include "ui/aura/window.h"
sky 2012/05/21 16:42:50 You shouldn't need this.
Mr4D (OOO till 08-26) 2012/05/21 17:15:43 Done.
#include "ui/base/animation/animation.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/point.h"
@@ -2696,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
+ // 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 16:42:50 Combine this with the Focus() request since that's
Mr4D (OOO till 08-26) 2012/05/21 17:15:43 Done.
+ (GetSelectedWebContents() != contents->web_contents() ||
+ !window()->GetNativeHandle()->HasFocus()))
+ return;
+
if (contents_is_selected)
contents->web_contents()->Focus();
}
@@ -3408,7 +3417,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;
+#if defined(USE_ASH)
sky 2012/05/21 16:42:50 Again, I think you want this every where.
Mr4D (OOO till 08-26) 2012/05/21 17:15:43 Done.
+ // If the current tab is initiating this, we don't want to update.
+ if (nav_params.window_action != browser::NavigateParams::NO_ACTION ||
+ params.disposition != CURRENT_TAB ||
+ (GetSelectedTabContentsWrapper() == nav_params.source_contents &&
sky 2012/05/21 16:42:50 Can you use source instead of nav_aprams.source_co
Mr4D (OOO till 08-26) 2012/05/21 17:15:43 Done.
+ window()->GetNativeHandle()->HasFocus()))
sky 2012/05/21 16:42:50 window()->IsActive()
Mr4D (OOO till 08-26) 2012/05/21 17:15:43 Done.
+#endif
+ 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