Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/browser/upgrade_detector.h

Issue 11440020: Add an outdated upgrade bubble view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed OWNERS comments... Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 8 #include "base/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // 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 is a critical upgrade (such as a zero-day update). 52 // Whether the upgrade recommendation is due to Chrome being outdated.
53 bool is_critical_update() const { return is_critical_upgrade_; } 53 bool is_outdated_install() const {
54 return upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL;
55 }
54 56
55 // Notifify this object that the user has acknowledged the critical update 57 // Notifify this object that the user has acknowledged the critical update
56 // so we don't need to complain about it for now. 58 // so we don't need to complain about it for now.
57 void acknowledge_critical_update() { 59 void acknowledge_critical_update() {
58 critical_update_acknowledged_ = true; 60 critical_update_acknowledged_ = true;
59 } 61 }
60 62
61 // Whether the user has acknowledged the critical update. 63 // Whether the user has acknowledged the critical update.
62 bool critical_update_acknowledged() const { 64 bool critical_update_acknowledged() const {
63 return critical_update_acknowledged_; 65 return critical_update_acknowledged_;
(...skipping 21 matching lines...) Expand all
85 // Sends out UPGRADE_DETECTED notification and record upgrade_detected_time_. 87 // Sends out UPGRADE_DETECTED notification and record upgrade_detected_time_.
86 void NotifyUpgradeDetected(); 88 void NotifyUpgradeDetected();
87 89
88 // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_. 90 // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_.
89 void NotifyUpgradeRecommended(); 91 void NotifyUpgradeRecommended();
90 92
91 void set_upgrade_notification_stage(UpgradeNotificationAnnoyanceLevel stage) { 93 void set_upgrade_notification_stage(UpgradeNotificationAnnoyanceLevel stage) {
92 upgrade_notification_stage_ = stage; 94 upgrade_notification_stage_ = stage;
93 } 95 }
94 96
95 // True if a critical update to Chrome has been installed, such as a zero-day 97 enum UpgradeAvailable {
96 // fix. 98 // If no update is available and current install is recent enough.
97 bool is_critical_upgrade_; 99 UPGRADE_AVAILABLE_NONE,
100 // If a regular update is available.
101 UPGRADE_AVAILABLE_REGULAR,
102 // If a critical update to Chrome has been installed, such as a zero-day
103 // fix.
104 UPGRADE_AVAILABLE_CRITICAL,
105 // If no update to Chrome has been installed for more than the recommended
106 // time.
107 UPGRADE_NEEDED_OUTDATED_INSTALL,
108 } upgrade_available_;
98 109
99 // Whether the user has acknowledged the critical update. 110 // Whether the user has acknowledged the critical update.
100 bool critical_update_acknowledged_; 111 bool critical_update_acknowledged_;
101 112
102 private: 113 private:
103 // Initiates an Idle check. See IdleCallback below. 114 // Initiates an Idle check. See IdleCallback below.
104 void CheckIdle(); 115 void CheckIdle();
105 116
106 // The callback for the IdleCheck. Tells us whether Chrome has received any 117 // The callback for the IdleCheck. Tells us whether Chrome has received any
107 // input events since the specified time. 118 // input events since the specified time.
108 void IdleCallback(IdleState state); 119 void IdleCallback(IdleState state);
109 120
110 // When the upgrade was detected. 121 // When the upgrade was detected.
111 base::Time upgrade_detected_time_; 122 base::Time upgrade_detected_time_;
112 123
113 // A timer to check to see if we've been idle for long enough to show the 124 // A timer to check to see if we've been idle for long enough to show the
114 // critical warning. Should only be set if |is_critical_upgrade_| is true. 125 // critical warning. Should only be set if |upgrade_available_| is
126 // UPGRADE_AVAILABLE_CRITICAL.
115 base::RepeatingTimer<UpgradeDetector> idle_check_timer_; 127 base::RepeatingTimer<UpgradeDetector> idle_check_timer_;
116 128
117 // The stage at which the annoyance level for upgrade notifications is at. 129 // The stage at which the annoyance level for upgrade notifications is at.
118 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; 130 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_;
119 131
120 // Whether we have waited long enough after detecting an upgrade (to see 132 // Whether we have waited long enough after detecting an upgrade (to see
121 // is we should start nagging about upgrading). 133 // is we should start nagging about upgrading).
122 bool notify_upgrade_; 134 bool notify_upgrade_;
123 135
124 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); 136 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector);
125 }; 137 };
126 138
127 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ 139 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698