Index: chrome/browser/background/background_mode_manager.h |
diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h |
index a190ca018b447612518a60ab484d647cf031bed1..5878c0ac4e1d907b2fa1268d73ecb11131243d47 100644 |
--- a/chrome/browser/background/background_mode_manager.h |
+++ b/chrome/browser/background/background_mode_manager.h |
@@ -15,6 +15,7 @@ |
#include "base/memory/scoped_vector.h" |
#include "base/memory/weak_ptr.h" |
#include "chrome/browser/background/background_application_list_model.h" |
+#include "chrome/browser/lifetime/scoped_keep_alive.h" |
#include "chrome/browser/profiles/profile_attributes_storage.h" |
#include "chrome/browser/status_icons/status_icon.h" |
#include "chrome/browser/status_icons/status_icon_menu_model.h" |
@@ -317,11 +318,15 @@ class BackgroundModeManager |
// is active and not suspended. |
virtual void UpdateKeepAliveAndTrayIcon(); |
+ // Release keep_alive_for_startup_. This is invoked as a callback to make |
+ // make sure the message queue was initialized before we attempt to exit. |
+ void ReleaseStartupKeepAliveCallback(); |
+ |
// If --no-startup-window is passed, BackgroundModeManager will manually keep |
// chrome running while waiting for apps to load. This is called when we no |
// longer need to do this (either because the user has chosen to exit chrome |
// manually, or all apps have been loaded). |
- void DecrementKeepAliveCountForStartup(); |
+ void ReleaseStartupKeepAlive(); |
// Return an appropriate name for a Preferences menu entry. Preferences is |
// sometimes called Options or Settings. |
@@ -413,10 +418,14 @@ class BackgroundModeManager |
// user disables/enables background mode via preferences. |
bool in_background_mode_; |
+ // Background mode does not always keep Chrome alive. When it does, it is |
+ // using this scoped object. |
+ scoped_ptr<ScopedKeepAlive> keep_alive_; |
+ |
// Set when we are keeping chrome running during the startup process - this |
// is required when running with the --no-startup-window flag, as otherwise |
// chrome would immediately exit due to having no open windows. |
- bool keep_alive_for_startup_; |
+ scoped_ptr<ScopedKeepAlive> keep_alive_for_startup_; |
// Set to true when Chrome is running with the --keep-alive-for-test flag |
// (used for testing background mode without having to install a background |
@@ -426,9 +435,6 @@ class BackgroundModeManager |
// Set to true when background mode is suspended. |
bool background_mode_suspended_; |
- // Set to true when background mode is keeping Chrome alive. |
- bool keeping_alive_; |
- |
base::WeakPtrFactory<BackgroundModeManager> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); |