Commit f0f3add7 authored by grt's avatar grt Committed by Commit bot

Fix detection of restart needed in VersionUpdaterWin.

BUG=488489
TEST=With Chrome SxS running, allow Google Update to download and install an update, then navigate to chrome://help. It should report that a restart is needed.
R=pkasting@chromium.org

Review URL: https://codereview.chromium.org/1129733003

Cr-Commit-Position: refs/heads/master@{#330191}
parent 9a0d8870
......@@ -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,19 @@ 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(
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;
}
// Failure to post the task means that Chrome is shutting down. A pending
// update (if there is one) will be applied as Chrome exits, so tell the
// caller that it is up to date in either case.
status = UPDATED;
} else {
// Notify the caller that the update is now beginning and initiate it.
status = UPDATING;
......@@ -156,6 +173,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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment