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

Unified Diff: chrome/browser/chromeos/status/clock_menu_button.cc

Issue 7054032: Fix ChromeOS clock menu so that it can show 12-hour clock in all locales. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary use of PlatformTest. Created 9 years, 7 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 | « base/i18n/time_formatting_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/status/clock_menu_button.cc
diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc
index a6c72d2b0db4a81bf09794a2f49767112b416429..062c0d3ed088c164de5cd70ead5b9789414044c2 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button.cc
@@ -88,30 +88,10 @@ void ClockMenuButton::UpdateText() {
const bool use_24hour_clock =
host_->GetProfile() &&
host_->GetProfile()->GetPrefs()->GetBoolean(prefs::kUse24HourClock);
- if (use_24hour_clock) {
- SetText(UTF16ToWide(base::TimeFormatTimeOfDayWithHourClockType(
- time, base::k24HourClock)));
- } else {
- // Remove the am/pm field if it's present.
- scoped_ptr<icu::DateFormat> formatter(
- icu::DateFormat::createTimeInstance(icu::DateFormat::kShort));
- icu::UnicodeString time_string;
- icu::FieldPosition ampm_field(icu::DateFormat::kAmPmField);
- formatter->format(
- static_cast<UDate>(time.ToDoubleT() * 1000), time_string, ampm_field);
- int ampm_length = ampm_field.getEndIndex() - ampm_field.getBeginIndex();
- if (ampm_length) {
- int begin = ampm_field.getBeginIndex();
- // Doesn't include any spacing before the field.
- if (begin)
- begin--;
- time_string.removeBetween(begin, ampm_field.getEndIndex());
- }
- string16 time_string16 =
- string16(time_string.getBuffer(),
- static_cast<size_t>(time_string.length()));
- SetText(UTF16ToWide(time_string16));
- }
+ SetText(UTF16ToWide(base::TimeFormatTimeOfDayWithHourClockType(
+ time,
+ use_24hour_clock ? base::k24HourClock : base::k12HourClock,
+ base::kDropAmPm)));
SetTooltipText(UTF16ToWide(base::TimeFormatShortDate(time)));
SchedulePaint();
}
« no previous file with comments | « base/i18n/time_formatting_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698