summaryrefslogtreecommitdiffstats
path: root/chrome/browser/background_mode_manager.cc
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 07:01:10 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 07:01:10 +0000
commit186c8af18006730780f4dbd5c1d8921bc139e060 (patch)
treecb8dbfa89f3743e1529061850d4192f047b3d20a /chrome/browser/background_mode_manager.cc
parente1bc00131f2c175e69da6188f744f976a3de14cb (diff)
downloadchromium_src-186c8af18006730780f4dbd5c1d8921bc139e060.zip
chromium_src-186c8af18006730780f4dbd5c1d8921bc139e060.tar.gz
chromium_src-186c8af18006730780f4dbd5c1d8921bc139e060.tar.bz2
Turn background mode on by default on windows.
Added a common routine to check whether background mode/background page tracking should be enabled with logic to enable it by default on windows. BUG=59980 TEST=existing tests suffice Review URL: http://codereview.chromium.org/5296003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background_mode_manager.cc')
-rw-r--r--chrome/browser/background_mode_manager.cc27
1 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/background_mode_manager.cc b/chrome/browser/background_mode_manager.cc
index 8f78dfb..99c0ee3 100644
--- a/chrome/browser/background_mode_manager.cc
+++ b/chrome/browser/background_mode_manager.cc
@@ -150,10 +150,9 @@ BackgroundModeManager::BackgroundModeManager(Profile* profile,
keep_alive_for_startup_(false),
status_tray_(NULL),
status_icon_(NULL) {
- // If background mode or apps are disabled, just exit - don't listen for
- // any notifications.
- if (!command_line->HasSwitch(switches::kEnableBackgroundMode) ||
- command_line->HasSwitch(switches::kDisableExtensions))
+ // If background mode is disabled, just exit - don't listen for any
+ // notifications.
+ if (!IsBackgroundModeEnabled(command_line))
return;
// Keep the browser alive until extensions are done loading - this is needed
@@ -552,3 +551,23 @@ Browser* BackgroundModeManager::GetBrowserWindow() {
void BackgroundModeManager::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kLaunchOnStartupResetAllowed, false);
}
+
+// static
+bool BackgroundModeManager::IsBackgroundModeEnabled(
+ const CommandLine* command_line) {
+
+ // Background mode is disabled if the appropriate flag is passed, or if
+ // extensions are disabled.
+ bool background_mode_enabled =
+ !command_line->HasSwitch(switches::kDisableBackgroundMode) &&
+ !command_line->HasSwitch(switches::kDisableExtensions);
+#if !defined(OS_WIN)
+ // BackgroundMode is enabled by default on windows. On other platforms, it
+ // is enabled via about:flags.
+ background_mode_enabled = background_mode_enabled &&
+ command_line->HasSwitch(switches::kEnableBackgroundMode);
+#endif
+
+ return background_mode_enabled;
+}
+