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

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

Issue 401333002: Simplify a method in UpgradeDetector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 5 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/toolbar/wrench_menu_model.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/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 15 matching lines...) Expand all
26 // The Homeland Security Upgrade Advisory System. 26 // The Homeland Security Upgrade Advisory System.
27 enum UpgradeNotificationAnnoyanceLevel { 27 enum UpgradeNotificationAnnoyanceLevel {
28 UPGRADE_ANNOYANCE_NONE = 0, // What? Me worry? 28 UPGRADE_ANNOYANCE_NONE = 0, // What? Me worry?
29 UPGRADE_ANNOYANCE_LOW, // Green. 29 UPGRADE_ANNOYANCE_LOW, // Green.
30 UPGRADE_ANNOYANCE_ELEVATED, // Yellow. 30 UPGRADE_ANNOYANCE_ELEVATED, // Yellow.
31 UPGRADE_ANNOYANCE_HIGH, // Red. 31 UPGRADE_ANNOYANCE_HIGH, // Red.
32 UPGRADE_ANNOYANCE_SEVERE, // Orange. 32 UPGRADE_ANNOYANCE_SEVERE, // Orange.
33 UPGRADE_ANNOYANCE_CRITICAL, // Red exclamation mark. 33 UPGRADE_ANNOYANCE_CRITICAL, // Red exclamation mark.
34 }; 34 };
35 35
36 // The two types of icons we know about.
37 enum UpgradeNotificationIconType {
38 UPGRADE_ICON_TYPE_BADGE = 0, // For overlay badging of the wrench menu.
39 UPGRADE_ICON_TYPE_MENU_ICON, // For showing in the wrench menu.
40 };
41
42 // Returns the singleton implementation instance. 36 // Returns the singleton implementation instance.
43 static UpgradeDetector* GetInstance(); 37 static UpgradeDetector* GetInstance();
44 38
45 virtual ~UpgradeDetector(); 39 virtual ~UpgradeDetector();
46 40
47 static void RegisterPrefs(PrefRegistrySimple* registry); 41 static void RegisterPrefs(PrefRegistrySimple* registry);
48 42
49 // Whether the user should be notified about an upgrade. 43 // Whether the user should be notified about an upgrade.
50 bool notify_upgrade() const { return notify_upgrade_; } 44 bool notify_upgrade() const { return notify_upgrade_; }
51 45
(...skipping 19 matching lines...) Expand all
71 return critical_update_acknowledged_; 65 return critical_update_acknowledged_;
72 } 66 }
73 67
74 // When the last upgrade was detected. 68 // When the last upgrade was detected.
75 const base::Time& upgrade_detected_time() const { 69 const base::Time& upgrade_detected_time() const {
76 return upgrade_detected_time_; 70 return upgrade_detected_time_;
77 } 71 }
78 72
79 // Retrieves the right icon ID based on the degree of severity (see 73 // Retrieves the right icon ID based on the degree of severity (see
80 // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon 74 // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon
81 // to go with it). |type| determines which class of icons the caller wants, 75 // to go with it) to display within the wrench menu.
82 // either an icon appropriate for badging the wrench menu or one to display 76 int GetIconResourceID();
83 // within the wrench menu.
84 int GetIconResourceID(UpgradeNotificationIconType type);
85 77
86 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage() const { 78 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage() const {
87 return upgrade_notification_stage_; 79 return upgrade_notification_stage_;
88 } 80 }
89 81
90 protected: 82 protected:
91 UpgradeDetector(); 83 UpgradeDetector();
92 84
93 // Sends out UPGRADE_DETECTED notification and record upgrade_detected_time_. 85 // Sends out UPGRADE_DETECTED notification and record upgrade_detected_time_.
94 void NotifyUpgradeDetected(); 86 void NotifyUpgradeDetected();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; 131 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_;
140 132
141 // Whether we have waited long enough after detecting an upgrade (to see 133 // Whether we have waited long enough after detecting an upgrade (to see
142 // is we should start nagging about upgrading). 134 // is we should start nagging about upgrading).
143 bool notify_upgrade_; 135 bool notify_upgrade_;
144 136
145 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); 137 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector);
146 }; 138 };
147 139
148 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ 140 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698