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

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

Issue 5711001: Add a new GetInstance() method for remaining files with singleton classes under chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 #pragma once 7 #pragma once
8 8
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 11
12 class PrefService; 12 class PrefService;
13 13
14 /////////////////////////////////////////////////////////////////////////////// 14 ///////////////////////////////////////////////////////////////////////////////
15 // UpgradeDetector 15 // UpgradeDetector
16 // 16 //
17 // This class is a singleton class that monitors when an upgrade happens in the 17 // This class is a singleton class that monitors when an upgrade happens in the
18 // background. We basically ask Omaha what it thinks the latest version is and 18 // background. We basically ask Omaha what it thinks the latest version is and
19 // if our version is lower we send out a notification upon: 19 // if our version is lower we send out a notification upon:
20 // a) Detecting an upgrade and... 20 // a) Detecting an upgrade and...
21 // b) When we think the user should be notified about the upgrade. 21 // b) When we think the user should be notified about the upgrade.
22 // The latter happens much later, since we don't want to be too annoying. 22 // The latter happens much later, since we don't want to be too annoying.
23 // 23 //
24 class UpgradeDetector { 24 class UpgradeDetector {
25 public: 25 public:
26 // Returns the singleton instance.
27 static UpgradeDetector* GetInstance();
28
26 ~UpgradeDetector(); 29 ~UpgradeDetector();
27 30
28 static void RegisterPrefs(PrefService* prefs); 31 static void RegisterPrefs(PrefService* prefs);
29 32
30 bool notify_upgrade() { return notify_upgrade_; } 33 bool notify_upgrade() { return notify_upgrade_; }
31 34
32 private: 35 private:
36 friend struct DefaultSingletonTraits<UpgradeDetector>;
37
33 UpgradeDetector(); 38 UpgradeDetector();
34 friend struct DefaultSingletonTraits<UpgradeDetector>;
35 39
36 // Launches a task on the file thread to check if we have the latest version. 40 // Launches a task on the file thread to check if we have the latest version.
37 void CheckForUpgrade(); 41 void CheckForUpgrade();
38 42
39 // Sends out a notification and starts a one shot timer to wait until 43 // Sends out a notification and starts a one shot timer to wait until
40 // notifying the user. 44 // notifying the user.
41 void UpgradeDetected(); 45 void UpgradeDetected();
42 46
43 // The function that sends out a notification (after a certain time has 47 // The function that sends out a notification (after a certain time has
44 // elapsed) that lets the rest of the UI know we should start notifying the 48 // elapsed) that lets the rest of the UI know we should start notifying the
(...skipping 12 matching lines...) Expand all
57 ScopedRunnableMethodFactory<UpgradeDetector> method_factory_; 61 ScopedRunnableMethodFactory<UpgradeDetector> method_factory_;
58 62
59 // Whether we have waited long enough after detecting an upgrade (to see 63 // Whether we have waited long enough after detecting an upgrade (to see
60 // is we should start nagging about upgrading). 64 // is we should start nagging about upgrading).
61 bool notify_upgrade_; 65 bool notify_upgrade_;
62 66
63 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector); 67 DISALLOW_COPY_AND_ASSIGN(UpgradeDetector);
64 }; 68 };
65 69
66 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_ 70 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698