diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-18 19:41:25 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-18 19:41:25 +0000 |
commit | 2e6389f2057abac1cec84a416aaa22a36915a7e4 (patch) | |
tree | 2a693b49732ff49c7193425979e758d75eaa9cfb /chrome/browser/background | |
parent | 9d8525130c6ffd432819fe59fc5ce888de247f2f (diff) | |
download | chromium_src-2e6389f2057abac1cec84a416aaa22a36915a7e4.zip chromium_src-2e6389f2057abac1cec84a416aaa22a36915a7e4.tar.gz chromium_src-2e6389f2057abac1cec84a416aaa22a36915a7e4.tar.bz2 |
Move application lifetime functionality off BrowserList.
This makes no attempt to really rationalize/simplify this flow, just get it off the BrowserList.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10409022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background')
-rw-r--r-- | chrome/browser/background/background_mode_manager.cc | 14 | ||||
-rw-r--r-- | chrome/browser/background/background_mode_manager_unittest.cc | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index 785994c..8d7a288 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -17,6 +17,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_info_cache.h" @@ -25,7 +26,6 @@ #include "chrome/browser/status_icons/status_tray.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" @@ -175,7 +175,7 @@ BackgroundModeManager::BackgroundModeManager( // there are background apps) or exit if there are none. if (command_line->HasSwitch(switches::kNoStartupWindow)) { keep_alive_for_startup_ = true; - BrowserList::StartKeepAlive(); + browser::StartKeepAlive(); } // If the -keep-alive-for-test flag is passed, then always keep chrome running @@ -494,13 +494,13 @@ void BackgroundModeManager::ExecuteCommand(int command_id) { break; case IDC_EXIT: content::RecordAction(UserMetricsAction("Exit")); - BrowserList::AttemptExit(); + browser::AttemptExit(); break; case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { // Background mode must already be enabled (as otherwise this menu would // not be visible). DCHECK(IsBackgroundModePrefEnabled()); - DCHECK(BrowserList::WillKeepAlive()); + DCHECK(browser::WillKeepAlive()); // Set the background mode pref to "disabled" - the resulting notification // will result in a call to DisableBackgroundMode(). @@ -525,7 +525,7 @@ void BackgroundModeManager::EndKeepAliveForStartup() { // keep-alive (which can shutdown Chrome) before the message loop has // started. MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&BrowserList::EndKeepAlive)); + FROM_HERE, base::Bind(&browser::EndKeepAlive)); } } @@ -540,7 +540,7 @@ void BackgroundModeManager::StartBackgroundMode() { in_background_mode_ = true; // Put ourselves in KeepAlive mode and create a status tray icon. - BrowserList::StartKeepAlive(); + browser::StartKeepAlive(); // Display a status icon to exit Chrome. InitStatusTrayIcon(); @@ -565,7 +565,7 @@ void BackgroundModeManager::EndBackgroundMode() { in_background_mode_ = false; // End KeepAlive mode and blow away our status tray icon. - BrowserList::EndKeepAlive(); + browser::EndKeepAlive(); RemoveStatusTrayIcon(); content::NotificationService::current()->Notify( diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc index 619fa6d..fd5f6d7 100644 --- a/chrome/browser/background/background_mode_manager_unittest.cc +++ b/chrome/browser/background/background_mode_manager_unittest.cc @@ -6,8 +6,8 @@ #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" #include "chrome/browser/background/background_mode_manager.h" +#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" @@ -70,14 +70,14 @@ class TestBackgroundModeManager : public BackgroundModeManager { static void AssertBackgroundModeActive( const TestBackgroundModeManager& manager) { - EXPECT_TRUE(BrowserList::WillKeepAlive()); + EXPECT_TRUE(browser::WillKeepAlive()); EXPECT_TRUE(manager.HaveStatusTray()); EXPECT_TRUE(manager.IsLaunchOnStartup()); } static void AssertBackgroundModeInactive( const TestBackgroundModeManager& manager) { - EXPECT_FALSE(BrowserList::WillKeepAlive()); + EXPECT_FALSE(browser::WillKeepAlive()); EXPECT_FALSE(manager.HaveStatusTray()); EXPECT_FALSE(manager.IsLaunchOnStartup()); } @@ -87,7 +87,7 @@ TEST_F(BackgroundModeManagerTest, BackgroundAppLoadUnload) { TestBackgroundModeManager manager( command_line_.get(), profile_manager_.profile_info_cache()); manager.RegisterProfile(profile); - EXPECT_FALSE(BrowserList::WillKeepAlive()); + EXPECT_FALSE(browser::WillKeepAlive()); // Mimic app load. manager.OnBackgroundAppInstalled(NULL); @@ -171,7 +171,7 @@ TEST_F(BackgroundModeManagerTest, MultiProfile) { command_line_.get(), profile_manager_.profile_info_cache()); manager.RegisterProfile(profile1); manager.RegisterProfile(profile2); - EXPECT_FALSE(BrowserList::WillKeepAlive()); + EXPECT_FALSE(browser::WillKeepAlive()); // Install app, should show status tray icon. manager.OnBackgroundAppInstalled(NULL); @@ -212,7 +212,7 @@ TEST_F(BackgroundModeManagerTest, ProfileInfoCacheStorage) { command_line_.get(), profile_manager_.profile_info_cache()); manager.RegisterProfile(profile1); manager.RegisterProfile(profile2); - EXPECT_FALSE(BrowserList::WillKeepAlive()); + EXPECT_FALSE(browser::WillKeepAlive()); ProfileInfoCache* cache = profile_manager_.profile_info_cache(); EXPECT_EQ(2u, cache->GetNumberOfProfiles()); @@ -256,7 +256,7 @@ TEST_F(BackgroundModeManagerTest, ProfileInfoCacheObserver) { TestBackgroundModeManager manager( command_line_.get(), profile_manager_.profile_info_cache()); manager.RegisterProfile(profile1); - EXPECT_FALSE(BrowserList::WillKeepAlive()); + EXPECT_FALSE(browser::WillKeepAlive()); // Install app, should show status tray icon. manager.OnBackgroundAppInstalled(NULL); |