summaryrefslogtreecommitdiffstats
path: root/chrome/browser/background_mode_manager.h
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-28 06:13:30 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-28 06:13:30 +0000
commitcc7352f88ee0cb7f66be4b1d76dc288fff923fca (patch)
tree781ced2ed1f9e160ccd68d78acdc5ad38d9711f5 /chrome/browser/background_mode_manager.h
parent50245555c0f5f0dedd0b2aed1ce6a8b347c42a63 (diff)
downloadchromium_src-cc7352f88ee0cb7f66be4b1d76dc288fff923fca.zip
chromium_src-cc7352f88ee0cb7f66be4b1d76dc288fff923fca.tar.gz
chromium_src-cc7352f88ee0cb7f66be4b1d76dc288fff923fca.tar.bz2
Disable background mode when associated pref changes.
BUG=53173 TEST=new BackgroundModeManager unit tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=57642 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=57749 Review URL: http://codereview.chromium.org/3205008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background_mode_manager.h')
-rw-r--r--chrome/browser/background_mode_manager.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/browser/background_mode_manager.h b/chrome/browser/background_mode_manager.h
index 38b010c..46e8847 100644
--- a/chrome/browser/background_mode_manager.h
+++ b/chrome/browser/background_mode_manager.h
@@ -38,7 +38,7 @@ class BackgroundModeManager
: private NotificationObserver,
private menus::SimpleMenuModel::Delegate {
public:
- explicit BackgroundModeManager(Profile* profile);
+ BackgroundModeManager(Profile* profile, CommandLine* command_line);
virtual ~BackgroundModeManager();
static void RegisterUserPrefs(PrefService* prefs);
@@ -49,6 +49,12 @@ class BackgroundModeManager
BackgroundAppLoadUnload);
FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
BackgroundAppInstallUninstall);
+ FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
+ BackgroundPrefDisabled);
+ FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
+ BackgroundPrefDynamicDisable);
+ FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
+ BackgroundPrefDynamicEnable);
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
@@ -76,6 +82,9 @@ class BackgroundModeManager
// launch-on-startup is disabled if appropriate.
void OnBackgroundAppUninstalled();
+ // Invoked when the kBackgroundModeEnabled preference has changed.
+ void OnBackgroundModePrefChanged();
+
// Returns true if the passed extension is a background app.
bool IsBackgroundApp(Extension* extension);
@@ -121,6 +130,11 @@ class BackgroundModeManager
// The number of background apps currently loaded.
int background_app_count_;
+ // Set to true when we are running in background mode. Allows us to track our
+ // current background state so we can take the appropriate action when the
+ // user disables/enables background mode via preferences.
+ bool in_background_mode_;
+
// Reference to our status tray (owned by our parent profile). If null, the
// platform doesn't support status icons.
StatusTray* status_tray_;