diff options
author | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 19:35:06 +0000 |
---|---|---|
committer | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 19:35:06 +0000 |
commit | 481acef9c8eef81c8e7f02a51602987348d42e2c (patch) | |
tree | 16c3d9f2d56e7bff1da589aa5376ce69deaf5d3e /chrome/browser/ui/browser_list.cc | |
parent | cb01cd6e91282f52a26d5b70a42b57c8cf322cce (diff) | |
download | chromium_src-481acef9c8eef81c8e7f02a51602987348d42e2c.zip chromium_src-481acef9c8eef81c8e7f02a51602987348d42e2c.tar.gz chromium_src-481acef9c8eef81c8e7f02a51602987348d42e2c.tar.bz2 |
Restart instead of signout when there are pending updates.
BUG=chromium-os:9782
TEST=Install an update, signout. With this change, we will reboot (installing
the update).
Review URL: http://codereview.chromium.org/6312111
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_list.cc')
-rw-r--r-- | chrome/browser/ui/browser_list.cc | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index d68365c..c37b91c 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -26,6 +26,7 @@ #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/login_library.h" +#include "chrome/browser/chromeos/cros/update_library.h" #include "chrome/browser/chromeos/wm_ipc.h" #endif @@ -160,10 +161,6 @@ Browser* FindBrowserMatching(const T& begin, BrowserList::BrowserVector BrowserList::browsers_; ObserverList<BrowserList::Observer> BrowserList::observers_; -#if defined(OS_CHROMEOS) -bool BrowserList::notified_window_manager_about_signout_ = false; -#endif - // static void BrowserList::AddBrowser(Browser* browser) { DCHECK(browser); @@ -194,20 +191,41 @@ void BrowserList::MarkAsCleanShutdown() { } } +#if defined(OS_CHROMEOS) +// static +void BrowserList::NotifyWindowManagerAboutSignout() { + static bool notified = false; + if (!notified) { + // Let the window manager know that we're going away before we start closing + // windows so it can display a graceful transition to a black screen. + chromeos::WmIpc::instance()->NotifyAboutSignout(); + notified = true; + } +} +#endif + // static -void BrowserList::NotifyAndTerminate() { +void BrowserList::NotifyAndTerminate(bool fast_path) { #if defined(OS_CHROMEOS) - // Let the window manager know that we're going away before we start closing - // windows so it can display a graceful transition to a black screen. - chromeos::WmIpc::instance()->NotifyAboutSignout(); - notified_window_manager_about_signout_ = true; + NotifyWindowManagerAboutSignout(); #endif - NotificationService::current()->Notify(NotificationType::APP_TERMINATING, - NotificationService::AllSources(), - NotificationService::NoDetails()); + + if (fast_path) { + NotificationService::current()->Notify(NotificationType::APP_TERMINATING, + NotificationService::AllSources(), + NotificationService::NoDetails()); + } + #if defined(OS_CHROMEOS) - if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { - chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); + chromeos::CrosLibrary* cros_library = chromeos::CrosLibrary::Get(); + if (cros_library->EnsureLoaded()) { + // If update has been installed, reboot, otherwise, sign out. + if (cros_library->GetUpdateLibrary()->status().status == + chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) { + cros_library->GetUpdateLibrary()->RebootAfterUpdate(); + } else { + cros_library->GetLoginLibrary()->StopSession(""); + } return; } // If running the Chrome OS build, but we're not on the device, fall through @@ -251,16 +269,6 @@ void BrowserList::RemoveBrowser(Browser* browser) { if (browsers_.empty() && (browser_shutdown::IsTryingToQuit() || g_browser_process->IsShuttingDown())) { -#if defined(OS_CHROMEOS) - // We might've already notified the window manager before closing any - // windows in NotifyAndTerminate() if we were able to take the - // no-beforeunload-handlers-or-downloads fast path; no need to do it again - // here. - if (!notified_window_manager_about_signout_) { - chromeos::WmIpc::instance()->NotifyAboutSignout(); - notified_window_manager_about_signout_ = true; - } -#endif // Last browser has just closed, and this is a user-initiated quit or there // is no module keeping the app alive, so send out our notification. No need // to call ProfileManager::ShutdownSessionServices() as part of the @@ -328,7 +336,7 @@ void BrowserList::CloseAllBrowsers() { // If there are no browsers, send the APP_TERMINATING action here. Otherwise, // it will be sent by RemoveBrowser() when the last browser has closed. if (force_exit || browsers_.empty()) { - NotifyAndTerminate(); + NotifyAndTerminate(true); return; } #if defined(OS_CHROMEOS) @@ -368,7 +376,7 @@ void BrowserList::Exit() { if (chromeos::CrosLibrary::Get()->EnsureLoaded() && !NeedBeforeUnloadFired() && !PendingDownloads()) { - NotifyAndTerminate(); + NotifyAndTerminate(true); return; } #endif |