summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-02 08:55:55 +0000
committerjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-02 08:55:55 +0000
commit5d67406163a6a6ad34b82293be57b20e30782f08 (patch)
tree73c20b4a257f6857303e92beb54b4aabe767c00e /apps
parent51b169898f83833de1a1b1d3d821a19660541603 (diff)
downloadchromium_src-5d67406163a6a6ad34b82293be57b20e30782f08.zip
chromium_src-5d67406163a6a6ad34b82293be57b20e30782f08.tar.gz
chromium_src-5d67406163a6a6ad34b82293be57b20e30782f08.tar.bz2
When quitting the last app, terminate asynchronously.
This is because we check for shell windows before terminating, but closing shell windows will be asynchronous https://codereview.chromium.org/20243003/ so we need to give it a chance to close before checking if they're all closed. BUG=168080 Review URL: https://chromiumcodereview.appspot.com/21482002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r--apps/app_shim/extension_app_shim_handler_mac.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index 5491144..f663de0b 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -42,6 +42,13 @@ void ProfileLoadedCallback(base::Callback<void(Profile*)> callback,
DCHECK_EQ(Profile::CREATE_STATUS_CREATED, status);
}
+void TerminateIfNoShellWindows() {
+ bool shell_windows_left =
+ extensions::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(0);
+ if (!shell_windows_left)
+ chrome::AttemptExit();
+}
+
} // namespace
namespace apps {
@@ -113,10 +120,11 @@ void ExtensionAppShimHandler::Delegate::LaunchShim(
}
void ExtensionAppShimHandler::Delegate::MaybeTerminate() {
- bool shell_windows_left =
- extensions::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(0);
- if (!shell_windows_left)
- chrome::AttemptExit();
+ // Post this to give ShellWindows a chance to remove themselves from the
+ // registry.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&TerminateIfNoShellWindows));
}
ExtensionAppShimHandler::ExtensionAppShimHandler()