Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7347)

Unified Diff: chrome/browser/upgrade_detector.cc

Issue 3455009: Change the frequency of update checks depending on the installed channel of chrome. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: finnur review Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/update_recommended_dialog.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/upgrade_detector.cc
diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc
index 0dde1e93e1736b6f8c9b0b3077add36366fc9143..f19a6f6fa704dc7bdf737ff5ea22121a2c2d1d76 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
« no previous file with comments | « chrome/browser/gtk/update_recommended_dialog.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698