Chromium Code Reviews| Index: chrome/browser/upgrade_detector.h |
| diff --git a/chrome/browser/upgrade_detector.h b/chrome/browser/upgrade_detector.h |
| index bc8542c8a9dd7335691449bdf129286fba556ca6..56b3129e0fe75b936d8bf40e94d4ebc69855a00c 100644 |
| --- a/chrome/browser/upgrade_detector.h |
| +++ b/chrome/browser/upgrade_detector.h |
| @@ -7,6 +7,7 @@ |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| +#include "base/observer_list.h" |
| #include "base/timer/timer.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "ui/base/idle/idle.h" |
| @@ -26,6 +27,15 @@ class PrefRegistrySimple; |
| // |
| class UpgradeDetector { |
| public: |
| + class UpgradeObserver { |
|
sky
2017/05/18 23:41:56
Remove this to it's own file (see chromium style g
weidongg
2017/05/19 01:29:53
Done.
|
| + public: |
| + virtual ~UpgradeObserver(); |
|
sky
2017/05/18 23:41:56
Move to protected section, also you can inline thi
weidongg
2017/05/19 01:29:53
Done.
|
| + |
| + // Triggered when a software update is available, but downloading requires |
| + // user's agreement as current connection is cellular. |
| + virtual void OnUpdateOverCellularAvailable() = 0; |
| + }; |
| + |
| // The Homeland Security Upgrade Advisory System. |
| enum UpgradeNotificationAnnoyanceLevel { |
| UPGRADE_ANNOYANCE_NONE = 0, // What? Me worry? |
| @@ -79,6 +89,10 @@ class UpgradeDetector { |
| return upgrade_notification_stage_; |
| } |
| + void AddObserver(UpgradeObserver* observer); |
| + |
| + void RemoveObserver(UpgradeObserver* observer); |
| + |
| protected: |
| enum UpgradeAvailable { |
| // If no update is available and current install is recent enough. |
| @@ -101,6 +115,11 @@ class UpgradeDetector { |
| // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_. |
| void NotifyUpgradeRecommended(); |
| + // The function that sends out a notification that lets the rest of the UI |
| + // know we should notify the user that a new update is available to download |
| + // over cellular connection. |
| + void NotifyUpdateOverCellularAvailable(); |
| + |
| // Triggers a critical update, which starts a timer that checks the machine |
| // idle state. Protected and virtual so that it could be overridden by tests. |
| virtual void TriggerCriticalUpdate(); |
| @@ -175,6 +194,8 @@ class UpgradeDetector { |
| // is we should start nagging about upgrading). |
| bool notify_upgrade_; |
| + base::ObserverList<UpgradeObserver> observer_list_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); |
| }; |