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 02:30:54 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 02:30:54 +0000
commit9cbfc3b8be01d655b307eb8e79fa53ca53ba14db (patch)
tree048c9410d97ae7450cefa13ca5269995867e6908 /chrome/browser/background_mode_manager.cc
parente731a7edd7a30d2934de85876604093d9a738e6e (diff)
downloadchromium_src-9cbfc3b8be01d655b307eb8e79fa53ca53ba14db.zip
chromium_src-9cbfc3b8be01d655b307eb8e79fa53ca53ba14db.tar.gz
chromium_src-9cbfc3b8be01d655b307eb8e79fa53ca53ba14db.tar.bz2
Remove background mode preferences UI.
BUG=64267 TEST=Existing tests suffice. Review URL: http://codereview.chromium.org/5361003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background_mode_manager.cc')
-rw-r--r--chrome/browser/background_mode_manager.cc42
1 files changed, 5 insertions, 37 deletions
diff --git a/chrome/browser/background_mode_manager.cc b/chrome/browser/background_mode_manager.cc
index 7d883b2..8f78dfb 100644
--- a/chrome/browser/background_mode_manager.cc
+++ b/chrome/browser/background_mode_manager.cc
@@ -196,10 +196,6 @@ BackgroundModeManager::BackgroundModeManager(Profile* profile,
registrar_.Add(this, NotificationType::APP_TERMINATING,
NotificationService::AllSources());
- // Listen for changes to the background mode preference.
- pref_registrar_.Init(profile_->GetPrefs());
- pref_registrar_.Add(prefs::kBackgroundModeEnabled, this);
-
applications_.AddObserver(this);
}
@@ -213,10 +209,6 @@ BackgroundModeManager::~BackgroundModeManager() {
EndBackgroundMode();
}
-bool BackgroundModeManager::IsBackgroundModeEnabled() {
- return profile_->GetPrefs()->GetBoolean(prefs::kBackgroundModeEnabled);
-}
-
bool BackgroundModeManager::IsLaunchOnStartupResetAllowed() {
return profile_->GetPrefs()->GetBoolean(prefs::kLaunchOnStartupResetAllowed);
}
@@ -239,8 +231,7 @@ void BackgroundModeManager::Observe(NotificationType type,
// don't want to stomp on user choice every time we start and load
// registered extensions.
#if !defined(OS_MACOSX)
- EnableLaunchOnStartup(IsBackgroundModeEnabled() &&
- background_app_count_ > 0);
+ EnableLaunchOnStartup(background_app_count_ > 0);
#endif
break;
case NotificationType::EXTENSION_LOADED:
@@ -280,11 +271,6 @@ void BackgroundModeManager::Observe(NotificationType type,
// try to re-enter/exit background mode again.
registrar_.RemoveAll();
break;
- case NotificationType::PREF_CHANGED:
- DCHECK(0 == Details<std::string>(details).ptr()->compare(
- prefs::kBackgroundModeEnabled));
- OnBackgroundModePrefChanged();
- break;
default:
NOTREACHED();
break;
@@ -302,28 +288,11 @@ void BackgroundModeManager::EndKeepAliveForStartup() {
}
}
-void BackgroundModeManager::OnBackgroundModePrefChanged() {
- // Background mode has been enabled/disabled in preferences, so update our
- // state accordingly.
- if (IsBackgroundModeEnabled() && !in_background_mode_ &&
- background_app_count_ > 0) {
- // We should be in background mode, but we're not, so switch to background
- // mode.
- EnableLaunchOnStartup(true);
- StartBackgroundMode();
- }
- if (!IsBackgroundModeEnabled() && in_background_mode_) {
- // We're in background mode, but we shouldn't be any longer.
- EnableLaunchOnStartup(false);
- EndBackgroundMode();
- }
-}
-
void BackgroundModeManager::OnBackgroundAppLoaded() {
// When a background app loads, increment our count and also enable
// KeepAlive mode if the preference is set.
background_app_count_++;
- if (background_app_count_ == 1 && IsBackgroundModeEnabled())
+ if (background_app_count_ == 1)
StartBackgroundMode();
}
@@ -347,7 +316,7 @@ void BackgroundModeManager::OnBackgroundAppUnloaded() {
// KeepAlive mode if appropriate.
background_app_count_--;
DCHECK(background_app_count_ >= 0);
- if (background_app_count_ == 0 && IsBackgroundModeEnabled())
+ if (background_app_count_ == 0)
EndBackgroundMode();
}
@@ -364,14 +333,14 @@ void BackgroundModeManager::EndBackgroundMode() {
void BackgroundModeManager::OnBackgroundAppInstalled() {
// We're installing a background app. If this is the first background app
// being installed, make sure we are set to launch on startup.
- if (IsBackgroundModeEnabled() && background_app_count_ == 0)
+ if (background_app_count_ == 0)
EnableLaunchOnStartup(true);
}
void BackgroundModeManager::OnBackgroundAppUninstalled() {
// When uninstalling a background app, disable launch on startup if
// we have no more background apps.
- if (IsBackgroundModeEnabled() && background_app_count_ == 0)
+ if (background_app_count_ == 0)
EnableLaunchOnStartup(false);
}
@@ -581,6 +550,5 @@ Browser* BackgroundModeManager::GetBrowserWindow() {
// static
void BackgroundModeManager::RegisterUserPrefs(PrefService* prefs) {
- prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true);
prefs->RegisterBooleanPref(prefs::kLaunchOnStartupResetAllowed, false);
}