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