summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-07 07:09:25 +0000
committertapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-07 07:09:25 +0000
commitd9a537e25cea7eaf53d7bfbd354012cdee627edf (patch)
tree6468b8c0a9d0df3a899290de53d3e072414070e2 /apps
parent5b64c35bfe11ac1eb0b9994cde365e26462aa73d (diff)
downloadchromium_src-d9a537e25cea7eaf53d7bfbd354012cdee627edf.zip
chromium_src-d9a537e25cea7eaf53d7bfbd354012cdee627edf.tar.gz
chromium_src-d9a537e25cea7eaf53d7bfbd354012cdee627edf.tar.bz2
[mac] Close a shim process if an app crashes or is terminated from task manager.
Currently the shim process stays running. This allows a `relaunch` of an app that dies, but ONLY if the crashed bubble is first clicked to re-enable the extension. Clicking the dock icon immediately to relaunch, without clicking the re-enable bubble, just causes the shim to die. This CL changes things so that the shim process is torn down when an app is terminated, allowing attention to be drawn to the 'extension has crashed' bubble. Note that for regular app shutdown (e.g. via AppLifetimeMonitor::Observer::OnAppStop) the shim remains running to allow a relaunch via the dock icon. BUG=269151 TEST=Start an app with app shortcuts enabled on mac (see a dock icon for it), Kill the app process from the Chrome Task Manager. Dock icon should go away. Review URL: https://chromiumcodereview.appspot.com/22442003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r--apps/app_shim/extension_app_shim_handler_mac.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index bf68bca..9173767 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -141,6 +141,8 @@ ExtensionAppShimHandler::ExtensionAppShimHandler()
content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
content::NotificationService::AllBrowserContextsAndSources());
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
+ content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllBrowserContextsAndSources());
}
@@ -352,9 +354,15 @@ void ExtensionAppShimHandler::Observe(
}
break;
}
+ case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED:
case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
- const std::string& app_id =
- content::Details<extensions::Extension>(details).ptr()->id();
+ std::string app_id;
+ if (type == chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED) {
+ app_id = content::Details<extensions::ExtensionHost>(details).ptr()
+ ->extension_id();
+ } else {
+ app_id = content::Details<extensions::Extension>(details).ptr()->id();
+ }
Host* host = FindHost(profile, app_id);
if (host)
host->OnAppClosed();