| Index: chrome/browser/upgrade_detector.h
|
| ===================================================================
|
| --- chrome/browser/upgrade_detector.h (revision 104705)
|
| +++ chrome/browser/upgrade_detector.h (working copy)
|
| @@ -7,6 +7,7 @@
|
| #pragma once
|
|
|
| #include "base/timer.h"
|
| +#include "chrome/browser/idle.h"
|
| #include "ui/gfx/image/image.h"
|
|
|
| class PrefService;
|
| @@ -30,6 +31,7 @@
|
| UPGRADE_ANNOYANCE_ELEVATED, // Yellow.
|
| UPGRADE_ANNOYANCE_HIGH, // Red.
|
| UPGRADE_ANNOYANCE_SEVERE, // Orange.
|
| + UPGRADE_ANNOYANCE_CRITICAL, // Red exclamation mark.
|
| };
|
|
|
| // The two types of icons we know about.
|
| @@ -45,8 +47,28 @@
|
|
|
| static void RegisterPrefs(PrefService* prefs);
|
|
|
| - bool notify_upgrade() { return notify_upgrade_; }
|
| + // Whether the user should be notified about an upgrade.
|
| + bool notify_upgrade() const { return notify_upgrade_; }
|
|
|
| + // Whether the upgrade is a critical upgrade (such as a zero-day update).
|
| + bool is_critical_update() const { return is_critical_upgrade_; }
|
| +
|
| + // Notifify this object that the user has acknowledged the critical update
|
| + // so we don't need to complain about it for now.
|
| + void acknowledge_critical_update() {
|
| + critical_update_acknowledged_ = true;
|
| + }
|
| +
|
| + // Whether the user has acknowledged the critical update.
|
| + bool critical_update_acknowledged() const {
|
| + return critical_update_acknowledged_;
|
| + }
|
| +
|
| + // When the last upgrade was detected.
|
| + const base::Time& upgrade_detected_time() const {
|
| + return upgrade_detected_time_;
|
| + }
|
| +
|
| // Retrieves the right icon ID based on the degree of severity (see
|
| // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon
|
| // to go with it). |type| determines which class of icons the caller wants,
|
| @@ -63,19 +85,32 @@
|
| // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_.
|
| void NotifyUpgradeRecommended();
|
|
|
| - // Accessors.
|
| - const base::Time& upgrade_detected_time() const {
|
| - return upgrade_detected_time_;
|
| - }
|
| -
|
| void set_upgrade_notification_stage(UpgradeNotificationAnnoyanceLevel stage) {
|
| upgrade_notification_stage_ = stage;
|
| }
|
|
|
| + // True if a critical update to Chrome has been installed, such as a zero-day
|
| + // fix.
|
| + bool is_critical_upgrade_;
|
| +
|
| + // Whether the user has acknowledged the critical update.
|
| + bool critical_update_acknowledged_;
|
| +
|
| private:
|
| + // Initiates an Idle check. See IdleCallback below.
|
| + void CheckIdle();
|
| +
|
| + // The callback for the IdleCheck. Tells us whether Chrome has received any
|
| + // input events since the specified time.
|
| + void IdleCallback(IdleState state);
|
| +
|
| // When the upgrade was detected.
|
| base::Time upgrade_detected_time_;
|
|
|
| + // A timer to check to see if we've been idle for long enough to show the
|
| + // critical warning. Should only be set if |is_critical_upgrade_| is true.
|
| + base::RepeatingTimer<UpgradeDetector> idle_check_timer_;
|
| +
|
| // The stage at which the annoyance level for upgrade notifications is at.
|
| UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_;
|
|
|
|
|