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

Unified Diff: ui/base/cocoa/focus_window_set.mm

Issue 12723011: Giving focus to an app shim brings windows belonging to that app to the foreground. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 | « ui/base/cocoa/focus_window_set.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c2b656070f052e6af71a5670fb4fd2af06db1b1f
--- /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* frontmost_window = nil;
+ 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];
+ frontmost_window = win;
+ }
+ }
+ [frontmost_window makeMainWindow];
+ [frontmost_window makeKeyWindow];
+}
+
+} // namespace ui
« no previous file with comments | « ui/base/cocoa/focus_window_set.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698