| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 16 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 17 #include "chrome/browser/chromeos/base/locale_util.h" | 17 #include "chrome/browser/chromeos/base/locale_util.h" |
| 18 #include "chrome/browser/chromeos/customization_document.h" | 18 #include "chrome/browser/chromeos/customization_document.h" |
| 19 #include "chrome/browser/chromeos/idle_detector.h" | 19 #include "chrome/browser/chromeos/idle_detector.h" |
| 20 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 20 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 21 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 21 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
| 22 #include "chrome/browser/chromeos/system/input_device_settings.h" | 22 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 23 #include "chrome/browser/chromeos/system/timezone_util.h" | 23 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 24 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/grit/generated_resources.h" |
| 27 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
| 28 #include "chromeos/ime/extension_ime_util.h" | 29 #include "chromeos/ime/extension_ime_util.h" |
| 29 #include "chromeos/network/network_handler.h" | 30 #include "chromeos/network/network_handler.h" |
| 30 #include "chromeos/network/network_state_handler.h" | 31 #include "chromeos/network/network_state_handler.h" |
| 31 #include "grit/generated_resources.h" | |
| 32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 33 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
| 34 #include "ui/views/layout/fill_layout.h" | 34 #include "ui/views/layout/fill_layout.h" |
| 35 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const char kJsScreenPath[] = "login.NetworkScreen"; | 39 const char kJsScreenPath[] = "login.NetworkScreen"; |
| 40 | 40 |
| 41 // JS API callbacks names. | 41 // JS API callbacks names. |
| 42 const char kJsApiNetworkOnExit[] = "networkOnExit"; | 42 const char kJsApiNetworkOnExit[] = "networkOnExit"; |
| 43 const char kJsApiNetworkOnLanguageChanged[] = "networkOnLanguageChanged"; | 43 const char kJsApiNetworkOnLanguageChanged[] = "networkOnLanguageChanged"; |
| 44 const char kJsApiNetworkOnInputMethodChanged[] = "networkOnInputMethodChanged"; | 44 const char kJsApiNetworkOnInputMethodChanged[] = "networkOnInputMethodChanged"; |
| 45 const char kJsApiNetworkOnTimezoneChanged[] = "networkOnTimezoneChanged"; | 45 const char kJsApiNetworkOnTimezoneChanged[] = "networkOnTimezoneChanged"; |
| 46 | 46 |
| 47 // For "UI Language" drop-down menu at OOBE screen we need to decide which | 47 // For "UI Language" drop-down menu at OOBE screen we need to decide which |
| 48 // entry to mark "selected". If user has just selected "requested_locale", | 48 // entry to mark "selected". If user has just selected "requested_locale", |
| 49 // but "loaded_locale" was actually loaded, we mark original user choice | 49 // but "loaded_locale" was actually loaded, we mark original user choice |
| 50 // "selected" only if loaded_locale is a backup for "requested_locale". | 50 // "selected" only if loaded_locale is a backup for "requested_locale". |
| 51 std::string CalculateSelectedLanguage(const std::string& requested_locale, | 51 std::string CalculateSelectedLanguage(const std::string& requested_locale, |
| 52 const std::string& loaded_locale) { | 52 const std::string& loaded_locale) { |
| 53 | |
| 54 std::string resolved_locale; | 53 std::string resolved_locale; |
| 55 if (!l10n_util::CheckAndResolveLocale(requested_locale, &resolved_locale)) | 54 if (!l10n_util::CheckAndResolveLocale(requested_locale, &resolved_locale)) |
| 56 return loaded_locale; | 55 return loaded_locale; |
| 57 | 56 |
| 58 if (resolved_locale == loaded_locale) | 57 if (resolved_locale == loaded_locale) |
| 59 return requested_locale; | 58 return requested_locale; |
| 60 | 59 |
| 61 return loaded_locale; | 60 return loaded_locale; |
| 62 } | 61 } |
| 63 | 62 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 timezone_option->SetString("value", timezone_id); | 363 timezone_option->SetString("value", timezone_id); |
| 365 timezone_option->SetString("title", timezone_name); | 364 timezone_option->SetString("title", timezone_name); |
| 366 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 365 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
| 367 timezone_list->Append(timezone_option.release()); | 366 timezone_list->Append(timezone_option.release()); |
| 368 } | 367 } |
| 369 | 368 |
| 370 return timezone_list.release(); | 369 return timezone_list.release(); |
| 371 } | 370 } |
| 372 | 371 |
| 373 } // namespace chromeos | 372 } // namespace chromeos |
| OLD | NEW |