| 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 0494f5a2abde2d94d568fa040e1ab993c5ea767d..b102743da5b7292a05f4c8713767c53210b4d541 100644
|
| --- a/chrome/browser/background/background_mode_manager.h
|
| +++ b/chrome/browser/background/background_mode_manager.h
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/profiles/profile_info_cache_observer.h"
|
| #include "chrome/browser/status_icons/status_icon.h"
|
| #include "chrome/browser/status_icons/status_icon_menu_model.h"
|
| +#include "chrome/browser/ui/browser_list_observer.h"
|
| #include "components/browser_context_keyed_service/browser_context_keyed_service.h"
|
| #include "content/public/browser/notification_observer.h"
|
| #include "content/public/browser/notification_registrar.h"
|
| @@ -45,6 +46,7 @@ class Extension;
|
| // background.
|
| class BackgroundModeManager
|
| : public content::NotificationObserver,
|
| + public chrome::BrowserListObserver,
|
| public BackgroundApplicationListModel::Observer,
|
| public ProfileInfoCacheObserver,
|
| public StatusIconMenuModel::Delegate {
|
| @@ -63,6 +65,15 @@ class BackgroundModeManager
|
| // Returns true if background mode is active.
|
| virtual bool IsBackgroundModeActive();
|
|
|
| + // Suspends background mode until either ResumeBackgroundMode is called or
|
| + // Chrome is restarted. This has the same effect as ending background mode
|
| + // for the current browser session.
|
| + virtual void SuspendBackgroundMode();
|
| +
|
| + // Resumes background mode. This ends a suspension of background mode, but
|
| + // will not start it if it is not enabled.
|
| + virtual void ResumeBackgroundMode();
|
| +
|
| // For testing purposes.
|
| int NumberOfBackgroundModeData();
|
|
|
| @@ -176,6 +187,9 @@ class BackgroundModeManager
|
| // Overrides from StatusIconMenuModel::Delegate implementation.
|
| virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
|
|
|
| + // chrome::BrowserListObserver implementation.
|
| + virtual void OnBrowserAdded(Browser* browser) OVERRIDE;
|
| +
|
| // Invoked when an extension is installed so we can ensure that
|
| // launch-on-startup is enabled if appropriate. |extension| can be NULL when
|
| // called from unit tests.
|
| @@ -202,14 +216,14 @@ class BackgroundModeManager
|
| // and has a status bar icon.
|
| void StartBackgroundMode();
|
|
|
| - // Invoked to create the status icon if any profiles currently running
|
| - // background apps so that there is a way to exit Chrome.
|
| - void InitStatusTrayIcon();
|
| -
|
| // Invoked to take Chrome out of KeepAlive mode - chrome stops running in
|
| // the background and removes its status bar icon.
|
| void EndBackgroundMode();
|
|
|
| + // Enables keep alive and the status tray icon if and only if background mode
|
| + // is active and not suspended.
|
| + void UpdateKeepAliveAndTrayIcon();
|
| +
|
| // 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
|
| @@ -302,6 +316,12 @@ class BackgroundModeManager
|
| // app).
|
| bool keep_alive_for_test_;
|
|
|
| + // 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_;
|
| +
|
| // Provides a command id for each profile as they are created.
|
| int current_command_id_;
|
|
|
|
|