Chromium Code Reviews| Index: chrome/browser/extensions/extension_host.cc |
| diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc |
| index d370c268c555b51ae652538ac323cac0c26de36b..76ef390241c620232ecce971c78a3cd66a546794 100644 |
| --- a/chrome/browser/extensions/extension_host.cc |
| +++ b/chrome/browser/extensions/extension_host.cc |
| @@ -21,6 +21,7 @@ |
| #include "chrome/browser/extensions/extension_tab_util.h" |
| #include "chrome/browser/extensions/window_controller.h" |
| #include "chrome/browser/file_select_helper.h" |
| +#include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" |
| #include "chrome/browser/ui/browser.h" |
| @@ -154,6 +155,13 @@ ExtensionHost::ExtensionHost(const Extension* extension, |
| // be the same extension that this points to. |
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| content::Source<Profile>(profile_)); |
| + |
| + // Keep the browser process alive while platform apps have active background |
| + // pages. |
| + if (extension_->is_platform_app() && |
| + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
|
benwells
2012/10/12 05:33:38
I don't like putting the is_platform_app check her
Aaron Boodman
2012/10/12 17:58:30
What about if ExtensionHost supported this feature
|
| + browser::StartKeepAlive(); |
| + } |
| } |
| ExtensionHost::~ExtensionHost() { |
| @@ -167,6 +175,11 @@ ExtensionHost::~ExtensionHost() { |
| content::Source<Profile>(profile_), |
| content::Details<ExtensionHost>(this)); |
| ProcessCreationQueue::GetInstance()->Remove(this); |
| + |
| + if (extension_->is_platform_app() && |
| + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
| + browser::EndKeepAlive(); |
| + } |
| } |
| void ExtensionHost::CreateView(Browser* browser) { |