OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/system_options_handler.h" | 5 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 l10n_util::GetString(IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); | 100 l10n_util::GetString(IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); |
101 | 101 |
102 localized_strings->Set(L"timezoneList", GetTimezoneList()); | 102 localized_strings->Set(L"timezoneList", GetTimezoneList()); |
103 } | 103 } |
104 | 104 |
105 ListValue* SystemOptionsHandler::GetTimezoneList() { | 105 ListValue* SystemOptionsHandler::GetTimezoneList() { |
106 ListValue* timezoneList = new ListValue(); | 106 ListValue* timezoneList = new ListValue(); |
107 for (std::vector<icu::TimeZone*>::iterator iter = timezones_.begin(); | 107 for (std::vector<icu::TimeZone*>::iterator iter = timezones_.begin(); |
108 iter != timezones_.end(); ++iter) { | 108 iter != timezones_.end(); ++iter) { |
109 const icu::TimeZone* timezone = *iter; | 109 const icu::TimeZone* timezone = *iter; |
110 static const std::wstring delimiter(L"|"); | 110 ListValue* option = new ListValue(); |
111 std::wstring value = GetTimezoneID(timezone); | 111 option->Append(Value::CreateStringValue(GetTimezoneID(timezone))); |
112 value += delimiter; | 112 option->Append(Value::CreateStringValue(GetTimezoneName(timezone))); |
113 value += GetTimezoneName(timezone); | 113 timezoneList->Append(option); |
114 timezoneList->Append(Value::CreateStringValue(value)); | |
115 } | 114 } |
116 return timezoneList; | 115 return timezoneList; |
117 } | 116 } |
118 | 117 |
119 std::wstring SystemOptionsHandler::GetTimezoneName( | 118 std::wstring SystemOptionsHandler::GetTimezoneName( |
120 const icu::TimeZone* timezone) { | 119 const icu::TimeZone* timezone) { |
121 DCHECK(timezone); | 120 DCHECK(timezone); |
122 icu::UnicodeString name; | 121 icu::UnicodeString name; |
123 timezone->getDisplayName(name); | 122 timezone->getDisplayName(name); |
124 std::wstring output; | 123 std::wstring output; |
(...skipping 10 matching lines...) Expand all Loading... |
135 | 134 |
136 std::wstring SystemOptionsHandler::GetTimezoneID( | 135 std::wstring SystemOptionsHandler::GetTimezoneID( |
137 const icu::TimeZone* timezone) { | 136 const icu::TimeZone* timezone) { |
138 DCHECK(timezone); | 137 DCHECK(timezone); |
139 icu::UnicodeString id; | 138 icu::UnicodeString id; |
140 timezone->getID(id); | 139 timezone->getID(id); |
141 std::wstring output; | 140 std::wstring output; |
142 UTF16ToWide(id.getBuffer(), id.length(), &output); | 141 UTF16ToWide(id.getBuffer(), id.length(), &output); |
143 return output; | 142 return output; |
144 } | 143 } |
OLD | NEW |