Index: chrome/browser/ui/cocoa/browser_window_utils.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_utils.mm b/chrome/browser/ui/cocoa/browser_window_utils.mm |
index 442463d7c5de09cacaee7ae1289912a34fbb0cac..3c6c16a36b9db8bcb08b7df3925e6300ae9e06d2 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_utils.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_utils.mm |
@@ -10,6 +10,8 @@ |
#include "chrome/app/chrome_command_ids.h" |
#include "chrome/browser/global_keyboard_shortcuts_mac.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_list.h" |
+#include "chrome/browser/ui/browser_window.h" |
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
#import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" |
#import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
@@ -186,4 +188,21 @@ const CGFloat kPatternVerticalOffsetNoTabStrip = 3; |
SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly); |
} |
++ (void)selectPreviousActiveBrowserWindow:(Browser*)closedBrowser { |
+ if (![NSApp isActive] || closedBrowser != BrowserList::GetLastActive()) |
+ return; |
+ |
+ // Select previous active window if this is the current active window. |
+ // Otherwise, OSX will always give focus to a Panel window after this one |
+ // is closed because Panels have a higher priority NSWindowLevel. |
+ BrowserList::const_reverse_iterator iter = BrowserList::begin_last_active(); |
+ BrowserList::const_reverse_iterator end = BrowserList::end_last_active(); |
+ for (; iter != end; ++iter) { |
+ Browser* browser = *iter; |
+ if (browser != closedBrowser && |
+ [browser->window()->GetNativeHandle() canBecomeKeyWindow]) { |
+ return browser->window()->Activate(); |
pink (ping after 24hrs)
2012/02/03 14:24:55
you're returning a value from a void method. this
jennb
2012/02/03 18:12:06
return [expression] returns the value of expressio
|
+ } |
+ } |
+} |
@end |