| Index: apps/app_shim/app_shim_host_mac.cc
|
| diff --git a/apps/app_shim/app_shim_host_mac.cc b/apps/app_shim/app_shim_host_mac.cc
|
| index 8cff755a21ef674490d6cee2a904e1a9f439fb22..b2d577f3d5499bf21054a39c04679ed281293d7b 100644
|
| --- a/apps/app_shim/app_shim_host_mac.cc
|
| +++ b/apps/app_shim/app_shim_host_mac.cc
|
| @@ -15,8 +15,10 @@
|
| #include "chrome/browser/extensions/shell_window_registry.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/ui/extensions/application_launch.h"
|
| +#include "chrome/browser/ui/extensions/shell_window.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| #include "ipc/ipc_channel_proxy.h"
|
| +#include "ui/base/cocoa/focus_window_set.h"
|
|
|
| AppShimHost::AppShimHost()
|
| : channel_(NULL), profile_(NULL) {
|
| @@ -38,6 +40,7 @@ bool AppShimHost::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(AppShimHost, message)
|
| IPC_MESSAGE_HANDLER(AppShimHostMsg_LaunchApp, OnLaunchApp)
|
| + IPC_MESSAGE_HANDLER(AppShimHostMsg_FocusApp, OnFocus)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
|
|
| @@ -55,6 +58,23 @@ void AppShimHost::OnLaunchApp(std::string profile_dir, std::string app_id) {
|
| Send(new AppShimMsg_LaunchApp_Done(success));
|
| }
|
|
|
| +void AppShimHost::OnFocus() {
|
| + DCHECK(CalledOnValidThread());
|
| + if (!profile_)
|
| + return;
|
| + extensions::ShellWindowRegistry* registry =
|
| + extensions::ShellWindowRegistry::Get(profile_);
|
| + const std::set<ShellWindow*> windows =
|
| + registry->GetShellWindowsForApp(app_id_);
|
| + std::set<gfx::NativeWindow> native_windows;
|
| + for (std::set<ShellWindow*>::const_iterator i = windows.begin();
|
| + i != windows.end();
|
| + ++i) {
|
| + native_windows.insert((*i)->GetNativeWindow());
|
| + }
|
| + ui::FocusWindowSet(native_windows);
|
| +}
|
| +
|
| bool AppShimHost::LaunchAppImpl(const std::string& profile_dir,
|
| const std::string& app_id) {
|
| DCHECK(CalledOnValidThread());
|
|
|