| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 5 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
| 6 | 6 |
| 7 #include "apps/app_lifetime_monitor_factory.h" | 7 #include "apps/app_lifetime_monitor_factory.h" |
| 8 #include "apps/app_shim/app_shim_host_manager_mac.h" | 8 #include "apps/app_shim/app_shim_host_manager_mac.h" |
| 9 #include "apps/app_shim/app_shim_messages.h" | 9 #include "apps/app_shim/app_shim_messages.h" |
| 10 #include "apps/native_app_window.h" | 10 #include "apps/native_app_window.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 Profile* profile = delegate_->ProfileForPath(host->GetProfilePath()); | 290 Profile* profile = delegate_->ProfileForPath(host->GetProfilePath()); |
| 291 | 291 |
| 292 const ShellWindowList windows = | 292 const ShellWindowList windows = |
| 293 delegate_->GetWindows(profile, host->GetAppId()); | 293 delegate_->GetWindows(profile, host->GetAppId()); |
| 294 std::set<gfx::NativeWindow> native_windows; | 294 std::set<gfx::NativeWindow> native_windows; |
| 295 for (ShellWindowList::const_iterator it = windows.begin(); | 295 for (ShellWindowList::const_iterator it = windows.begin(); |
| 296 it != windows.end(); ++it) { | 296 it != windows.end(); ++it) { |
| 297 native_windows.insert((*it)->GetNativeWindow()); | 297 native_windows.insert((*it)->GetNativeWindow()); |
| 298 } | 298 } |
| 299 if (!native_windows.empty()) { | 299 if (!native_windows.empty()) { |
| 300 ui::FocusWindowSet(native_windows); | 300 // Allow workspace switching. For the browser process, we can |
| 301 // reasonably rely on OS X to switch spaces for us and honor |
| 302 // relevant user settings. But shims don't have windows, so we |
| 303 // have to do it ourselves. |
| 304 ui::FocusWindowSet(native_windows, true); |
| 301 return; | 305 return; |
| 302 } | 306 } |
| 303 | 307 |
| 304 if (focus_type == APP_SHIM_FOCUS_REOPEN) { | 308 if (focus_type == APP_SHIM_FOCUS_REOPEN) { |
| 305 const extensions::Extension* extension = | 309 const extensions::Extension* extension = |
| 306 delegate_->GetAppExtension(profile, host->GetAppId()); | 310 delegate_->GetAppExtension(profile, host->GetAppId()); |
| 307 if (extension) { | 311 if (extension) { |
| 308 delegate_->LaunchApp(profile, extension); | 312 delegate_->LaunchApp(profile, extension); |
| 309 } else { | 313 } else { |
| 310 // Extensions may have been uninstalled or disabled since the shim | 314 // Extensions may have been uninstalled or disabled since the shim |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 if (!browser_opened_ever_ && hosts_.empty()) | 413 if (!browser_opened_ever_ && hosts_.empty()) |
| 410 delegate_->MaybeTerminate(); | 414 delegate_->MaybeTerminate(); |
| 411 } | 415 } |
| 412 | 416 |
| 413 void ExtensionAppShimHandler::OnAppStop(Profile* profile, | 417 void ExtensionAppShimHandler::OnAppStop(Profile* profile, |
| 414 const std::string& app_id) {} | 418 const std::string& app_id) {} |
| 415 | 419 |
| 416 void ExtensionAppShimHandler::OnChromeTerminating() {} | 420 void ExtensionAppShimHandler::OnChromeTerminating() {} |
| 417 | 421 |
| 418 } // namespace apps | 422 } // namespace apps |
| OLD | NEW |