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

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

Issue 2225003: Implement upgrade notifications.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UPGRADE_DETECTOR_H_
6 #define CHROME_BROWSER_UPGRADE_DETECTOR_H_
7
8 #include "base/singleton.h"
9 #include "base/timer.h"
10
11 ///////////////////////////////////////////////////////////////////////////////
12 // UpgradeDetector
13 //
14 // This class is a singleton class that monitors when an upgrade happens in the
15 // background. We basically ask Omaha what it thinks the latest version is and
16 // if our version is lower we send out a notification upon:
17 // a) Detecting an upgrade and...
18 // b) When we think the user should be notified about the upgrade.
19 // The latter happens much later, since we don't want to be too annoying.
20 //
21 class UpgradeDetector {
22 public:
23 ~UpgradeDetector();
24
25 bool notify_upgrade() { return notify_upgrade_; }
26
27 private:
28 UpgradeDetector();
29 friend struct DefaultSingletonTraits<UpgradeDetector>;
30
31 // Checks with Omaha if we have the latest version. If not, sends out a
32 // notification and starts a one shot timer to wait until notifying the
33 // user.
34 void CheckForUpgrade();
35
36 // The function that sends out a notification (after a certain time has
37 // elapsed) that lets the rest of the UI know we should start notifying the
38 // user that a new version is available.
39 void NotifyOnUpgrade();
40
41 // We periodically check to see if Chrome has been upgraded.
42 base::RepeatingTimer<UpgradeDetector> detect_upgrade_timer_;
43
44 // After we detect an upgrade we wait a set time before notifying the user.
45 base::OneShotTimer<UpgradeDetector> upgrade_notification_timer_;
46
47 // Whether we have detected an upgrade happening while we were running.
48 bool upgrade_detected_;
49
50 // Whether we have waited long enough after detecting an upgrade (to see
51 // is we should start nagging about upgrading).
52 bool notify_upgrade_;
53
54 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector);
55 };
56
57 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698