Chromium Code Reviews| Index: content/browser/time_zone_monitor.cc |
| diff --git a/content/browser/time_zone_monitor.cc b/content/browser/time_zone_monitor.cc |
| index f61280b23a193ec0da98f0c46bc687b77abd6461..9831f74ef80b0cf30250a1556e021d07149ef47f 100644 |
| --- a/content/browser/time_zone_monitor.cc |
| +++ b/content/browser/time_zone_monitor.cc |
| @@ -7,6 +7,8 @@ |
| #include "base/logging.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/render_process_host.h" |
| +#include "third_party/icu/source/common/unicode/unistr.h" |
| +#include "third_party/icu/source/i18n/unicode/timezone.h" |
| namespace content { |
| @@ -20,11 +22,23 @@ TimeZoneMonitor::~TimeZoneMonitor() { |
| void TimeZoneMonitor::NotifyRenderers() { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| +#if defined(OS_CHROMEOS) |
| + // On CrOS, ICU's default tz is already set to a new zone. No |
| + // need to redetect it with detectHostTimeZone(). |
| + scoped_ptr<icu::TimeZone> new_zone(icu::TimeZone::createDefault()); |
| +#else |
| + icu::TimeZone* new_zone = icu::TimeZone::detectHostTimeZone(); |
| + icu::TimeZone::adoptDefault(new_zone); |
| +#endif |
| + icu::UnicodeString zone_id; |
| + std::string zone_id_str; |
| + new_zone->getID(zone_id).toUTF8String(zone_id_str); |
| + VLOG(0) << "timezone reset to " << zone_id_str; |
|
jungshik at Google
2015/04/10 00:23:44
I expected this function to be called only once pe
Mark Mentovai
2015/04/10 13:18:59
Jungshik at google wrote:
|
| for (RenderProcessHost::iterator iterator = |
| RenderProcessHost::AllHostsIterator(); |
| !iterator.IsAtEnd(); |
| iterator.Advance()) { |
| - iterator.GetCurrentValue()->NotifyTimezoneChange(); |
| + iterator.GetCurrentValue()->NotifyTimezoneChange(zone_id_str); |
| } |
| } |