Index: chrome/browser/upgrade_detector_impl.cc |
=================================================================== |
--- chrome/browser/upgrade_detector_impl.cc (revision 277860) |
+++ chrome/browser/upgrade_detector_impl.cc (working copy) |
@@ -20,7 +20,6 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/time/time.h" |
-#include "base/version.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/google/google_brand.h" |
#include "chrome/common/chrome_switches.h" |
@@ -252,18 +251,11 @@ |
UpgradeDetectorImpl::~UpgradeDetectorImpl() { |
} |
-// Static |
-// This task checks the currently running version of Chrome against the |
-// installed version. If the installed version is newer, it calls back |
-// UpgradeDetectorImpl::UpgradeDetected using a weak pointer so that it can |
-// be interrupted from the UI thread. |
-void UpgradeDetectorImpl::DetectUpgradeTask( |
- base::WeakPtr<UpgradeDetectorImpl> upgrade_detector) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
+// static |
+base::Version UpgradeDetectorImpl::GetCurrentlyInstalledVersion() { |
+ base::ThreadRestrictions::AssertIOAllowed(); |
Version installed_version; |
- Version critical_update; |
- |
#if defined(OS_WIN) |
// Get the version of the currently *installed* instance of Chrome, |
// which might be newer than the *running* instance if we have been |
@@ -274,11 +266,6 @@ |
// thing to do. |
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
InstallUtil::GetChromeVersion(dist, system_install, &installed_version); |
- |
- if (installed_version.IsValid()) { |
- InstallUtil::GetCriticalUpdateVersion(dist, system_install, |
- &critical_update); |
- } |
#elif defined(OS_MACOSX) |
installed_version = |
Version(base::UTF16ToASCII(keystone_glue::CurrentlyInstalledVersion())); |
@@ -294,7 +281,27 @@ |
installed_version = Version(reply); |
#endif |
+ return installed_version; |
+} |
+// static |
+// This task checks the currently running version of Chrome against the |
+// installed version. If the installed version is newer, it calls back |
+// UpgradeDetectorImpl::UpgradeDetected using a weak pointer so that it can |
+// be interrupted from the UI thread. |
+void UpgradeDetectorImpl::DetectUpgradeTask( |
+ base::WeakPtr<UpgradeDetectorImpl> upgrade_detector) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
+ |
+ Version installed_version = GetCurrentlyInstalledVersion(); |
+ Version critical_update; |
+#if defined(OS_WIN) |
+ if (installed_version.IsValid()) { |
+ InstallUtil::GetCriticalUpdateVersion(dist, system_install, |
+ &critical_update); |
+ } |
+#endif |
+ |
// Get the version of the currently *running* instance of Chrome. |
chrome::VersionInfo version_info; |
if (!version_info.is_valid()) { |
@@ -436,9 +443,9 @@ |
// second. |
const int kUnstableThreshold = 1; |
- if (is_critical_or_outdated) |
+ if (is_critical_or_outdated) { |
set_upgrade_notification_stage(UPGRADE_ANNOYANCE_CRITICAL); |
- else if (time_passed >= kUnstableThreshold) { |
+ } else if (time_passed >= kUnstableThreshold) { |
set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW); |
// That's as high as it goes. |