| 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 "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 message += l10n_util::GetStringUTF16(IDS_UPGRADE_ERROR_DETAILS); | 230 message += l10n_util::GetStringUTF16(IDS_UPGRADE_ERROR_DETAILS); |
| 231 message += base::UTF8ToUTF16("<br/><pre>"); | 231 message += base::UTF8ToUTF16("<br/><pre>"); |
| 232 message += base::UTF8ToUTF16(net::EscapeForHTML(error_messages)); | 232 message += base::UTF8ToUTF16(net::EscapeForHTML(error_messages)); |
| 233 message += base::UTF8ToUTF16("</pre>"); | 233 message += base::UTF8ToUTF16("</pre>"); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 if (!status_callback_.is_null()) | 237 if (!status_callback_.is_null()) |
| 238 status_callback_.Run(status, 0, message); | 238 status_callback_.Run(status, 0, message); |
| 239 | 239 |
| 240 PromotionState promotion_state; |
| 240 if (!promote_callback_.is_null()) { | 241 if (!promote_callback_.is_null()) { |
| 241 PromotionState promotion_state = PROMOTE_HIDDEN; | 242 KeystoneGlue* keystone_glue = [KeystoneGlue defaultKeystoneGlue]; |
| 242 if (show_promote_button_) | 243 if (keystone_glue && [keystone_glue isAutoupdateEnabledForAllUsers]) { |
| 243 promotion_state = enable_promote_button ? PROMOTE_ENABLED | 244 promotion_state = PROMOTED; |
| 244 : PROMOTE_DISABLED; | 245 } else { |
| 246 promotion_state = PROMOTE_HIDDEN; |
| 247 |
| 248 if (show_promote_button_) { |
| 249 promotion_state = enable_promote_button ? PROMOTE_ENABLED |
| 250 : PROMOTE_DISABLED; |
| 251 } |
| 252 } |
| 253 |
| 245 promote_callback_.Run(promotion_state); | 254 promote_callback_.Run(promotion_state); |
| 246 } | 255 } |
| 247 } | 256 } |
| 248 | 257 |
| 249 void VersionUpdaterMac::UpdateShowPromoteButton() { | 258 void VersionUpdaterMac::UpdateShowPromoteButton() { |
| 250 if (ObsoleteSystem::IsObsoleteNowOrSoon()) { | 259 if (ObsoleteSystem::IsObsoleteNowOrSoon()) { |
| 251 // Promotion is moot upon reaching the end of the line. | 260 // Promotion is moot upon reaching the end of the line. |
| 252 show_promote_button_ = false; | 261 show_promote_button_ = false; |
| 253 return; | 262 return; |
| 254 } | 263 } |
| 255 | 264 |
| 256 KeystoneGlue* keystone_glue = [KeystoneGlue defaultKeystoneGlue]; | 265 KeystoneGlue* keystone_glue = [KeystoneGlue defaultKeystoneGlue]; |
| 257 AutoupdateStatus recent_status = [keystone_glue recentStatus]; | 266 AutoupdateStatus recent_status = [keystone_glue recentStatus]; |
| 258 if (recent_status == kAutoupdateRegistering || | 267 if (recent_status == kAutoupdateRegistering || |
| 259 recent_status == kAutoupdateRegisterFailed || | 268 recent_status == kAutoupdateRegisterFailed || |
| 260 recent_status == kAutoupdatePromoted) { | 269 recent_status == kAutoupdatePromoted) { |
| 261 // Promotion isn't possible at this point. | 270 // Promotion isn't possible at this point. |
| 262 show_promote_button_ = false; | 271 show_promote_button_ = false; |
| 263 } else if (recent_status == kAutoupdatePromoting || | 272 } else if (recent_status == kAutoupdatePromoting || |
| 264 recent_status == kAutoupdatePromoteFailed) { | 273 recent_status == kAutoupdatePromoteFailed) { |
| 265 // Show promotion UI because the user either just clicked that button or | 274 // Show promotion UI because the user either just clicked that button or |
| 266 // because the user should be able to click it again. | 275 // because the user should be able to click it again. |
| 267 show_promote_button_ = true; | 276 show_promote_button_ = true; |
| 268 } else { | 277 } else { |
| 269 // Show the promote button if promotion is a possibility. | 278 // Show the promote button if promotion is a possibility. |
| 270 show_promote_button_ = [keystone_glue wantsPromotion]; | 279 show_promote_button_ = [keystone_glue wantsPromotion]; |
| 271 } | 280 } |
| 272 } | 281 } |
| OLD | NEW |