summaryrefslogtreecommitdiffstats
path: root/chrome/browser/upgrade_detector.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 19:37:49 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 19:37:49 +0000
commit2aa3de25c0bca5f7c06a89a100bb7cd50004b853 (patch)
tree110f0e40854b681a7ebe7f92605d19d44484ac5e /chrome/browser/upgrade_detector.cc
parent9beff759e94e54163a540197efcb5103467be921 (diff)
downloadchromium_src-2aa3de25c0bca5f7c06a89a100bb7cd50004b853.zip
chromium_src-2aa3de25c0bca5f7c06a89a100bb7cd50004b853.tar.gz
chromium_src-2aa3de25c0bca5f7c06a89a100bb7cd50004b853.tar.bz2
Change the frequency of update checks depending on the installed channel of chrome.
BUG=50278 TEST=none Review URL: http://codereview.chromium.org/3455009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60207 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/upgrade_detector.cc')
-rw-r--r--chrome/browser/upgrade_detector.cc33
1 files changed, 22 insertions, 11 deletions
diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc
index 0dde1e9..f19a6f6 100644
--- a/chrome/browser/upgrade_detector.cc
+++ b/chrome/browser/upgrade_detector.cc
@@ -14,6 +14,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
@@ -34,9 +35,26 @@
namespace {
// How often to check for an upgrade.
-// TODO(finnur): Once we have a good way of determining which branch the user
-// is on at runtime we should check more frequently for the dev branch.
-const int kCheckForUpgradeEveryMs = 24 * 60 * 60 * 1000; // Check daily.
+int GetCheckForUpgradeEveryMs() {
+ // Check for a value passed via the command line.
+ int interval_ms;
+ const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
+ std::string interval =
+ cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec);
+ if (!interval.empty() && base::StringToInt(interval, &interval_ms))
+ return interval_ms * 1000; // Command line value is in seconds.
+
+ // Otherwise check once an hour for dev channel and once a day for all other
+ // channels/builds.
+ const std::string channel = platform_util::GetVersionStringModifier();
+ int hours;
+ if (channel == "dev")
+ hours = 1;
+ else
+ hours = 24;
+
+ return hours * 60 * 60 * 1000;
+}
// How long to wait before notifying the user about the upgrade.
const int kNotifyUserAfterMs = 0;
@@ -147,15 +165,8 @@ UpgradeDetector::UpgradeDetector()
if (keystone_glue::KeystoneEnabled())
#endif
{
- int interval_ms = kCheckForUpgradeEveryMs;
- const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
- std::string interval =
- cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec);
- if (!interval.empty() && base::StringToInt(interval, &interval_ms))
- interval_ms *= 1000; // Command line value is in seconds.
-
detect_upgrade_timer_.Start(
- base::TimeDelta::FromMilliseconds(interval_ms),
+ base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()),
this, &UpgradeDetector::CheckForUpgrade);
}
#endif