Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: chrome/browser/background/background_mode_manager.cc

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/location.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/prefs/pref_registry_simple.h" 17 #include "base/prefs/pref_registry_simple.h"
17 #include "base/prefs/pref_service.h" 18 #include "base/prefs/pref_service.h"
19 #include "base/single_thread_task_runner.h"
18 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/thread_task_runner_handle.h"
19 #include "chrome/app/chrome_command_ids.h" 22 #include "chrome/app/chrome_command_ids.h"
20 #include "chrome/browser/background/background_application_list_model.h" 23 #include "chrome/browser/background/background_application_list_model.h"
21 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/browser_shutdown.h" 25 #include "chrome/browser/browser_shutdown.h"
23 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/extensions/extension_service.h" 27 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/lifetime/application_lifetime.h" 28 #include "chrome/browser/lifetime/application_lifetime.h"
26 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/profiles/profile_info_cache.h" 30 #include "chrome/browser/profiles/profile_info_cache.h"
28 #include "chrome/browser/profiles/profile_manager.h" 31 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 619
617 620
618 /////////////////////////////////////////////////////////////////////////////// 621 ///////////////////////////////////////////////////////////////////////////////
619 // BackgroundModeManager, private 622 // BackgroundModeManager, private
620 void BackgroundModeManager::DecrementKeepAliveCountForStartup() { 623 void BackgroundModeManager::DecrementKeepAliveCountForStartup() {
621 if (keep_alive_for_startup_) { 624 if (keep_alive_for_startup_) {
622 keep_alive_for_startup_ = false; 625 keep_alive_for_startup_ = false;
623 // We call this via the message queue to make sure we don't try to end 626 // We call this via the message queue to make sure we don't try to end
624 // keep-alive (which can shutdown Chrome) before the message loop has 627 // keep-alive (which can shutdown Chrome) before the message loop has
625 // started. 628 // started.
626 base::MessageLoop::current()->PostTask( 629 base::ThreadTaskRunnerHandle::Get()->PostTask(
627 FROM_HERE, base::Bind(&chrome::DecrementKeepAliveCount)); 630 FROM_HERE, base::Bind(&chrome::DecrementKeepAliveCount));
628 } 631 }
629 } 632 }
630 633
631 void BackgroundModeManager::StartBackgroundMode() { 634 void BackgroundModeManager::StartBackgroundMode() {
632 DCHECK(ShouldBeInBackgroundMode()); 635 DCHECK(ShouldBeInBackgroundMode());
633 // Don't bother putting ourselves in background mode if we're already there 636 // Don't bother putting ourselves in background mode if we're already there
634 // or if background mode is disabled. 637 // or if background mode is disabled.
635 if (in_background_mode_) 638 if (in_background_mode_)
636 return; 639 return;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 } 907 }
905 } 908 }
906 return profile_it; 909 return profile_it;
907 } 910 }
908 911
909 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { 912 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const {
910 PrefService* service = g_browser_process->local_state(); 913 PrefService* service = g_browser_process->local_state();
911 DCHECK(service); 914 DCHECK(service);
912 return service->GetBoolean(prefs::kBackgroundModeEnabled); 915 return service->GetBoolean(prefs::kBackgroundModeEnabled);
913 } 916 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698