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

Unified Diff: apps/app_shim/extension_app_shim_handler_mac.mm

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.mm
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.mm
similarity index 89%
rename from apps/app_shim/extension_app_shim_handler_mac.cc
rename to apps/app_shim/extension_app_shim_handler_mac.mm
index 9d31d694c01b0108da1fbd655424b845b69e8ccd..584b01431bd35b38f5ec4947be55aa654e6ca8ef 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.mm
@@ -4,6 +4,8 @@
#include "apps/app_shim/extension_app_shim_handler_mac.h"
+#import <Cocoa/Cocoa.h>
+
#include "apps/app_shim/app_shim_messages.h"
#include "base/files/file_path.h"
#include "base/logging.h"
@@ -13,6 +15,7 @@
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/shell_window.h"
+#include "content/public/browser/web_contents.h"
#include "ui/base/cocoa/focus_window_set.h"
namespace apps {
@@ -80,6 +83,20 @@ void ExtensionAppShimHandler::OnShimFocus(Host* host) {
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) {
+ NSWindow* window = (*it)->GetNativeWindow();
tapted 2013/05/24 08:43:51 What about (*it)->GetBaseWindow()->Close(); That
jackhou1 2013/05/27 01:02:47 Close() is not available on the NativeAppWindow in
tapted 2013/05/27 01:13:56 Sure it is! -- should be inherited from ui::BaseWi
jackhou1 2013/05/27 05:04:51 Done.
+ [window performClose:nil];
+ }
+}
+
bool ExtensionAppShimHandler::LaunchApp(Profile* profile,
const std::string& app_id) {
extensions::ExtensionSystem* extension_system =

Powered by Google App Engine
This is Rietveld 408576698