| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Called on the FILE thread to detect an upgrade. Calls back UpgradeDetected | 67 // Called on the FILE thread to detect an upgrade. Calls back UpgradeDetected |
| 68 // on the UI thread if so. Although it looks weird, this needs to be a static | 68 // on the UI thread if so. Although it looks weird, this needs to be a static |
| 69 // method receiving a WeakPtr<> to this object so that we can interrupt | 69 // method receiving a WeakPtr<> to this object so that we can interrupt |
| 70 // the UpgradeDetected callback before it runs. Having this method non-static | 70 // the UpgradeDetected callback before it runs. Having this method non-static |
| 71 // and using |this| directly wouldn't be thread safe. And keeping it as a | 71 // and using |this| directly wouldn't be thread safe. And keeping it as a |
| 72 // non-class function would prevent it from calling UpgradeDetected. | 72 // non-class function would prevent it from calling UpgradeDetected. |
| 73 static void DetectUpgradeTask( | 73 static void DetectUpgradeTask( |
| 74 base::WeakPtr<UpgradeDetectorImpl> upgrade_detector); | 74 base::WeakPtr<UpgradeDetectorImpl> upgrade_detector); |
| 75 | 75 |
| 76 // We periodically check to see if Chrome has been upgraded. | 76 // We periodically check to see if Chrome has been upgraded. |
| 77 base::RepeatingTimer<UpgradeDetectorImpl> detect_upgrade_timer_; | 77 base::RepeatingTimer detect_upgrade_timer_; |
| 78 | 78 |
| 79 // After we detect an upgrade we start a recurring timer to see if enough time | 79 // After we detect an upgrade we start a recurring timer to see if enough time |
| 80 // has passed and we should start notifying the user. | 80 // has passed and we should start notifying the user. |
| 81 base::RepeatingTimer<UpgradeDetectorImpl> upgrade_notification_timer_; | 81 base::RepeatingTimer upgrade_notification_timer_; |
| 82 | 82 |
| 83 // True if this build is a dev or canary channel build. | 83 // True if this build is a dev or canary channel build. |
| 84 bool is_unstable_channel_; | 84 bool is_unstable_channel_; |
| 85 | 85 |
| 86 // True if auto update is turned on. | 86 // True if auto update is turned on. |
| 87 bool is_auto_update_enabled_; | 87 bool is_auto_update_enabled_; |
| 88 | 88 |
| 89 // When the upgrade was detected - either a software update or a variations | 89 // When the upgrade was detected - either a software update or a variations |
| 90 // update, whichever happened first. | 90 // update, whichever happened first. |
| 91 base::TimeTicks upgrade_detected_time_; | 91 base::TimeTicks upgrade_detected_time_; |
| 92 | 92 |
| 93 // The date the binaries were built. | 93 // The date the binaries were built. |
| 94 base::Time build_date_; | 94 base::Time build_date_; |
| 95 | 95 |
| 96 // 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 |
| 97 // the task to the actual upgrade detection code, which is in | 97 // the task to the actual upgrade detection code, which is in |
| 98 // DetectUpgradeTask. | 98 // DetectUpgradeTask. |
| 99 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; | 99 base::WeakPtrFactory<UpgradeDetectorImpl> weak_factory_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); | 101 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 | 104 |
| 105 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ | 105 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ |
| OLD | NEW |