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

Unified Diff: chrome/app/chrome_main_app_mode_mac.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 | « apps/app_shim/app_shim_messages.h ('k') | ui/base/cocoa/focus_window_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main_app_mode_mac.mm
diff --git a/chrome/app/chrome_main_app_mode_mac.mm b/chrome/app/chrome_main_app_mode_mac.mm
index a75f38da0fc895a5ae0c5ed6dd30226ff37594b7..513aad296aa0d27ea86caa1548f30b512ffe3cf9 100644
--- a/chrome/app/chrome_main_app_mode_mac.mm
+++ b/chrome/app/chrome_main_app_mode_mac.mm
@@ -51,6 +51,10 @@ class AppShimController : public IPC::Listener {
// shim process should die.
void OnLaunchAppDone(bool success);
+ // Called when the app is activated, either by the user clicking on it in the
+ // dock or by Cmd+Tabbing to it.
+ void OnDidActivateApplication();
+
// Quits the app shim process.
void Quit();
@@ -95,14 +99,30 @@ void AppShimController::OnChannelError() {
}
void AppShimController::OnLaunchAppDone(bool success) {
- if (!success)
+ if (!success) {
Quit();
+ return;
+ }
+ [[[NSWorkspace sharedWorkspace] notificationCenter]
+ addObserverForName:NSWorkspaceDidActivateApplicationNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification* notification) {
+ NSRunningApplication* activated_app =
+ [[notification userInfo] objectForKey:NSWorkspaceApplicationKey];
+ if ([activated_app isEqual:[NSRunningApplication currentApplication]])
+ OnDidActivateApplication();
+ }];
}
void AppShimController::Quit() {
[NSApp terminate:nil];
}
+void AppShimController::OnDidActivateApplication() {
+ channel_->Send(new AppShimHostMsg_FocusApp);
+}
+
//-----------------------------------------------------------------------------
// A ReplyEventHandler is a helper class to send an Apple Event to a process
« no previous file with comments | « apps/app_shim/app_shim_messages.h ('k') | ui/base/cocoa/focus_window_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698