Index: chrome/browser/ui/views/frame/browser_view.cc |
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc |
index bea88d4c5dd496122d36e6e00c880d94a7a244f4..8019f862ea8d1e6643725006860da1fb2b90c6b2 100644 |
--- a/chrome/browser/ui/views/frame/browser_view.cc |
+++ b/chrome/browser/ui/views/frame/browser_view.cc |
@@ -684,6 +684,18 @@ void BrowserView::Show() { |
frame_->Show(); |
+#if !defined(OS_WIN) |
+ // The Browser associated with this browser window must become the active |
+ // browser at the time |Show()| is called. This is the natural behavior under |
+ // Windows and Ash, but other platforms will not trigger |
+ // OnWidgetActivationChanged() until we return to the runloop. Therefore any |
+ // calls to Browser::GetLastActive() will return the wrong result if we do not |
+ // explicitly set it here. |
+ // A similar block also appears in BrowserWindowCocoa::Show(). |
+ if (browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) |
+ BrowserList::SetLastActive(browser()); |
+#endif |
+ |
force_location_bar_focus_ = false; |
browser()->OnWindowDidShow(); |