| 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 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" | 5 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 if (library->status().status != chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) | 28 if (library->status().status != chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) |
| 29 return; | 29 return; |
| 30 | 30 |
| 31 NotifyUpgradeDetected(); | 31 NotifyUpgradeDetected(); |
| 32 | 32 |
| 33 // ChromeOS shows upgrade arrow once the upgrade becomes available. | 33 // ChromeOS shows upgrade arrow once the upgrade becomes available. |
| 34 NotifyOnUpgrade(); | 34 NotifyOnUpgrade(); |
| 35 | 35 |
| 36 // Setup timer to to move along the upgrade advisory system. | 36 // Setup timer to to move along the upgrade advisory system. |
| 37 upgrade_notification_timer_.Start( | 37 upgrade_notification_timer_.Start( |
| 38 base::TimeDelta::FromMilliseconds(kNotifyCycleTimeMs), | 38 FROM_HERE, base::TimeDelta::FromMilliseconds(kNotifyCycleTimeMs), |
| 39 this, &UpgradeDetectorChromeos::NotifyOnUpgrade); | 39 this, &UpgradeDetectorChromeos::NotifyOnUpgrade); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void UpgradeDetectorChromeos::NotifyOnUpgrade() { | 42 void UpgradeDetectorChromeos::NotifyOnUpgrade() { |
| 43 base::TimeDelta delta = base::Time::Now() - upgrade_detected_time(); | 43 base::TimeDelta delta = base::Time::Now() - upgrade_detected_time(); |
| 44 int64 time_passed = delta.InDays(); | 44 int64 time_passed = delta.InDays(); |
| 45 | 45 |
| 46 const int kSevereThreshold = 7; | 46 const int kSevereThreshold = 7; |
| 47 const int kHighThreshold = 4; | 47 const int kHighThreshold = 4; |
| 48 const int kElevatedThreshold = 2; | 48 const int kElevatedThreshold = 2; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 UpgradeDetectorChromeos* UpgradeDetectorChromeos::GetInstance() { | 71 UpgradeDetectorChromeos* UpgradeDetectorChromeos::GetInstance() { |
| 72 return Singleton<UpgradeDetectorChromeos>::get(); | 72 return Singleton<UpgradeDetectorChromeos>::get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // static | 75 // static |
| 76 UpgradeDetector* UpgradeDetector::GetInstance() { | 76 UpgradeDetector* UpgradeDetector::GetInstance() { |
| 77 return UpgradeDetectorChromeos::GetInstance(); | 77 return UpgradeDetectorChromeos::GetInstance(); |
| 78 } | 78 } |
| OLD | NEW |