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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/base/locale_util.h" | 14 #include "chrome/browser/chromeos/base/locale_util.h" |
15 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 15 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
16 #include "chrome/browser/chromeos/login/input_events_blocker.h" | 16 #include "chrome/browser/chromeos/login/input_events_blocker.h" |
17 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 17 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
18 #include "chrome/browser/chromeos/system/input_device_settings.h" | 18 #include "chrome/browser/chromeos/system/input_device_settings.h" |
19 #include "chrome/browser/chromeos/system/timezone_util.h" | 19 #include "chrome/browser/chromeos/system/timezone_util.h" |
20 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 20 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
21 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h" | 21 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h" |
22 #include "chromeos/ime/input_method_manager.h" | 22 #include "chromeos/ime/input_method_manager.h" |
23 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "ui/base/l10n/l10n_util.h" | |
25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
26 #include "ui/views/layout/fill_layout.h" | 27 #include "ui/views/layout/fill_layout.h" |
27 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 const char kJsScreenPath[] = "login.NetworkScreen"; | 32 const char kJsScreenPath[] = "login.NetworkScreen"; |
32 | 33 |
33 // JS API callbacks names. | 34 // JS API callbacks names. |
34 const char kJsApiNetworkOnExit[] = "networkOnExit"; | 35 const char kJsApiNetworkOnExit[] = "networkOnExit"; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 if (!languages_list->GetDictionary(i, &language_info)) | 247 if (!languages_list->GetDictionary(i, &language_info)) |
247 NOTREACHED(); | 248 NOTREACHED(); |
248 | 249 |
249 std::string value; | 250 std::string value; |
250 language_info->GetString("code", &value); | 251 language_info->GetString("code", &value); |
251 std::string display_name; | 252 std::string display_name; |
252 language_info->GetString("displayName", &display_name); | 253 language_info->GetString("displayName", &display_name); |
253 std::string native_name; | 254 std::string native_name; |
254 language_info->GetString("nativeDisplayName", &native_name); | 255 language_info->GetString("nativeDisplayName", &native_name); |
255 | 256 |
256 if (display_name != native_name) | 257 // If it's option group divider, add field name. |
258 if (value.empty()) { | |
Nikita (slow)
2014/01/30 13:23:28
nit: Check for a specific constant instead.
Alexander Alekseev
2014/01/31 12:46:54
Done.
| |
259 language_info->SetString( | |
260 "optionGroupName", | |
261 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_LANGUAGES)); | |
262 } | |
263 if (display_name != native_name) { | |
257 display_name = base::StringPrintf("%s - %s", | 264 display_name = base::StringPrintf("%s - %s", |
258 display_name.c_str(), | 265 display_name.c_str(), |
259 native_name.c_str()); | 266 native_name.c_str()); |
267 } | |
260 | 268 |
261 language_info->SetString("value", value); | 269 language_info->SetString("value", value); |
262 language_info->SetString("title", display_name); | 270 language_info->SetString("title", display_name); |
263 language_info->SetBoolean("selected", value == app_locale); | 271 language_info->SetBoolean("selected", value == app_locale); |
264 } | 272 } |
265 return languages_list; | 273 return languages_list; |
266 } | 274 } |
267 | 275 |
268 // static | 276 // static |
269 base::ListValue* NetworkScreenHandler::GetInputMethods() { | 277 base::ListValue* NetworkScreenHandler::GetInputMethods() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 timezone_option->SetString("value", timezone_id); | 318 timezone_option->SetString("value", timezone_id); |
311 timezone_option->SetString("title", timezone_name); | 319 timezone_option->SetString("title", timezone_name); |
312 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 320 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
313 timezone_list->Append(timezone_option.release()); | 321 timezone_list->Append(timezone_option.release()); |
314 } | 322 } |
315 | 323 |
316 return timezone_list.release(); | 324 return timezone_list.release(); |
317 } | 325 } |
318 | 326 |
319 } // namespace chromeos | 327 } // namespace chromeos |
OLD | NEW |