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

Unified Diff: chrome/browser/ui/webui/ntp/foreign_session_handler.cc

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tony's comments Created 6 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/ntp/foreign_session_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
index dc2d3149406d28009dfaef74352d0f27bb909e17..74d765007cce6cf970073ffe49eb278b74d549b4 100644
--- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
@@ -221,8 +221,9 @@ base::string16 ForeignSessionHandler::FormatSessionTime(
const base::Time& time) {
// Return a time like "1 hour ago", "2 days ago", etc.
base::Time now = base::Time::Now();
- // TimeElapsed does not support negative TimeDelta values, so then we use 0.
- return ui::TimeFormat::TimeElapsed(
+ // TimeFormat does not support negative TimeDelta values, so then we use 0.
+ return ui::TimeFormat::Simple(
+ ui::TimeFormat::FORMAT_ELAPSED, ui::TimeFormat::LENGTH_SHORT,
now < time ? base::TimeDelta() : now - time);
}
@@ -408,7 +409,8 @@ bool ForeignSessionHandler::SessionWindowToValue(
dictionary->SetString("userVisibleTimestamp",
last_synced < base::TimeDelta::FromMinutes(1) ?
l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) :
- ui::TimeFormat::TimeElapsed(last_synced));
+ ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED,
+ ui::TimeFormat::LENGTH_SHORT, last_synced));
dictionary->SetInteger("sessionId", window.window_id.id());
dictionary->Set("tabs", tab_values.release());
return true;
« no previous file with comments | « chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698