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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
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_IMPL_H_ 5 #ifndef CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_
6 #define CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ 6 #define CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "base/version.h" 10 #include "base/version.h"
11 #include "chrome/browser/upgrade_detector.h" 11 #include "chrome/browser/upgrade_detector.h"
12 #include "components/variations/service/variations_service.h" 12 #include "components/variations/service/variations_service.h"
13 13
14 namespace base {
14 template <typename T> struct DefaultSingletonTraits; 15 template <typename T> struct DefaultSingletonTraits;
16 }
15 17
16 class UpgradeDetectorImpl : public UpgradeDetector, 18 class UpgradeDetectorImpl : public UpgradeDetector,
17 public variations::VariationsService::Observer { 19 public variations::VariationsService::Observer {
18 public: 20 public:
19 ~UpgradeDetectorImpl() override; 21 ~UpgradeDetectorImpl() override;
20 22
21 // Returns the currently installed Chrome version, which may be newer than the 23 // Returns the currently installed Chrome version, which may be newer than the
22 // one currently running. Not supported on Android, iOS or ChromeOS. Must be 24 // one currently running. Not supported on Android, iOS or ChromeOS. Must be
23 // run on a thread where I/O operations are allowed (e.g. FILE thread). 25 // run on a thread where I/O operations are allowed (e.g. FILE thread).
24 static base::Version GetCurrentlyInstalledVersion(); 26 static base::Version GetCurrentlyInstalledVersion();
25 27
26 // Returns the singleton instance. 28 // Returns the singleton instance.
27 static UpgradeDetectorImpl* GetInstance(); 29 static UpgradeDetectorImpl* GetInstance();
28 30
29 protected: 31 protected:
30 UpgradeDetectorImpl(); 32 UpgradeDetectorImpl();
31 33
32 // variations::VariationsService::Observer: 34 // variations::VariationsService::Observer:
33 void OnExperimentChangesDetected(Severity severity) override; 35 void OnExperimentChangesDetected(Severity severity) override;
34 36
35 // Trigger an "on upgrade" notification based on the specified |time_passed| 37 // Trigger an "on upgrade" notification based on the specified |time_passed|
36 // interval. Exposed as protected for testing. 38 // interval. Exposed as protected for testing.
37 void NotifyOnUpgradeWithTimePassed(base::TimeDelta time_passed); 39 void NotifyOnUpgradeWithTimePassed(base::TimeDelta time_passed);
38 40
39 private: 41 private:
40 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>; 42 friend struct base::DefaultSingletonTraits<UpgradeDetectorImpl>;
41 43
42 // Start the timer that will call |CheckForUpgrade()|. 44 // Start the timer that will call |CheckForUpgrade()|.
43 void StartTimerForUpgradeCheck(); 45 void StartTimerForUpgradeCheck();
44 46
45 // Launches a task on the file thread to check if we have the latest version. 47 // Launches a task on the file thread to check if we have the latest version.
46 void CheckForUpgrade(); 48 void CheckForUpgrade();
47 49
48 // Starts the upgrade notification timer that will check periodically whether 50 // Starts the upgrade notification timer that will check periodically whether
49 // enough time has elapsed to update the severity (which maps to visual 51 // enough time has elapsed to update the severity (which maps to visual
50 // badging) of the notification. 52 // badging) of the notification.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // We use this factory to create callback tasks for UpgradeDetected. We pass 96 // We use this factory to create callback tasks for UpgradeDetected. We pass
95 // the task to the actual upgrade detection code, which is in 97 // the task to the actual upgrade detection code, which is in
96 // DetectUpgradeTask. 98 // DetectUpgradeTask.
97 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; 99 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_;
98 100
99 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); 101 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl);
100 }; 102 };
101 103
102 104
103 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ 105 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/undo/bookmark_undo_service_factory.cc ('k') | chrome/browser/upgrade_detector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698