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

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: Display errors on status==FAILED, not !message.empty() 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
« no previous file with comments | « chrome/browser/mac/keystone_registration.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2d0e42e57773899d89d55b058a030b41d011cdb7 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,26 @@ void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) {
NOTREACHED();
return;
}
+
+ // If there are any detailed error messages being passed along by Keystone,
+ // log them. If we have an error to display, include the detail messages
+ // below the error in a <pre> block. Don't bother displaying detail messages
+ // on a success/in-progress/indeterminate status.
+ if (!error_messages.empty()) {
+ VLOG(1) << "Update error messages: " << error_messages;
+
+ if (status == FAILED) {
+ 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>");
xiyuan 2016/03/24 22:14:15 nit: String cancat is not i18n friendly. We should
+ }
+ }
+
if (!status_callback_.is_null())
status_callback_.Run(status, 0, message);
« no previous file with comments | « chrome/browser/mac/keystone_registration.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698