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..b2a985ef1ff19316dc7bd8def68d9380cab75950 100644 |
--- a/chrome/browser/ui/webui/help/help_handler.cc |
+++ b/chrome/browser/ui/webui/help/help_handler.cc |
@@ -21,6 +21,7 @@ |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/chrome_version_info.h" |
#include "chrome/common/url_constants.h" |
+#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/web_ui.h" |
#include "content/public/common/content_client.h" |
@@ -34,6 +35,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" |
@@ -41,6 +44,7 @@ |
#endif |
using base::ListValue; |
+using content::BrowserThread; |
namespace { |
@@ -90,6 +94,28 @@ 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)) { |
+ // 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); |
+} |
+ |
+// Wrapper function to add the "Last Updated" string to |localized_strings|. |
+// This function is called from the File thread to ensure that it does not |
+// slow down the UI thread. |
+void AddLastUpdatedString(DictionaryValue* localized_strings) { |
+ localized_strings->SetString("lastUpdatedDate", CreateLastUpdatedString()); |
+} |
+ |
#endif // defined(OS_CHROMEOS) |
} // namespace |
@@ -136,6 +162,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 +191,9 @@ void HelpHandler::GetLocalizedValues(DictionaryValue* localized_strings) { |
IDS_ABOUT_CROS_VERSION_LICENSE, |
ASCIIToUTF16(chrome::kChromeUIOSCreditsURL)); |
localized_strings->SetString("productOsLicense", os_license); |
+ |
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&AddLastUpdatedString, localized_strings)); |
Evan Stade
2012/04/16 19:42:51
there is a race here, and besides which localized_
Kyle Horimoto
2012/04/17 18:31:45
Done.
|
#endif |
string16 tos = l10n_util::GetStringFUTF16( |