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

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: Code review feedback pt4 Created 4 years, 9 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..a1853aef2ce53d8944fa8b78ce8132ebb1f228f1 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 error_messages = base::SysNSStringToUTF8(
+ 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 (!error_messages.empty()) {
+ VLOG(1) << "Update error messages: " << error_messages;
+
+ 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(error_messages));
+ message += base::UTF8ToUTF16("</pre>");
+ }
+ }
+
if (!status_callback_.is_null())
status_callback_.Run(status, 0, message);
« chrome/browser/mac/keystone_glue.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