| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // We're going away, so exit background mode (does nothing if we aren't in | 209 // We're going away, so exit background mode (does nothing if we aren't in |
| 210 // background mode currently). This is primarily needed for unit tests, | 210 // background mode currently). This is primarily needed for unit tests, |
| 211 // because in an actual running system we'd get an APP_TERMINATING | 211 // because in an actual running system we'd get an APP_TERMINATING |
| 212 // notification before being destroyed. | 212 // notification before being destroyed. |
| 213 EndBackgroundMode(); | 213 EndBackgroundMode(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 // static | 216 // static |
| 217 void BackgroundModeManager::RegisterPrefs(PrefService* prefs) { | 217 void BackgroundModeManager::RegisterPrefs(PrefService* prefs) { |
| 218 prefs->RegisterBooleanPref(prefs::kUserCreatedLoginItem, false); | 218 prefs->RegisterBooleanPref(prefs::kUserCreatedLoginItem, false); |
| 219 prefs->RegisterBooleanPref(prefs::kUserRemovedLoginItem, false); |
| 219 prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); | 220 prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); |
| 220 } | 221 } |
| 221 | 222 |
| 222 | 223 |
| 223 void BackgroundModeManager::RegisterProfile(Profile* profile) { | 224 void BackgroundModeManager::RegisterProfile(Profile* profile) { |
| 224 // We don't want to register multiple times for one profile. | 225 // We don't want to register multiple times for one profile. |
| 225 DCHECK(background_mode_data_.find(profile) == background_mode_data_.end()); | 226 DCHECK(background_mode_data_.find(profile) == background_mode_data_.end()); |
| 226 BackgroundModeInfo bmd(new BackgroundModeData(current_command_id_++, | 227 BackgroundModeInfo bmd(new BackgroundModeData(current_command_id_++, |
| 227 profile)); | 228 profile)); |
| 228 background_mode_data_[profile] = bmd; | 229 background_mode_data_[profile] = bmd; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 } | 768 } |
| 768 } | 769 } |
| 769 return profile_it; | 770 return profile_it; |
| 770 } | 771 } |
| 771 | 772 |
| 772 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 773 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 773 PrefService* service = g_browser_process->local_state(); | 774 PrefService* service = g_browser_process->local_state(); |
| 774 DCHECK(service); | 775 DCHECK(service); |
| 775 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 776 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 776 } | 777 } |
| OLD | NEW |