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/ui/webui/help/version_updater_mac.h" | 5 #include "chrome/browser/ui/webui/help/version_updater_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "chrome/browser/lifetime/application_lifetime.h" | 9 #include "chrome/browser/lifetime/application_lifetime.h" |
10 #import "chrome/browser/mac/keystone_glue.h" | 10 #import "chrome/browser/mac/keystone_glue.h" |
| 11 #include "chrome/browser/mac/obsolete_system.h" |
11 #include "grit/chromium_strings.h" | 12 #include "grit/chromium_strings.h" |
12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
14 | 15 |
15 // KeystoneObserver is a simple notification observer for Keystone status | 16 // KeystoneObserver is a simple notification observer for Keystone status |
16 // updates. It will be created and managed by VersionUpdaterMac. | 17 // updates. It will be created and managed by VersionUpdaterMac. |
17 @interface KeystoneObserver : NSObject { | 18 @interface KeystoneObserver : NSObject { |
18 @private | 19 @private |
19 VersionUpdaterMac* versionUpdater_; // Weak. | 20 VersionUpdaterMac* versionUpdater_; // Weak. |
20 } | 21 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (!promote_callback_.is_null()) { | 217 if (!promote_callback_.is_null()) { |
217 PromotionState promotion_state = PROMOTE_HIDDEN; | 218 PromotionState promotion_state = PROMOTE_HIDDEN; |
218 if (show_promote_button_) | 219 if (show_promote_button_) |
219 promotion_state = enable_promote_button ? PROMOTE_ENABLED | 220 promotion_state = enable_promote_button ? PROMOTE_ENABLED |
220 : PROMOTE_DISABLED; | 221 : PROMOTE_DISABLED; |
221 promote_callback_.Run(promotion_state); | 222 promote_callback_.Run(promotion_state); |
222 } | 223 } |
223 } | 224 } |
224 | 225 |
225 void VersionUpdaterMac::UpdateShowPromoteButton() { | 226 void VersionUpdaterMac::UpdateShowPromoteButton() { |
| 227 if (ObsoleteSystemMac::Has32BitOnlyCPU() && |
| 228 ObsoleteSystemMac::Is32BitEndOfTheLine()) { |
| 229 // Promotion is moot upon reaching the end of the line. |
| 230 show_promote_button_ = false; |
| 231 return; |
| 232 } |
| 233 |
226 KeystoneGlue* keystone_glue = [KeystoneGlue defaultKeystoneGlue]; | 234 KeystoneGlue* keystone_glue = [KeystoneGlue defaultKeystoneGlue]; |
227 AutoupdateStatus recent_status = [keystone_glue recentStatus]; | 235 AutoupdateStatus recent_status = [keystone_glue recentStatus]; |
228 if (recent_status == kAutoupdateRegistering || | 236 if (recent_status == kAutoupdateRegistering || |
229 recent_status == kAutoupdateRegisterFailed || | 237 recent_status == kAutoupdateRegisterFailed || |
230 recent_status == kAutoupdatePromoted) { | 238 recent_status == kAutoupdatePromoted) { |
231 // Promotion isn't possible at this point. | 239 // Promotion isn't possible at this point. |
232 show_promote_button_ = false; | 240 show_promote_button_ = false; |
233 } else if (recent_status == kAutoupdatePromoting || | 241 } else if (recent_status == kAutoupdatePromoting || |
234 recent_status == kAutoupdatePromoteFailed) { | 242 recent_status == kAutoupdatePromoteFailed) { |
235 // Show promotion UI because the user either just clicked that button or | 243 // Show promotion UI because the user either just clicked that button or |
236 // because the user should be able to click it again. | 244 // because the user should be able to click it again. |
237 show_promote_button_ = true; | 245 show_promote_button_ = true; |
238 } else { | 246 } else { |
239 // Show the promote button if promotion is a possibility. | 247 // Show the promote button if promotion is a possibility. |
240 show_promote_button_ = [keystone_glue wantsPromotion]; | 248 show_promote_button_ = [keystone_glue wantsPromotion]; |
241 } | 249 } |
242 } | 250 } |
OLD | NEW |