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

Unified Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 10038034: Implemented a "Last Updated" field for the about page of Chrome OS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated comments, code style, etc. Created 8 years, 8 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
« base/sys_info_chromeos.cc ('K') | « chrome/browser/resources/help/help.html ('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/help_handler.cc
diff --git a/chrome/browser/ui/webui/help/help_handler.cc b/chrome/browser/ui/webui/help/help_handler.cc
index 6f3a246be2f659665f21efb848e254bb3cae6b65..77214896ddbf78af54798ff32380d21d69c589ff 100644
--- a/chrome/browser/ui/webui/help/help_handler.cc
+++ b/chrome/browser/ui/webui/help/help_handler.cc
@@ -34,6 +34,8 @@
#include "webkit/glue/webkit_glue.h"
#if defined(OS_CHROMEOS)
+#include "base/i18n/time_formatting.h"
+#include "base/sys_info.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/cros_settings.h"
#include "chrome/browser/profiles/profile.h"
@@ -90,6 +92,20 @@ bool CanChangeReleaseChannel() {
return false;
}
+// Retrieves the time of the last Chrome OS update and converts it to a human-
+// readable string. Note that this method uses an i18n-friendly library, so
+// the returned string will already be properly translated.
+string16 CreateLastUpdatedString() {
+ base::Time time;
+
+ if (!base::SysInfo::GetTimeLastUpdated(&time))
Evan Stade 2012/04/14 00:37:46 curlies
Kyle Horimoto 2012/04/16 18:32:54 Done.
+ // If the time of the last update cannot be retrieved, punt and just set
+ // the last update time to be the current time.
+ time = base::Time::Now();
+
+ return base::TimeFormatFriendlyDate(time);
+}
+
#endif // defined(OS_CHROMEOS)
} // namespace
@@ -136,6 +152,7 @@ void HelpHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
{ "webkit", IDS_WEBKIT },
{ "userAgent", IDS_ABOUT_VERSION_USER_AGENT },
{ "commandLine", IDS_ABOUT_VERSION_COMMAND_LINE },
+ { "lastUpdated", IDS_ABOUT_VERSION_LAST_UPDATED },
#endif
#if defined(OS_MACOSX)
{ "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER },
@@ -164,6 +181,8 @@ void HelpHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
IDS_ABOUT_CROS_VERSION_LICENSE,
ASCIIToUTF16(chrome::kChromeUIOSCreditsURL));
localized_strings->SetString("productOsLicense", os_license);
+
+ localized_strings->SetString("lastUpdatedDate", CreateLastUpdatedString());
Evan Stade 2012/04/14 00:37:46 you can't read a file on the UI thread. You must p
Kyle Horimoto 2012/04/16 18:32:54 Done.
#endif
string16 tos = l10n_util::GetStringFUTF16(
« base/sys_info_chromeos.cc ('K') | « chrome/browser/resources/help/help.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698