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/chromeos/login/network_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void NetworkScreenHandler::GetAdditionalParameters( | 167 void NetworkScreenHandler::GetAdditionalParameters( |
168 base::DictionaryValue* dict) { | 168 base::DictionaryValue* dict) { |
169 const std::string application_locale = | 169 const std::string application_locale = |
170 g_browser_process->GetApplicationLocale(); | 170 g_browser_process->GetApplicationLocale(); |
171 const std::string selected_input_method = | 171 const std::string selected_input_method = |
172 input_method::InputMethodManager::Get() | 172 input_method::InputMethodManager::Get() |
173 ->GetActiveIMEState() | 173 ->GetActiveIMEState() |
174 ->GetCurrentInputMethod() | 174 ->GetCurrentInputMethod() |
175 .id(); | 175 .id(); |
176 | 176 |
177 scoped_ptr<base::ListValue> language_list; | 177 std::unique_ptr<base::ListValue> language_list; |
178 if (model_) { | 178 if (model_) { |
179 if (model_->GetLanguageList() && | 179 if (model_->GetLanguageList() && |
180 model_->GetLanguageListLocale() == application_locale) { | 180 model_->GetLanguageListLocale() == application_locale) { |
181 language_list.reset(model_->GetLanguageList()->DeepCopy()); | 181 language_list.reset(model_->GetLanguageList()->DeepCopy()); |
182 } else { | 182 } else { |
183 model_->UpdateLanguageList(); | 183 model_->UpdateLanguageList(); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 if (!language_list.get()) | 187 if (!language_list.get()) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 ReloadLocalizedContent(); | 236 ReloadLocalizedContent(); |
237 } | 237 } |
238 | 238 |
239 // NetworkScreenHandler, private: ---------------------------------------------- | 239 // NetworkScreenHandler, private: ---------------------------------------------- |
240 | 240 |
241 // static | 241 // static |
242 base::ListValue* NetworkScreenHandler::GetTimezoneList() { | 242 base::ListValue* NetworkScreenHandler::GetTimezoneList() { |
243 std::string current_timezone_id; | 243 std::string current_timezone_id; |
244 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); | 244 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); |
245 | 245 |
246 scoped_ptr<base::ListValue> timezone_list(new base::ListValue); | 246 std::unique_ptr<base::ListValue> timezone_list(new base::ListValue); |
247 scoped_ptr<base::ListValue> timezones = system::GetTimezoneList(); | 247 std::unique_ptr<base::ListValue> timezones = system::GetTimezoneList(); |
248 for (size_t i = 0; i < timezones->GetSize(); ++i) { | 248 for (size_t i = 0; i < timezones->GetSize(); ++i) { |
249 const base::ListValue* timezone = NULL; | 249 const base::ListValue* timezone = NULL; |
250 CHECK(timezones->GetList(i, &timezone)); | 250 CHECK(timezones->GetList(i, &timezone)); |
251 | 251 |
252 std::string timezone_id; | 252 std::string timezone_id; |
253 CHECK(timezone->GetString(0, &timezone_id)); | 253 CHECK(timezone->GetString(0, &timezone_id)); |
254 | 254 |
255 std::string timezone_name; | 255 std::string timezone_name; |
256 CHECK(timezone->GetString(1, &timezone_name)); | 256 CHECK(timezone->GetString(1, &timezone_name)); |
257 | 257 |
258 scoped_ptr<base::DictionaryValue> timezone_option( | 258 std::unique_ptr<base::DictionaryValue> timezone_option( |
259 new base::DictionaryValue); | 259 new base::DictionaryValue); |
260 timezone_option->SetString("value", timezone_id); | 260 timezone_option->SetString("value", timezone_id); |
261 timezone_option->SetString("title", timezone_name); | 261 timezone_option->SetString("title", timezone_name); |
262 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 262 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
263 timezone_list->Append(timezone_option.release()); | 263 timezone_list->Append(timezone_option.release()); |
264 } | 264 } |
265 | 265 |
266 return timezone_list.release(); | 266 return timezone_list.release(); |
267 } | 267 } |
268 | 268 |
269 } // namespace chromeos | 269 } // namespace chromeos |
OLD | NEW |