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

Unified Diff: chrome/browser/upgrade_detector_impl.cc

Issue 11440020: Add an outdated upgrade bubble view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More CR comments addressed and now a testable version without current time test yet. Created 7 years, 11 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
Index: chrome/browser/upgrade_detector_impl.cc
diff --git a/chrome/browser/upgrade_detector_impl.cc b/chrome/browser/upgrade_detector_impl.cc
index 570275e391ba59c8452c3de6d6861f7f4ead8e04..58973458705e23ef8a9c8ee5c04f3124eac80570 100644
--- a/chrome/browser/upgrade_detector_impl.cc
+++ b/chrome/browser/upgrade_detector_impl.cc
@@ -14,7 +14,6 @@
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
@@ -54,7 +53,9 @@ std::string CmdLineInterval() {
bool IsTesting() {
const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
return cmd_line.HasSwitch(switches::kSimulateUpgrade) ||
- cmd_line.HasSwitch(switches::kCheckForUpdateIntervalSec);
+ cmd_line.HasSwitch(switches::kCheckForUpdateIntervalSec) ||
+ cmd_line.HasSwitch(switches::kSimulateCriticalUpdate) ||
+ cmd_line.HasSwitch(switches::kSimulateOutdated);
}
// How often to check for an upgrade.
@@ -162,6 +163,17 @@ UpgradeDetectorImpl::UpgradeDetectorImpl()
UpgradeDetected();
return;
}
+ if (command_line.HasSwitch(switches::kSimulateCriticalUpdate)) {
+ is_critical_upgrade_ = true;
+ UpgradeDetected();
+ return;
+ }
+ if (command_line.HasSwitch(switches::kSimulateOutdated)) {
+ is_outdated_install_ = true;
+ UpgradeDetected();
+ return;
+ }
+ base::Time::FromString(__DATE__, &build_date_);
// Windows: only enable upgrade notifications for official builds.
// Mac: only enable them if the updater (Keystone) is present.
// Linux (and other POSIX): always enable regardless of branding.
@@ -222,13 +234,14 @@ void UpgradeDetectorImpl::NotifyOnUpgrade() {
bool is_testing = IsTesting();
int64 time_passed = is_testing ? delta.InSeconds() : delta.InHours();
+ bool is_critical_or_oudated = is_critical_upgrade_ || is_outdated_install_;
if (is_unstable_channel_) {
// There's only one threat level for unstable channels like dev and
// canary, and it hits after one hour. During testing, it hits after one
// minute.
const int kUnstableThreshold = 1;
- if (is_critical_upgrade_)
+ if (is_critical_or_oudated)
set_upgrade_notification_stage(UPGRADE_ANNOYANCE_CRITICAL);
else if (time_passed >= kUnstableThreshold) {
set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW);
@@ -247,10 +260,10 @@ void UpgradeDetectorImpl::NotifyOnUpgrade() {
const int kLowThreshold = 2 * kMultiplier;
// These if statements must be sorted (highest interval first).
- if (time_passed >= kSevereThreshold || is_critical_upgrade_) {
+ if (time_passed >= kSevereThreshold || is_critical_or_oudated) {
set_upgrade_notification_stage(
- is_critical_upgrade_ ? UPGRADE_ANNOYANCE_CRITICAL :
- UPGRADE_ANNOYANCE_SEVERE);
+ is_critical_or_oudated ? UPGRADE_ANNOYANCE_CRITICAL :
+ UPGRADE_ANNOYANCE_SEVERE);
// We can't get any higher, baby.
upgrade_notification_timer_.Stop();

Powered by Google App Engine
This is Rietveld 408576698