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

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: rebase 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
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

Powered by Google App Engine
This is Rietveld 408576698