| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UPGRADE_DETECTOR_H_ | 5 #ifndef CHROME_BROWSER_UPGRADE_DETECTOR_H_ |
| 6 #define CHROME_BROWSER_UPGRADE_DETECTOR_H_ | 6 #define CHROME_BROWSER_UPGRADE_DETECTOR_H_ |
| 7 | 7 |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "chrome/browser/idle.h" | 9 #include "chrome/browser/idle.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 static void RegisterPrefs(PrefRegistrySimple* registry); | 47 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 48 | 48 |
| 49 // Whether the user should be notified about an upgrade. | 49 // Whether the user should be notified about an upgrade. |
| 50 bool notify_upgrade() const { return notify_upgrade_; } | 50 bool notify_upgrade() const { return notify_upgrade_; } |
| 51 | 51 |
| 52 // Whether the upgrade recommendation is due to Chrome being outdated. | 52 // Whether the upgrade recommendation is due to Chrome being outdated. |
| 53 bool is_outdated_install() const { | 53 bool is_outdated_install() const { |
| 54 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL; | 54 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Whether the upgrade recommendation is due to Chrome being outdated AND |
| 58 // auto-update is turned off. |
| 59 bool is_outdated_install_no_au() const { |
| 60 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU; |
| 61 } |
| 62 |
| 57 // Notifify this object that the user has acknowledged the critical update | 63 // Notifify this object that the user has acknowledged the critical update |
| 58 // so we don't need to complain about it for now. | 64 // so we don't need to complain about it for now. |
| 59 void acknowledge_critical_update() { | 65 void acknowledge_critical_update() { |
| 60 critical_update_acknowledged_ = true; | 66 critical_update_acknowledged_ = true; |
| 61 } | 67 } |
| 62 | 68 |
| 63 // Whether the user has acknowledged the critical update. | 69 // Whether the user has acknowledged the critical update. |
| 64 bool critical_update_acknowledged() const { | 70 bool critical_update_acknowledged() const { |
| 65 return critical_update_acknowledged_; | 71 return critical_update_acknowledged_; |
| 66 } | 72 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // If no update is available and current install is recent enough. | 104 // If no update is available and current install is recent enough. |
| 99 UPGRADE_AVAILABLE_NONE, | 105 UPGRADE_AVAILABLE_NONE, |
| 100 // If a regular update is available. | 106 // If a regular update is available. |
| 101 UPGRADE_AVAILABLE_REGULAR, | 107 UPGRADE_AVAILABLE_REGULAR, |
| 102 // If a critical update to Chrome has been installed, such as a zero-day | 108 // If a critical update to Chrome has been installed, such as a zero-day |
| 103 // fix. | 109 // fix. |
| 104 UPGRADE_AVAILABLE_CRITICAL, | 110 UPGRADE_AVAILABLE_CRITICAL, |
| 105 // If no update to Chrome has been installed for more than the recommended | 111 // If no update to Chrome has been installed for more than the recommended |
| 106 // time. | 112 // time. |
| 107 UPGRADE_NEEDED_OUTDATED_INSTALL, | 113 UPGRADE_NEEDED_OUTDATED_INSTALL, |
| 114 // If no update to Chrome has been installed for more than the recommended |
| 115 // time AND auto-update is turned off. |
| 116 UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU, |
| 108 } upgrade_available_; | 117 } upgrade_available_; |
| 109 | 118 |
| 110 // Whether the user has acknowledged the critical update. | 119 // Whether the user has acknowledged the critical update. |
| 111 bool critical_update_acknowledged_; | 120 bool critical_update_acknowledged_; |
| 112 | 121 |
| 113 private: | 122 private: |
| 114 // Initiates an Idle check. See IdleCallback below. | 123 // Initiates an Idle check. See IdleCallback below. |
| 115 void CheckIdle(); | 124 void CheckIdle(); |
| 116 | 125 |
| 117 // The callback for the IdleCheck. Tells us whether Chrome has received any | 126 // The callback for the IdleCheck. Tells us whether Chrome has received any |
| (...skipping 12 matching lines...) Expand all Loading... |
| 130 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; | 139 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; |
| 131 | 140 |
| 132 // Whether we have waited long enough after detecting an upgrade (to see | 141 // Whether we have waited long enough after detecting an upgrade (to see |
| 133 // is we should start nagging about upgrading). | 142 // is we should start nagging about upgrading). |
| 134 bool notify_upgrade_; | 143 bool notify_upgrade_; |
| 135 | 144 |
| 136 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); | 145 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); |
| 137 }; | 146 }; |
| 138 | 147 |
| 139 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ | 148 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ |
| OLD | NEW |