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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // 3) This is the bootstrapping process for a "Slave" device. The locale & | 239 // 3) This is the bootstrapping process for a "Slave" device. The locale & |
240 // input of the "Slave" device is set up by a "Master" device. In this case we | 240 // input of the "Slave" device is set up by a "Master" device. In this case we |
241 // don't want EnableLoginLayout() to reset the input method to the hardware | 241 // don't want EnableLoginLayout() to reset the input method to the hardware |
242 // default method. | 242 // default method. |
243 const bool is_slave = g_browser_process->local_state()->GetBoolean( | 243 const bool is_slave = g_browser_process->local_state()->GetBoolean( |
244 prefs::kOobeControllerDetected); | 244 prefs::kOobeControllerDetected); |
245 | 245 |
246 const bool enable_layouts = | 246 const bool enable_layouts = |
247 !user_manager::UserManager::Get()->IsUserLoggedIn() && !is_slave; | 247 !user_manager::UserManager::Get()->IsUserLoggedIn() && !is_slave; |
248 | 248 |
249 dict->Set("languageList", std::move(language_list)); | 249 dict->Set("languageList", language_list.release()); |
250 dict->Set("inputMethodsList", | 250 dict->Set( |
251 GetAndActivateLoginKeyboardLayouts( | 251 "inputMethodsList", |
252 application_locale, selected_input_method, enable_layouts)); | 252 GetAndActivateLoginKeyboardLayouts( |
| 253 application_locale, selected_input_method, enable_layouts).release()); |
253 dict->Set("timezoneList", GetTimezoneList()); | 254 dict->Set("timezoneList", GetTimezoneList()); |
254 } | 255 } |
255 | 256 |
256 void NetworkScreenHandler::Initialize() { | 257 void NetworkScreenHandler::Initialize() { |
257 if (show_on_init_) { | 258 if (show_on_init_) { |
258 show_on_init_ = false; | 259 show_on_init_ = false; |
259 Show(); | 260 Show(); |
260 } | 261 } |
261 | 262 |
262 // Reload localized strings if they are already resolved. | 263 // Reload localized strings if they are already resolved. |
263 if (screen_ && screen_->language_list()) | 264 if (screen_ && screen_->language_list()) |
264 ReloadLocalizedContent(); | 265 ReloadLocalizedContent(); |
265 } | 266 } |
266 | 267 |
267 // NetworkScreenHandler, private: ---------------------------------------------- | 268 // NetworkScreenHandler, private: ---------------------------------------------- |
268 | 269 |
269 // static | 270 // static |
270 std::unique_ptr<base::ListValue> NetworkScreenHandler::GetTimezoneList() { | 271 base::ListValue* NetworkScreenHandler::GetTimezoneList() { |
271 std::string current_timezone_id; | 272 std::string current_timezone_id; |
272 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); | 273 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); |
273 | 274 |
274 std::unique_ptr<base::ListValue> timezone_list(new base::ListValue); | 275 std::unique_ptr<base::ListValue> timezone_list(new base::ListValue); |
275 std::unique_ptr<base::ListValue> timezones = system::GetTimezoneList(); | 276 std::unique_ptr<base::ListValue> timezones = system::GetTimezoneList(); |
276 for (size_t i = 0; i < timezones->GetSize(); ++i) { | 277 for (size_t i = 0; i < timezones->GetSize(); ++i) { |
277 const base::ListValue* timezone = NULL; | 278 const base::ListValue* timezone = NULL; |
278 CHECK(timezones->GetList(i, &timezone)); | 279 CHECK(timezones->GetList(i, &timezone)); |
279 | 280 |
280 std::string timezone_id; | 281 std::string timezone_id; |
281 CHECK(timezone->GetString(0, &timezone_id)); | 282 CHECK(timezone->GetString(0, &timezone_id)); |
282 | 283 |
283 std::string timezone_name; | 284 std::string timezone_name; |
284 CHECK(timezone->GetString(1, &timezone_name)); | 285 CHECK(timezone->GetString(1, &timezone_name)); |
285 | 286 |
286 std::unique_ptr<base::DictionaryValue> timezone_option( | 287 std::unique_ptr<base::DictionaryValue> timezone_option( |
287 new base::DictionaryValue); | 288 new base::DictionaryValue); |
288 timezone_option->SetString("value", timezone_id); | 289 timezone_option->SetString("value", timezone_id); |
289 timezone_option->SetString("title", timezone_name); | 290 timezone_option->SetString("title", timezone_name); |
290 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 291 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
291 timezone_list->Append(std::move(timezone_option)); | 292 timezone_list->Append(std::move(timezone_option)); |
292 } | 293 } |
293 | 294 |
294 return timezone_list; | 295 return timezone_list.release(); |
295 } | 296 } |
296 | 297 |
297 } // namespace chromeos | 298 } // namespace chromeos |
OLD | NEW |