Chromium Code Reviews| Index: chrome/browser/ui/webui/help/version_updater_mac.mm |
| diff --git a/chrome/browser/ui/webui/help/version_updater_mac.mm b/chrome/browser/ui/webui/help/version_updater_mac.mm |
| index be9c08fae51df9624654a2f48ced5f131d66cfcf..4dc28b747346e7de6abd2f236628b11687dbf8a4 100644 |
| --- a/chrome/browser/ui/webui/help/version_updater_mac.mm |
| +++ b/chrome/browser/ui/webui/help/version_updater_mac.mm |
| @@ -6,11 +6,17 @@ |
| #include "base/bind.h" |
| #include "base/bind_helpers.h" |
| +#include "base/logging.h" |
| +#include "base/mac/foundation_util.h" |
| +#include "base/strings/stringprintf.h" |
| +#include "base/strings/sys_string_conversions.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/lifetime/application_lifetime.h" |
| #import "chrome/browser/mac/keystone_glue.h" |
| #include "chrome/browser/obsolete_system/obsolete_system.h" |
| #include "chrome/grit/chromium_strings.h" |
| #include "chrome/grit/generated_resources.h" |
| +#include "net/base/escape.h" |
| #include "ui/base/l10n/l10n_util.h" |
| // KeystoneObserver is a simple notification observer for Keystone status |
| @@ -131,7 +137,11 @@ void VersionUpdaterMac::RelaunchBrowser() const { |
| void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) { |
| AutoupdateStatus keystone_status = static_cast<AutoupdateStatus>( |
| - [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); |
| + [base::mac::ObjCCastStrict<NSNumber>( |
| + [dictionary objectForKey:kAutoupdateStatusStatus]) intValue]); |
| + std::string keystone_errors_utf8 = base::SysNSStringToUTF8( |
|
Mark Mentovai
2016/03/24 18:06:38
Be more generic than keystone_errors since this do
Ryan Myers (chromium)
2016/03/24 19:57:28
Done.
Ryan Myers (chromium)
2016/03/24 19:57:28
Done.
|
| + base::mac::ObjCCastStrict<NSString>( |
| + [dictionary objectForKey:kAutoupdateStatusErrorMessages])); |
| bool enable_promote_button = true; |
| base::string16 message; |
| @@ -211,6 +221,21 @@ void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) { |
| NOTREACHED(); |
| return; |
| } |
| + |
| + // If there are any specific error messages being passed along by Keystone, |
| + // log them, and include them in a <pre> block if we're showing an error. |
| + if (!keystone_errors_utf8.empty()) { |
| + VLOG(1) << "Keystone stderr: " << keystone_errors_utf8; |
| + |
| + if (!message.empty()) { |
| + message += base::UTF8ToUTF16("<br/><br/>"); |
| + message += l10n_util::GetStringUTF16(IDS_UPGRADE_ERROR_DETAILS); |
| + message += base::UTF8ToUTF16("<br/><pre>"); |
| + message += base::UTF8ToUTF16(net::EscapeForHTML(keystone_errors_utf8)); |
| + message += base::UTF8ToUTF16("</pre>"); |
| + } |
| + } |
| + |
| if (!status_callback_.is_null()) |
| status_callback_.Run(status, 0, message); |