Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3371)

Unified Diff: chrome/browser/ui/webui/help/version_updater_mac.mm

Issue 1769703002: Add viewing of error messages from Keystone upon self-update failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a12e3304d6580bf276c3fc6d5cfb45bce8f8ca16 100644
--- a/chrome/browser/ui/webui/help/version_updater_mac.mm
+++ b/chrome/browser/ui/webui/help/version_updater_mac.mm
@@ -6,6 +6,8 @@
#include "base/bind.h"
#include "base/bind_helpers.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"
@@ -132,6 +134,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];
bool enable_promote_button = true;
base::string16 message;
@@ -211,6 +215,20 @@ void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) {
NOTREACHED();
return;
}
+
+ // If there are any specific error messages being passed along by Keystone,
+ // include them in a <pre> block.
+ if (!message.empty() &&
+ keystone_errors_utf8 && strlen(keystone_errors_utf8)) {
+ // TODO: Should we localize the "Error details" string? If so, get the
+ // string translated and into GRD, then replace this StringPrintf call
+ // with a call to l10n_util::GetStringFUTF16(IDS_KEYSTONE_ERROR_DETAILS).
+ std::string formatted_errors =
+ base::StringPrintf("<br/><br/>Error details:<br/><pre>%s</pre>",
+ keystone_errors_utf8);
Boris Vidolov 2016/03/08 22:32:52 The code needs to sanitize the contents of keyston
+ message += base::UTF8ToUTF16(formatted_errors.c_str());
+ }
+
if (!status_callback_.is_null())
status_callback_.Run(status, 0, message);
« chrome/browser/mac/keystone_registration.mm ('K') | « chrome/browser/mac/keystone_registration.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698