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 "chrome/browser/background/background_mode_manager.h" | 5 #include "chrome/browser/background/background_mode_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 } | 698 } |
699 | 699 |
700 void BackgroundModeManager::ReleaseStartupKeepAlive() { | 700 void BackgroundModeManager::ReleaseStartupKeepAlive() { |
701 if (keep_alive_for_startup_) { | 701 if (keep_alive_for_startup_) { |
702 // We call this via the message queue to make sure we don't try to end | 702 // We call this via the message queue to make sure we don't try to end |
703 // keep-alive (which can shutdown Chrome) before the message loop has | 703 // keep-alive (which can shutdown Chrome) before the message loop has |
704 // started. This object reference is safe because it's going to be kept | 704 // started. This object reference is safe because it's going to be kept |
705 // alive by the browser process until after the callback is called. | 705 // alive by the browser process until after the callback is called. |
706 base::ThreadTaskRunnerHandle::Get()->PostTask( | 706 base::ThreadTaskRunnerHandle::Get()->PostTask( |
707 FROM_HERE, | 707 FROM_HERE, |
708 base::Bind(&BackgroundModeManager::ReleaseStartupKeepAliveCallback, | 708 base::BindOnce(&BackgroundModeManager::ReleaseStartupKeepAliveCallback, |
709 base::Unretained(this))); | 709 base::Unretained(this))); |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 void BackgroundModeManager::StartBackgroundMode() { | 713 void BackgroundModeManager::StartBackgroundMode() { |
714 DCHECK(ShouldBeInBackgroundMode()); | 714 DCHECK(ShouldBeInBackgroundMode()); |
715 // Don't bother putting ourselves in background mode if we're already there | 715 // Don't bother putting ourselves in background mode if we're already there |
716 // or if background mode is disabled. | 716 // or if background mode is disabled. |
717 if (in_background_mode_) | 717 if (in_background_mode_) |
718 return; | 718 return; |
719 | 719 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 } | 1047 } |
1048 } | 1048 } |
1049 return profile_it; | 1049 return profile_it; |
1050 } | 1050 } |
1051 | 1051 |
1052 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 1052 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
1053 PrefService* service = g_browser_process->local_state(); | 1053 PrefService* service = g_browser_process->local_state(); |
1054 DCHECK(service); | 1054 DCHECK(service); |
1055 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 1055 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
1056 } | 1056 } |
OLD | NEW |