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

Unified Diff: apps/app_shim/extension_app_shim_handler_mac.cc

Issue 14579005: Close all windows when app shim quits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 7 years, 7 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: apps/app_shim/extension_app_shim_handler_mac.cc
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index 9d31d694c01b0108da1fbd655424b845b69e8ccd..902e0c2234ad848b9c978d3474d48013f33cc2ac 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/extensions/application_launch.h"
+#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "ui/base/cocoa/focus_window_set.h"
@@ -73,13 +74,26 @@ void ExtensionAppShimHandler::OnShimFocus(Host* host) {
const extensions::ShellWindowRegistry::ShellWindowList windows =
registry->GetShellWindowsForApp(host->GetAppId());
std::set<gfx::NativeWindow> native_windows;
- for (extensions::ShellWindowRegistry::const_iterator i = windows.begin();
- i != windows.end(); ++i) {
- native_windows.insert((*i)->GetNativeWindow());
+ for (extensions::ShellWindowRegistry::const_iterator it = windows.begin();
+ it != windows.end(); ++it) {
+ native_windows.insert((*it)->GetNativeWindow());
}
ui::FocusWindowSet(native_windows);
}
+void ExtensionAppShimHandler::OnShimQuit(Host* host) {
+ if (!host->GetProfile())
+ return;
+
+ extensions::ShellWindowRegistry::ShellWindowList windows =
+ extensions::ShellWindowRegistry::Get(host->GetProfile())->
+ GetShellWindowsForApp(host->GetAppId());
+ for (extensions::ShellWindowRegistry::const_iterator it = windows.begin();
+ it != windows.end(); ++it) {
+ (*it)->GetBaseWindow()->Close();
+ }
+}
+
bool ExtensionAppShimHandler::LaunchApp(Profile* profile,
const std::string& app_id) {
extensions::ExtensionSystem* extension_system =

Powered by Google App Engine
This is Rietveld 408576698