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.h" | 9 #include "base/timer.h" |
10 #include "chrome/browser/upgrade_detector.h" | 10 #include "chrome/browser/upgrade_detector.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 private: | 21 private: |
22 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>; | 22 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>; |
23 | 23 |
24 UpgradeDetectorImpl(); | 24 UpgradeDetectorImpl(); |
25 | 25 |
26 // Launches a task on the file thread to check if we have the latest version. | 26 // Launches a task on the file thread to check if we have the latest version. |
27 void CheckForUpgrade(); | 27 void CheckForUpgrade(); |
28 | 28 |
29 // Sends out a notification and starts a one shot timer to wait until | 29 // Sends out a notification and starts a one shot timer to wait until |
30 // notifying the user. | 30 // notifying the user. |
31 void UpgradeDetected(); | 31 void UpgradeDetected(bool critical, bool unstable_channel); |
| 32 |
| 33 // Get the current network time and compare it to the build time to identify |
| 34 // an outdated install. |
| 35 void CompareBuildTimeToSaneTime(); |
32 | 36 |
33 // The function that sends out a notification (after a certain time has | 37 // The function that sends out a notification (after a certain time has |
34 // elapsed) that lets the rest of the UI know we should start notifying the | 38 // elapsed) that lets the rest of the UI know we should start notifying the |
35 // user that a new version is available. | 39 // user that a new version is available. |
36 void NotifyOnUpgrade(); | 40 void NotifyOnUpgrade(); |
37 | 41 |
| 42 // Called on the FILE thread to detect an upgrade. Calls back UpgradeDetected |
| 43 // on the UI thread if so. |
| 44 static void DetectUpgradeTask( |
| 45 base::WeakPtr<UpgradeDetectorImpl> upgrade_detector); |
| 46 |
38 // We periodically check to see if Chrome has been upgraded. | 47 // We periodically check to see if Chrome has been upgraded. |
39 base::RepeatingTimer<UpgradeDetectorImpl> detect_upgrade_timer_; | 48 base::RepeatingTimer<UpgradeDetectorImpl> detect_upgrade_timer_; |
40 | 49 |
41 // After we detect an upgrade we start a recurring timer to see if enough time | 50 // After we detect an upgrade we start a recurring timer to see if enough time |
42 // has passed and we should start notifying the user. | 51 // has passed and we should start notifying the user. |
43 base::RepeatingTimer<UpgradeDetectorImpl> upgrade_notification_timer_; | 52 base::RepeatingTimer<UpgradeDetectorImpl> upgrade_notification_timer_; |
44 | 53 |
45 // We use this factory to create callback tasks for UpgradeDetected. We pass | 54 // We use this factory to create callback tasks for UpgradeDetected. We pass |
46 // the task to the actual upgrade detection code, which is in | 55 // the task to the actual upgrade detection code, which is in |
47 // DetectUpgradeTask. | 56 // DetectUpgradeTask. |
48 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; | 57 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; |
49 | 58 |
50 // True if this build is a dev or canary channel build. | 59 // True if this build is a dev or canary channel build. |
51 bool is_unstable_channel_; | 60 bool is_unstable_channel_; |
52 | 61 |
| 62 // True if group policies and platform accepts reinstalls for outdated builds. |
| 63 bool is_outdated_reinstall_allowed_; |
| 64 |
| 65 // The date the binaries were built. |
| 66 base::Time build_date_; |
| 67 |
53 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); | 68 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); |
54 }; | 69 }; |
55 | 70 |
56 | 71 |
57 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ | 72 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ |
OLD | NEW |