OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options2/chromeos/timezone_options_util.h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/timezone_options_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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 timezone.getDisplayName(dst_offset != 0, icu::TimeZone::LONG, name); | 114 timezone.getDisplayName(dst_offset != 0, icu::TimeZone::LONG, name); |
115 string16 result(l10n_util::GetStringFUTF16( | 115 string16 result(l10n_util::GetStringFUTF16( |
116 IDS_OPTIONS_SETTINGS_TIMEZONE_DISPLAY_TEMPLATE, ASCIIToUTF16(offset_str), | 116 IDS_OPTIONS_SETTINGS_TIMEZONE_DISPLAY_TEMPLATE, ASCIIToUTF16(offset_str), |
117 string16(name.getBuffer(), name.length()), GetExemplarCity(timezone))); | 117 string16(name.getBuffer(), name.length()), GetExemplarCity(timezone))); |
118 base::i18n::AdjustStringForLocaleDirection(&result); | 118 base::i18n::AdjustStringForLocaleDirection(&result); |
119 return result; | 119 return result; |
120 } | 120 } |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 namespace options2 { | 124 namespace options { |
125 | 125 |
126 // Creates a list of pairs of each timezone's ID and name. | 126 // Creates a list of pairs of each timezone's ID and name. |
127 scoped_ptr<base::ListValue> GetTimezoneList() { | 127 scoped_ptr<base::ListValue> GetTimezoneList() { |
128 const std::vector<icu::TimeZone*> &timezones = | 128 const std::vector<icu::TimeZone*> &timezones = |
129 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); | 129 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); |
130 scoped_ptr<base::ListValue> timezoneList(new base::ListValue()); | 130 scoped_ptr<base::ListValue> timezoneList(new base::ListValue()); |
131 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones.begin(); | 131 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones.begin(); |
132 iter != timezones.end(); ++iter) { | 132 iter != timezones.end(); ++iter) { |
133 const icu::TimeZone* timezone = *iter; | 133 const icu::TimeZone* timezone = *iter; |
134 base::ListValue* option = new base::ListValue(); | 134 base::ListValue* option = new base::ListValue(); |
135 option->Append(Value::CreateStringValue( | 135 option->Append(Value::CreateStringValue( |
136 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone))); | 136 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone))); |
137 option->Append(Value::CreateStringValue(GetTimezoneName(*timezone))); | 137 option->Append(Value::CreateStringValue(GetTimezoneName(*timezone))); |
138 timezoneList->Append(option); | 138 timezoneList->Append(option); |
139 } | 139 } |
140 return timezoneList.Pass(); | 140 return timezoneList.Pass(); |
141 } | 141 } |
142 | 142 |
143 } // namespace options2 | 143 } // namespace options |
OLD | NEW |