OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return badge ? IDR_UPDATE_BADGE2 : IDR_UPDATE_MENU2; | 55 return badge ? IDR_UPDATE_BADGE2 : IDR_UPDATE_MENU2; |
56 case UPGRADE_ANNOYANCE_LOW: | 56 case UPGRADE_ANNOYANCE_LOW: |
57 return badge ? IDR_UPDATE_BADGE : IDR_UPDATE_MENU; | 57 return badge ? IDR_UPDATE_BADGE : IDR_UPDATE_MENU; |
58 default: | 58 default: |
59 return 0; | 59 return 0; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 UpgradeDetector::UpgradeDetector() | 63 UpgradeDetector::UpgradeDetector() |
64 : is_critical_upgrade_(false), | 64 : is_critical_upgrade_(false), |
| 65 is_outdated_install_(false), |
65 critical_update_acknowledged_(false), | 66 critical_update_acknowledged_(false), |
66 upgrade_notification_stage_(UPGRADE_ANNOYANCE_NONE), | 67 upgrade_notification_stage_(UPGRADE_ANNOYANCE_NONE), |
67 notify_upgrade_(false) { | 68 notify_upgrade_(false) { |
68 } | 69 } |
69 | 70 |
70 UpgradeDetector::~UpgradeDetector() { | 71 UpgradeDetector::~UpgradeDetector() { |
71 } | 72 } |
72 | 73 |
73 void UpgradeDetector::NotifyUpgradeDetected() { | 74 void UpgradeDetector::NotifyUpgradeDetected() { |
74 upgrade_detected_time_ = base::Time::Now(); | 75 upgrade_detected_time_ = base::Time::Now(); |
75 critical_update_acknowledged_ = false; | 76 critical_update_acknowledged_ = false; |
76 } | 77 } |
77 | 78 |
78 void UpgradeDetector::NotifyUpgradeRecommended() { | 79 void UpgradeDetector::NotifyUpgradeRecommended() { |
79 notify_upgrade_ = true; | 80 notify_upgrade_ = true; |
80 | 81 |
| 82 if (IsOutdatedInstall()) { |
| 83 content::NotificationService::current()->Notify( |
| 84 chrome::NOTIFICATION_OUTDATED_INSTALL, |
| 85 content::Source<UpgradeDetector>(this), |
| 86 content::NotificationService::NoDetails()); |
| 87 } |
| 88 |
81 content::NotificationService::current()->Notify( | 89 content::NotificationService::current()->Notify( |
82 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 90 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
83 content::Source<UpgradeDetector>(this), | 91 content::Source<UpgradeDetector>(this), |
84 content::NotificationService::NoDetails()); | 92 content::NotificationService::NoDetails()); |
85 | 93 |
86 if (is_critical_upgrade_) { | 94 if (is_critical_upgrade_) { |
87 int idle_timer = UseTestingIntervals() ? | 95 int idle_timer = UseTestingIntervals() ? |
88 kIdleRepeatingTimerWait : | 96 kIdleRepeatingTimerWait : |
89 kIdleRepeatingTimerWait * 60; // To minutes. | 97 kIdleRepeatingTimerWait * 60; // To minutes. |
90 idle_check_timer_.Start(FROM_HERE, | 98 idle_check_timer_.Start(FROM_HERE, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 break; | 133 break; |
126 case IDLE_STATE_ACTIVE: | 134 case IDLE_STATE_ACTIVE: |
127 case IDLE_STATE_UNKNOWN: | 135 case IDLE_STATE_UNKNOWN: |
128 break; | 136 break; |
129 default: | 137 default: |
130 NOTREACHED(); // Need to add any new value above (either providing | 138 NOTREACHED(); // Need to add any new value above (either providing |
131 // automatic restart or show notification to user). | 139 // automatic restart or show notification to user). |
132 break; | 140 break; |
133 } | 141 } |
134 } | 142 } |
OLD | NEW |