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 28 matching lines...) Expand all Loading... |
39 UPGRADE_ICON_TYPE_MENU_ICON, // For showing in the wrench menu. | 39 UPGRADE_ICON_TYPE_MENU_ICON, // For showing in the wrench menu. |
40 }; | 40 }; |
41 | 41 |
42 // Returns the singleton implementation instance. | 42 // Returns the singleton implementation instance. |
43 static UpgradeDetector* GetInstance(); | 43 static UpgradeDetector* GetInstance(); |
44 | 44 |
45 virtual ~UpgradeDetector(); | 45 virtual ~UpgradeDetector(); |
46 | 46 |
47 static void RegisterPrefs(PrefRegistrySimple* registry); | 47 static void RegisterPrefs(PrefRegistrySimple* registry); |
48 | 48 |
| 49 // Triggers an upgrade check. |
| 50 virtual void CheckForUpgrade() = 0; |
| 51 |
49 // Whether the user should be notified about an upgrade. | 52 // Whether the user should be notified about an upgrade. |
50 bool notify_upgrade() const { return notify_upgrade_; } | 53 bool notify_upgrade() const { return notify_upgrade_; } |
51 | 54 |
52 // Whether the upgrade recommendation is due to Chrome being outdated. | 55 // Whether the upgrade recommendation is due to Chrome being outdated. |
53 bool is_outdated_install() const { | 56 bool is_outdated_install() const { |
54 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL; | 57 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL; |
55 } | 58 } |
56 | 59 |
57 // Whether the upgrade recommendation is due to Chrome being outdated AND | 60 // Whether the upgrade recommendation is due to Chrome being outdated AND |
58 // auto-update is turned off. | 61 // auto-update is turned off. |
59 bool is_outdated_install_no_au() const { | 62 bool is_outdated_install_no_au() const { |
60 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU; | 63 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU; |
61 } | 64 } |
62 | 65 |
| 66 // Whether elevation is needed to recover the upgrade channel (Omaha, and |
| 67 // interaction between Omaha and Chrome). |
| 68 bool is_elevation_needed_for_recovery() const { |
| 69 return upgrade_available_ == UPGRADE_NEEDS_ELEVATION; |
| 70 } |
| 71 |
63 // Notifify this object that the user has acknowledged the critical update | 72 // Notifify this object that the user has acknowledged the critical update |
64 // so we don't need to complain about it for now. | 73 // so we don't need to complain about it for now. |
65 void acknowledge_critical_update() { | 74 void acknowledge_critical_update() { |
66 critical_update_acknowledged_ = true; | 75 critical_update_acknowledged_ = true; |
67 } | 76 } |
68 | 77 |
69 // Whether the user has acknowledged the critical update. | 78 // Whether the user has acknowledged the critical update. |
70 bool critical_update_acknowledged() const { | 79 bool critical_update_acknowledged() const { |
71 return critical_update_acknowledged_; | 80 return critical_update_acknowledged_; |
72 } | 81 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 UPGRADE_AVAILABLE_REGULAR, | 116 UPGRADE_AVAILABLE_REGULAR, |
108 // If a critical update to Chrome has been installed, such as a zero-day | 117 // If a critical update to Chrome has been installed, such as a zero-day |
109 // fix. | 118 // fix. |
110 UPGRADE_AVAILABLE_CRITICAL, | 119 UPGRADE_AVAILABLE_CRITICAL, |
111 // If no update to Chrome has been installed for more than the recommended | 120 // If no update to Chrome has been installed for more than the recommended |
112 // time. | 121 // time. |
113 UPGRADE_NEEDED_OUTDATED_INSTALL, | 122 UPGRADE_NEEDED_OUTDATED_INSTALL, |
114 // If no update to Chrome has been installed for more than the recommended | 123 // If no update to Chrome has been installed for more than the recommended |
115 // time AND auto-update is turned off. | 124 // time AND auto-update is turned off. |
116 UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU, | 125 UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU, |
| 126 // If upgrade recovery needs elevation. |
| 127 UPGRADE_NEEDS_ELEVATION, |
117 } upgrade_available_; | 128 } upgrade_available_; |
118 | 129 |
119 // Whether the user has acknowledged the critical update. | 130 // Whether the user has acknowledged the critical update. |
120 bool critical_update_acknowledged_; | 131 bool critical_update_acknowledged_; |
121 | 132 |
122 private: | 133 private: |
123 // Initiates an Idle check. See IdleCallback below. | 134 // Initiates an Idle check. See IdleCallback below. |
124 void CheckIdle(); | 135 void CheckIdle(); |
125 | 136 |
126 // The callback for the IdleCheck. Tells us whether Chrome has received any | 137 // The callback for the IdleCheck. Tells us whether Chrome has received any |
(...skipping 12 matching lines...) Expand all Loading... |
139 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; | 150 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; |
140 | 151 |
141 // Whether we have waited long enough after detecting an upgrade (to see | 152 // Whether we have waited long enough after detecting an upgrade (to see |
142 // is we should start nagging about upgrading). | 153 // is we should start nagging about upgrading). |
143 bool notify_upgrade_; | 154 bool notify_upgrade_; |
144 | 155 |
145 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); | 156 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); |
146 }; | 157 }; |
147 | 158 |
148 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ | 159 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ |
OLD | NEW |