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

Unified Diff: chrome/browser/views/frame/browser_view.cc

Issue 99248: Don't show popups before tabs have been added. Instead, prevent the BrowserVi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 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 | « chrome/browser/browser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/frame/browser_view.cc
===================================================================
--- chrome/browser/views/frame/browser_view.cc (revision 14954)
+++ chrome/browser/views/frame/browser_view.cc (working copy)
@@ -901,9 +901,8 @@
// We do not store the focus when closing the tab to work-around bug 4633.
// Some reports seem to show that the focus manager and/or focused view can
// be garbage at that point, it is not clear why.
- if (old_contents && !old_contents->is_being_destroyed() &&
- old_contents->AsWebContents())
- old_contents->AsWebContents()->view()->StoreFocus();
+ if (old_contents && !old_contents->is_being_destroyed())
+ old_contents->view()->StoreFocus();
// Update various elements that are interested in knowing the current
// TabContents.
@@ -916,8 +915,10 @@
new_contents->DidBecomeSelected();
if (BrowserList::GetLastActive() == browser_ &&
!browser_->tabstrip_model()->closing_all() &&
- new_contents->AsWebContents()) {
- new_contents->AsWebContents()->view()->RestoreFocus();
+ GetWidget()->GetWindow()->IsVisible()) {
+ // We only restore focus if our window is visible, to avoid invoking blur
+ // handlers when we are eventually shown.
+ new_contents->view()->RestoreFocus();
}
// Update all the UI bits.
« no previous file with comments | « chrome/browser/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698