| OLD | NEW |
| 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/metrics/variations/variations_service.h" | 11 #include "chrome/browser/metrics/variations/variations_service.h" |
| 12 #include "chrome/browser/upgrade_detector.h" | 12 #include "chrome/browser/upgrade_detector.h" |
| 13 | 13 |
| 14 template <typename T> struct DefaultSingletonTraits; | 14 template <typename T> struct DefaultSingletonTraits; |
| 15 | 15 |
| 16 class UpgradeDetectorImpl : | 16 class UpgradeDetectorImpl : |
| 17 public UpgradeDetector, | 17 public UpgradeDetector, |
| 18 public chrome_variations::VariationsService::Observer { | 18 public chrome_variations::VariationsService::Observer { |
| 19 public: | 19 public: |
| 20 virtual ~UpgradeDetectorImpl(); | 20 ~UpgradeDetectorImpl() override; |
| 21 | 21 |
| 22 // Returns the currently installed Chrome version, which may be newer than the | 22 // Returns the currently installed Chrome version, which may be newer than the |
| 23 // one currently running. Not supported on Android, iOS or ChromeOS. Must be | 23 // one currently running. Not supported on Android, iOS or ChromeOS. Must be |
| 24 // run on a thread where I/O operations are allowed (e.g. FILE thread). | 24 // run on a thread where I/O operations are allowed (e.g. FILE thread). |
| 25 static base::Version GetCurrentlyInstalledVersion(); | 25 static base::Version GetCurrentlyInstalledVersion(); |
| 26 | 26 |
| 27 // Returns the singleton instance. | 27 // Returns the singleton instance. |
| 28 static UpgradeDetectorImpl* GetInstance(); | 28 static UpgradeDetectorImpl* GetInstance(); |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 UpgradeDetectorImpl(); | 31 UpgradeDetectorImpl(); |
| 32 | 32 |
| 33 // chrome_variations::VariationsService::Observer: | 33 // chrome_variations::VariationsService::Observer: |
| 34 virtual void OnExperimentChangesDetected(Severity severity) override; | 34 void OnExperimentChangesDetected(Severity severity) override; |
| 35 | 35 |
| 36 // Trigger an "on upgrade" notification based on the specified |time_passed| | 36 // Trigger an "on upgrade" notification based on the specified |time_passed| |
| 37 // interval. Exposed as protected for testing. | 37 // interval. Exposed as protected for testing. |
| 38 void NotifyOnUpgradeWithTimePassed(base::TimeDelta time_passed); | 38 void NotifyOnUpgradeWithTimePassed(base::TimeDelta time_passed); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>; | 41 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>; |
| 42 | 42 |
| 43 // Start the timer that will call |CheckForUpgrade()|. | 43 // Start the timer that will call |CheckForUpgrade()|. |
| 44 void StartTimerForUpgradeCheck(); | 44 void StartTimerForUpgradeCheck(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // We use this factory to create callback tasks for UpgradeDetected. We pass | 95 // We use this factory to create callback tasks for UpgradeDetected. We pass |
| 96 // the task to the actual upgrade detection code, which is in | 96 // the task to the actual upgrade detection code, which is in |
| 97 // DetectUpgradeTask. | 97 // DetectUpgradeTask. |
| 98 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; | 98 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); | 100 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 | 103 |
| 104 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ | 104 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ |
| OLD | NEW |