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

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

Issue 2882933002: Add update available icon in system tray (Closed)
Patch Set: Add file to BUILD.gn Created 3 years, 7 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
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.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/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/observer_list.h"
10 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
11 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/upgrade_observer.h"
12 #include "ui/base/idle/idle.h" 14 #include "ui/base/idle/idle.h"
13 #include "ui/gfx/image/image.h" 15 #include "ui/gfx/image/image.h"
14 16
15 class PrefRegistrySimple; 17 class PrefRegistrySimple;
18 class UpgradeObserver;
16 19
17 /////////////////////////////////////////////////////////////////////////////// 20 ///////////////////////////////////////////////////////////////////////////////
18 // UpgradeDetector 21 // UpgradeDetector
19 // 22 //
20 // This class is a singleton class that monitors when an upgrade happens in the 23 // This class is a singleton class that monitors when an upgrade happens in the
21 // background. We basically ask Omaha what it thinks the latest version is and 24 // background. We basically ask Omaha what it thinks the latest version is and
22 // if our version is lower we send out a notification upon: 25 // if our version is lower we send out a notification upon:
23 // a) Detecting an upgrade and... 26 // a) Detecting an upgrade and...
24 // b) When we think the user should be notified about the upgrade. 27 // b) When we think the user should be notified about the upgrade.
25 // The latter happens much later, since we don't want to be too annoying. 28 // The latter happens much later, since we don't want to be too annoying.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 75
73 // Retrieves the right icon based on the degree of severity (see 76 // Retrieves the right icon based on the degree of severity (see
74 // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon 77 // UpgradeNotificationAnnoyanceLevel, each level has an an accompanying icon
75 // to go with it) to display within the app menu. 78 // to go with it) to display within the app menu.
76 gfx::Image GetIcon(); 79 gfx::Image GetIcon();
77 80
78 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage() const { 81 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage() const {
79 return upgrade_notification_stage_; 82 return upgrade_notification_stage_;
80 } 83 }
81 84
85 void AddObserver(UpgradeObserver* observer);
86
87 void RemoveObserver(UpgradeObserver* observer);
88
82 protected: 89 protected:
83 enum UpgradeAvailable { 90 enum UpgradeAvailable {
84 // If no update is available and current install is recent enough. 91 // If no update is available and current install is recent enough.
85 UPGRADE_AVAILABLE_NONE, 92 UPGRADE_AVAILABLE_NONE,
86 // If a regular update is available. 93 // If a regular update is available.
87 UPGRADE_AVAILABLE_REGULAR, 94 UPGRADE_AVAILABLE_REGULAR,
88 // If a critical update to Chrome has been installed, such as a zero-day 95 // If a critical update to Chrome has been installed, such as a zero-day
89 // fix. 96 // fix.
90 UPGRADE_AVAILABLE_CRITICAL, 97 UPGRADE_AVAILABLE_CRITICAL,
91 // If no update to Chrome has been installed for more than the recommended 98 // If no update to Chrome has been installed for more than the recommended
92 // time. 99 // time.
93 UPGRADE_NEEDED_OUTDATED_INSTALL, 100 UPGRADE_NEEDED_OUTDATED_INSTALL,
94 // If no update to Chrome has been installed for more than the recommended 101 // If no update to Chrome has been installed for more than the recommended
95 // time AND auto-update is turned off. 102 // time AND auto-update is turned off.
96 UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU, 103 UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU,
97 }; 104 };
98 105
99 UpgradeDetector(); 106 UpgradeDetector();
100 107
101 // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_. 108 // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_.
102 void NotifyUpgradeRecommended(); 109 void NotifyUpgradeRecommended();
103 110
111 // The function that sends out a notification that lets the rest of the UI
112 // know we should notify the user that a new update is available to download
113 // over cellular connection.
114 void NotifyUpdateOverCellularAvailable();
115
104 // Triggers a critical update, which starts a timer that checks the machine 116 // Triggers a critical update, which starts a timer that checks the machine
105 // idle state. Protected and virtual so that it could be overridden by tests. 117 // idle state. Protected and virtual so that it could be overridden by tests.
106 virtual void TriggerCriticalUpdate(); 118 virtual void TriggerCriticalUpdate();
107 119
108 UpgradeAvailable upgrade_available() const { return upgrade_available_; } 120 UpgradeAvailable upgrade_available() const { return upgrade_available_; }
109 void set_upgrade_available(UpgradeAvailable available) { 121 void set_upgrade_available(UpgradeAvailable available) {
110 upgrade_available_ = available; 122 upgrade_available_ = available;
111 } 123 }
112 124
113 void set_best_effort_experiment_updates_available(bool available) { 125 void set_best_effort_experiment_updates_available(bool available) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // UPGRADE_AVAILABLE_CRITICAL. 180 // UPGRADE_AVAILABLE_CRITICAL.
169 base::RepeatingTimer idle_check_timer_; 181 base::RepeatingTimer idle_check_timer_;
170 182
171 // The stage at which the annoyance level for upgrade notifications is at. 183 // The stage at which the annoyance level for upgrade notifications is at.
172 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_; 184 UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_;
173 185
174 // Whether we have waited long enough after detecting an upgrade (to see 186 // Whether we have waited long enough after detecting an upgrade (to see
175 // is we should start nagging about upgrading). 187 // is we should start nagging about upgrading).
176 bool notify_upgrade_; 188 bool notify_upgrade_;
177 189
190 base::ObserverList<UpgradeObserver> observer_list_;
191
178 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); 192 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector);
179 }; 193 };
180 194
181 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ 195 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.cc ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698