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..a96c0bf6246f6084220ea6bd1546d5f0c839c923 100644 |
--- a/chrome/browser/ui/webui/help/version_updater_mac.mm |
+++ b/chrome/browser/ui/webui/help/version_updater_mac.mm |
@@ -6,11 +6,15 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
+#include "base/logging.h" |
+#include "base/strings/stringprintf.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 |
@@ -132,6 +136,8 @@ void VersionUpdaterMac::RelaunchBrowser() const { |
void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) { |
AutoupdateStatus keystone_status = static_cast<AutoupdateStatus>( |
[[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); |
+ const char* keystone_errors_utf8 = |
+ [[dictionary objectForKey:kAutoupdateStatusErrorMessages] UTF8String]; |
Mark Mentovai
2016/03/23 15:52:04
Use base::SysNSStringToUTF8 instead, to get a std:
Ryan Myers (chromium)
2016/03/23 22:29:38
Done.
|
bool enable_promote_button = true; |
base::string16 message; |
@@ -211,6 +217,25 @@ 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 && strlen(keystone_errors_utf8)) { |
+ VLOG(1) << "Keystone stderr: " << keystone_errors_utf8; |
+ |
+ if (!message.empty()) { |
+ // TODO: Should we localize the "Error details" string? If so, get the |
Mark Mentovai
2016/03/23 15:52:04
Yes. All of these strings should be localized.
Ev
Ryan Myers (chromium)
2016/03/23 22:29:38
Done.
|
+ // string translated and into GRD, then replace this StringPrintf call |
+ // with a call to l10n_util::GetStringFUTF16(IDS_KEYSTONE_ERROR_DETAILS). |
+ std::string escaped_keystone_errors_utf8 = |
+ net::EscapeForHTML(keystone_errors_utf8); |
+ std::string formatted_errors = |
+ base::StringPrintf("<br/><br/>Error details:<br/><pre>%s</pre>", |
Mark Mentovai
2016/03/23 15:52:04
You can build this up with string +ing, probably n
Ryan Myers (chromium)
2016/03/23 22:29:38
Done.
|
+ escaped_keystone_errors_utf8.c_str()); |
+ message += base::UTF8ToUTF16(formatted_errors.c_str()); |
+ } |
+ } |
+ |
if (!status_callback_.is_null()) |
status_callback_.Run(status, 0, message); |