| OLD | NEW |
| 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 #include "chrome/browser/upgrade_detector.h" | 5 #include "chrome/browser/upgrade_detector.h" |
| 6 | 6 |
| 7 #include "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // (without a reboot). For the dev channel however, I want quicker feedback | 22 // (without a reboot). For the dev channel however, I want quicker feedback |
| 23 // on how the feature works so I'm checking every hour and notifying the | 23 // on how the feature works so I'm checking every hour and notifying the |
| 24 // user immediately. | 24 // user immediately. |
| 25 | 25 |
| 26 // How often to check for an upgrade. | 26 // How often to check for an upgrade. |
| 27 static int kCheckForUpgradeEveryMs = 60 * 60 * 1000; // 1 hour. | 27 static int kCheckForUpgradeEveryMs = 60 * 60 * 1000; // 1 hour. |
| 28 | 28 |
| 29 // How long to wait before notifying the user about the upgrade. | 29 // How long to wait before notifying the user about the upgrade. |
| 30 static int kNotifyUserAfterMs = 0; | 30 static int kNotifyUserAfterMs = 0; |
| 31 | 31 |
| 32 UpgradeDetector::UpgradeDetector() : upgrade_detected_(false) { | 32 UpgradeDetector::UpgradeDetector() |
| 33 : upgrade_detected_(false), |
| 34 notify_upgrade_(false) { |
| 33 #if !defined(OS_WIN) | 35 #if !defined(OS_WIN) |
| 34 return; | 36 return; |
| 35 #endif | 37 #endif |
| 36 | 38 |
| 37 detect_upgrade_timer_.Start( | 39 detect_upgrade_timer_.Start( |
| 38 base::TimeDelta::FromMilliseconds(kCheckForUpgradeEveryMs), | 40 base::TimeDelta::FromMilliseconds(kCheckForUpgradeEveryMs), |
| 39 this, &UpgradeDetector::CheckForUpgrade); | 41 this, &UpgradeDetector::CheckForUpgrade); |
| 40 } | 42 } |
| 41 | 43 |
| 42 UpgradeDetector::~UpgradeDetector() { | 44 UpgradeDetector::~UpgradeDetector() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 89 } |
| 88 | 90 |
| 89 void UpgradeDetector::NotifyOnUpgrade() { | 91 void UpgradeDetector::NotifyOnUpgrade() { |
| 90 notify_upgrade_ = true; | 92 notify_upgrade_ = true; |
| 91 | 93 |
| 92 NotificationService::current()->Notify( | 94 NotificationService::current()->Notify( |
| 93 NotificationType::UPGRADE_RECOMMENDED, | 95 NotificationType::UPGRADE_RECOMMENDED, |
| 94 Source<UpgradeDetector>(this), | 96 Source<UpgradeDetector>(this), |
| 95 NotificationService::NoDetails()); | 97 NotificationService::NoDetails()); |
| 96 } | 98 } |
| OLD | NEW |