Index: ui/base/cocoa/focus_window_set.mm |
diff --git a/ui/base/cocoa/focus_window_set.mm b/ui/base/cocoa/focus_window_set.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0505f053620afad1e0c74672eda17cc9736a4d91 |
--- /dev/null |
+++ b/ui/base/cocoa/focus_window_set.mm |
@@ -0,0 +1,26 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import <Cocoa/Cocoa.h> |
+ |
+#include "ui/base/cocoa/focus_window_set.h" |
+ |
+namespace ui { |
+ |
+void FocusWindowSet(std::set<NSWindow*> windows) { |
+ NSArray* ordered_windows = [NSApp orderedWindows]; |
+ [NSApp activateIgnoringOtherApps:YES]; |
+ NSWindow* last_window = nil; |
Nico
2013/03/18 22:50:59
Call this frontmost_window maybe
jeremya
2013/03/18 23:17:14
Done.
|
+ for (int i = [ordered_windows count] - 1; i >= 0; i--) { |
+ NSWindow* win = [ordered_windows objectAtIndex:i]; |
+ if (windows.find(win) != windows.end()) { |
+ [win orderFront:nil]; |
+ last_window = win; |
+ } |
+ } |
+ [last_window makeMainWindow]; |
+ [last_window makeKeyWindow]; |
+} |
+ |
+} // namespace ui |