| 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/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/idle.h" | 10 #include "chrome/browser/idle.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // so we don't need to complain about it for now. | 59 // so we don't need to complain about it for now. |
| 60 void acknowledge_critical_update() { | 60 void acknowledge_critical_update() { |
| 61 critical_update_acknowledged_ = true; | 61 critical_update_acknowledged_ = true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Whether the user has acknowledged the critical update. | 64 // Whether the user has acknowledged the critical update. |
| 65 bool critical_update_acknowledged() const { | 65 bool critical_update_acknowledged() const { |
| 66 return critical_update_acknowledged_; | 66 return critical_update_acknowledged_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool is_factory_reset_required() const { return is_factory_reset_required_; } |
| 70 |
| 69 // Retrieves the right icon ID based on the degree of severity (see | 71 // Retrieves the right icon ID based on the degree of severity (see |
| 70 // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon | 72 // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon |
| 71 // to go with it) to display within the wrench menu. | 73 // to go with it) to display within the wrench menu. |
| 72 int GetIconResourceID(); | 74 int GetIconResourceID(); |
| 73 | 75 |
| 74 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage() const { | 76 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage() const { |
| 75 return upgrade_notification_stage_; | 77 return upgrade_notification_stage_; |
| 76 } | 78 } |
| 77 | 79 |
| 78 protected: | 80 protected: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 120 } |
| 119 | 121 |
| 120 void set_critical_update_acknowledged(bool acknowledged) { | 122 void set_critical_update_acknowledged(bool acknowledged) { |
| 121 critical_update_acknowledged_ = acknowledged; | 123 critical_update_acknowledged_ = acknowledged; |
| 122 } | 124 } |
| 123 | 125 |
| 124 void set_upgrade_notification_stage(UpgradeNotificationAnnoyanceLevel stage) { | 126 void set_upgrade_notification_stage(UpgradeNotificationAnnoyanceLevel stage) { |
| 125 upgrade_notification_stage_ = stage; | 127 upgrade_notification_stage_ = stage; |
| 126 } | 128 } |
| 127 | 129 |
| 130 void set_is_factory_reset_required(bool is_factory_reset_required) { |
| 131 is_factory_reset_required_ = is_factory_reset_required; |
| 132 } |
| 133 |
| 128 private: | 134 private: |
| 129 // Initiates an Idle check. See IdleCallback below. | 135 // Initiates an Idle check. See IdleCallback below. |
| 130 void CheckIdle(); | 136 void CheckIdle(); |
| 131 | 137 |
| 132 // The callback for the IdleCheck. Tells us whether Chrome has received any | 138 // The callback for the IdleCheck. Tells us whether Chrome has received any |
| 133 // input events since the specified time. | 139 // input events since the specified time. |
| 134 void IdleCallback(IdleState state); | 140 void IdleCallback(IdleState state); |
| 135 | 141 |
| 136 // Triggers a global notification of the specified |type|. | 142 // Triggers a global notification of the specified |type|. |
| 137 void TriggerNotification(chrome::NotificationType type); | 143 void TriggerNotification(chrome::NotificationType type); |
| 138 | 144 |
| 139 // Whether any software updates are available (experiment updates are tracked | 145 // Whether any software updates are available (experiment updates are tracked |
| 140 // separately via additional member variables below). | 146 // separately via additional member variables below). |
| 141 UpgradeAvailable upgrade_available_; | 147 UpgradeAvailable upgrade_available_; |
| 142 | 148 |
| 143 // Whether "best effort" experiment updates are available. | 149 // Whether "best effort" experiment updates are available. |
| 144 bool best_effort_experiment_updates_available_; | 150 bool best_effort_experiment_updates_available_; |
| 145 | 151 |
| 146 // Whether "critical" experiment updates are available. | 152 // Whether "critical" experiment updates are available. |
| 147 bool critical_experiment_updates_available_; | 153 bool critical_experiment_updates_available_; |
| 148 | 154 |
| 149 // Whether the user has acknowledged the critical update. | 155 // Whether the user has acknowledged the critical update. |
| 150 bool critical_update_acknowledged_; | 156 bool critical_update_acknowledged_; |
| 151 | 157 |
| 158 // Whether a factory reset is needed to complete an update. |
| 159 bool is_factory_reset_required_; |
| 160 |
| 152 // A timer to check to see if we've been idle for long enough to show the | 161 // A timer to check to see if we've been idle for long enough to show the |
| 153 // critical warning. Should only be set if |upgrade_available_| is | 162 // critical warning. Should only be set if |upgrade_available_| is |
| 154 // UPGRADE_AVAILABLE_CRITICAL. | 163 // UPGRADE_AVAILABLE_CRITICAL. |
| 155 base::RepeatingTimer<UpgradeDetector> idle_check_timer_; | 164 base::RepeatingTimer<UpgradeDetector> idle_check_timer_; |
| 156 | 165 |
| 157 // The stage at which the annoyance level for upgrade notifications is at. | 166 // The stage at which the annoyance level for upgrade notifications is at. |
| 158 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; | 167 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; |
| 159 | 168 |
| 160 // Whether we have waited long enough after detecting an upgrade (to see | 169 // Whether we have waited long enough after detecting an upgrade (to see |
| 161 // is we should start nagging about upgrading). | 170 // is we should start nagging about upgrading). |
| 162 bool notify_upgrade_; | 171 bool notify_upgrade_; |
| 163 | 172 |
| 164 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); | 173 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); |
| 165 }; | 174 }; |
| 166 | 175 |
| 167 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ | 176 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ |
| OLD | NEW |