| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 523 |
| 524 | 524 |
| 525 /////////////////////////////////////////////////////////////////////////////// | 525 /////////////////////////////////////////////////////////////////////////////// |
| 526 // BackgroundModeManager, private | 526 // BackgroundModeManager, private |
| 527 void BackgroundModeManager::EndKeepAliveForStartup() { | 527 void BackgroundModeManager::EndKeepAliveForStartup() { |
| 528 if (keep_alive_for_startup_) { | 528 if (keep_alive_for_startup_) { |
| 529 keep_alive_for_startup_ = false; | 529 keep_alive_for_startup_ = false; |
| 530 // We call this via the message queue to make sure we don't try to end | 530 // We call this via the message queue to make sure we don't try to end |
| 531 // keep-alive (which can shutdown Chrome) before the message loop has | 531 // keep-alive (which can shutdown Chrome) before the message loop has |
| 532 // started. | 532 // started. |
| 533 MessageLoop::current()->PostTask(FROM_HERE, | 533 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 534 base::Bind(&chrome::EndKeepAlive)); | 534 base::Bind(&chrome::EndKeepAlive)); |
| 535 } | 535 } |
| 536 } | 536 } |
| 537 | 537 |
| 538 void BackgroundModeManager::StartBackgroundMode() { | 538 void BackgroundModeManager::StartBackgroundMode() { |
| 539 DCHECK(ShouldBeInBackgroundMode()); | 539 DCHECK(ShouldBeInBackgroundMode()); |
| 540 // Don't bother putting ourselves in background mode if we're already there | 540 // Don't bother putting ourselves in background mode if we're already there |
| 541 // or if background mode is disabled. | 541 // or if background mode is disabled. |
| 542 if (in_background_mode_) | 542 if (in_background_mode_) |
| 543 return; | 543 return; |
| 544 | 544 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 } | 765 } |
| 766 } | 766 } |
| 767 return profile_it; | 767 return profile_it; |
| 768 } | 768 } |
| 769 | 769 |
| 770 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 770 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 771 PrefService* service = g_browser_process->local_state(); | 771 PrefService* service = g_browser_process->local_state(); |
| 772 DCHECK(service); | 772 DCHECK(service); |
| 773 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 773 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 774 } | 774 } |
| OLD | NEW |