Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/system/timezone_util.h" | 5 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 111 |
| 112 // TODO(jungshik): When coming up with a better list of timezones, we also | 112 // TODO(jungshik): When coming up with a better list of timezones, we also |
| 113 // have to come up with better 'display' names. One possibility is to list | 113 // have to come up with better 'display' names. One possibility is to list |
| 114 // multiple cities (e.g. "Los Angeles, Vancouver .." in the order of | 114 // multiple cities (e.g. "Los Angeles, Vancouver .." in the order of |
| 115 // the population of a country the city belongs to.). | 115 // the population of a country the city belongs to.). |
| 116 // We can also think of using LONG_GENERIC or LOCATION once we upgrade | 116 // We can also think of using LONG_GENERIC or LOCATION once we upgrade |
| 117 // to ICU 4.6. | 117 // to ICU 4.6. |
| 118 // In the meantime, we use "LONG" name with "Exemplar City" to distinguish | 118 // In the meantime, we use "LONG" name with "Exemplar City" to distinguish |
| 119 // multiple timezones with the same "LONG" name but with different | 119 // multiple timezones with the same "LONG" name but with different |
| 120 // rules (e.g. US Mountain Time in Denver vs Phoenix). | 120 // rules (e.g. US Mountain Time in Denver vs Phoenix). |
| 121 icu::UnicodeString id; | |
| 121 icu::UnicodeString name; | 122 icu::UnicodeString name; |
| 122 timezone.getDisplayName(dst_offset != 0, icu::TimeZone::LONG, name); | 123 timezone.getID(id); |
| 124 if (id == icu::UnicodeString(chromeos::system::kUTCTimezoneName)) { | |
| 125 name = icu::UnicodeString( | |
| 126 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_TIMEZONE_DISPLAY_NAME_UTC) | |
| 127 .c_str()); | |
| 128 } else { | |
| 129 timezone.getDisplayName(dst_offset != 0, icu::TimeZone::LONG, name); | |
| 130 } | |
| 123 base::string16 result(l10n_util::GetStringFUTF16( | 131 base::string16 result(l10n_util::GetStringFUTF16( |
| 124 IDS_OPTIONS_SETTINGS_TIMEZONE_DISPLAY_TEMPLATE, | 132 IDS_OPTIONS_SETTINGS_TIMEZONE_DISPLAY_TEMPLATE, |
| 125 base::ASCIIToUTF16(offset_str), | 133 base::ASCIIToUTF16(offset_str), |
| 126 base::string16(name.getBuffer(), name.length()), | 134 base::string16(name.getBuffer(), name.length()), |
| 127 GetExemplarCity(timezone))); | 135 GetExemplarCity(timezone))); |
|
jungshik at Google
2015/10/16 22:47:15
The end result in en-US would be
UTC+00:00 Coord
| |
| 128 base::i18n::AdjustStringForLocaleDirection(&result); | 136 base::i18n::AdjustStringForLocaleDirection(&result); |
| 129 return result; | 137 return result; |
| 130 } | 138 } |
| 131 | 139 |
| 132 } // namespace | 140 } // namespace |
| 133 | 141 |
| 134 namespace chromeos { | 142 namespace chromeos { |
| 135 namespace system { | 143 namespace system { |
| 136 | 144 |
| 137 // Creates a list of pairs of each timezone's ID and name. | 145 // Creates a list of pairs of each timezone's ID and name. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId | 198 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId |
| 191 << "'"; | 199 << "'"; |
| 192 | 200 |
| 193 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 201 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 194 base::UTF8ToUTF16(timezone->timeZoneId)); | 202 base::UTF8ToUTF16(timezone->timeZoneId)); |
| 195 } | 203 } |
| 196 } | 204 } |
| 197 | 205 |
| 198 } // namespace system | 206 } // namespace system |
| 199 } // namespace chromeos | 207 } // namespace chromeos |
| OLD | NEW |