Chromium Code Reviews| Index: chrome/browser/ui/webui/help/version_updater_win.cc |
| diff --git a/chrome/browser/ui/webui/help/version_updater_win.cc b/chrome/browser/ui/webui/help/version_updater_win.cc |
| index 2c59ece83bbb6fd19c57e5e1eec0b674df7846e3..d55a8f805ca61a06610852793ca1d1b64cd1885b 100644 |
| --- a/chrome/browser/ui/webui/help/version_updater_win.cc |
| +++ b/chrome/browser/ui/webui/help/version_updater_win.cc |
| @@ -4,10 +4,11 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/strings/string16.h" |
| +#include "base/task_runner_util.h" |
| #include "base/win/win_util.h" |
| #include "base/win/windows_version.h" |
| #include "chrome/browser/browser_process.h" |
| -#include "chrome/browser/first_run/upgrade_util_win.h" |
| +#include "chrome/browser/first_run/upgrade_util.h" |
| #include "chrome/browser/google/google_update_win.h" |
| #include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/ui/webui/help/version_updater.h" |
| @@ -49,6 +50,10 @@ class VersionUpdaterWin : public VersionUpdater, public UpdateCheckDelegate { |
| void BeginUpdateCheckOnFileThread(bool install_update_if_possible); |
| #endif // GOOGLE_CHROME_BUILD |
| + // A task run on the UI thread with the result of checking for a pending |
| + // restart. |
| + void OnPendingRestartCheck(bool is_update_pending_restart); |
| + |
| // The widget owning the UI for the update check. |
| gfx::AcceleratedWidget owner_widget_; |
| @@ -99,7 +104,15 @@ void VersionUpdaterWin::OnUpdateCheckComplete( |
| if (new_version.empty()) { |
| // Google Update says that no new version is available. Check to see if a |
| // restart is needed for a previously-applied update to take effect. |
| - status = upgrade_util::IsRunningOldChrome() ? NEARLY_UPDATED : UPDATED; |
| + if (base::PostTaskAndReplyWithResult( |
|
Peter Kasting
2015/05/15 18:58:18
If this conditional fails, we'll run the callback
grt (UTC plus 2)
2015/05/15 19:57:16
This condition will only fail when Chrome is shutt
|
| + content::BrowserThread::GetBlockingPool(), |
| + FROM_HERE, |
| + base::Bind(&upgrade_util::IsUpdatePendingRestart), |
| + base::Bind(&VersionUpdaterWin::OnPendingRestartCheck, |
| + weak_factory_.GetWeakPtr()))) { |
| + // Early exit since callback_ will be Run in OnPendingRestartCheck. |
| + return; |
| + } |
| } else { |
| // Notify the caller that the update is now beginning and initiate it. |
| status = UPDATING; |
| @@ -156,6 +169,11 @@ void VersionUpdaterWin::BeginUpdateCheckOnFileThread( |
| } |
| #endif // GOOGLE_CHROME_BUILD |
| +void VersionUpdaterWin::OnPendingRestartCheck(bool is_update_pending_restart) { |
| + callback_.Run(is_update_pending_restart ? NEARLY_UPDATED : UPDATED, 0, |
| + base::string16()); |
| +} |
| + |
| } // namespace |
| VersionUpdater* VersionUpdater::Create(content::WebContents* web_contents) { |