| 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/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 15 #include "chrome/browser/chromeos/base/locale_util.h" | 16 #include "chrome/browser/chromeos/base/locale_util.h" |
| 16 #include "chrome/browser/chromeos/customization_document.h" | 17 #include "chrome/browser/chromeos/customization_document.h" |
| 17 #include "chrome/browser/chromeos/idle_detector.h" | 18 #include "chrome/browser/chromeos/idle_detector.h" |
| 18 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 19 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 19 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 20 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
| 20 #include "chrome/browser/chromeos/system/input_device_settings.h" | 21 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 21 #include "chrome/browser/chromeos/system/timezone_util.h" | 22 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 23 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
| 27 #include "chromeos/chromeos_switches.h" |
| 26 #include "chromeos/ime/extension_ime_util.h" | 28 #include "chromeos/ime/extension_ime_util.h" |
| 27 #include "chromeos/network/network_handler.h" | 29 #include "chromeos/network/network_handler.h" |
| 28 #include "chromeos/network/network_state_handler.h" | 30 #include "chromeos/network/network_state_handler.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/gfx/rect.h" | 32 #include "ui/gfx/rect.h" |
| 31 #include "ui/views/layout/fill_layout.h" | 33 #include "ui/views/layout/fill_layout.h" |
| 32 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
| 33 | 35 |
| 34 namespace { | 36 namespace { |
| 35 | 37 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (selected_language_code_.empty()) { | 109 if (selected_language_code_.empty()) { |
| 108 const StartupCustomizationDocument* startup_manifest = | 110 const StartupCustomizationDocument* startup_manifest = |
| 109 StartupCustomizationDocument::GetInstance(); | 111 StartupCustomizationDocument::GetInstance(); |
| 110 SetApplicationLocale(startup_manifest->initial_locale_default()); | 112 SetApplicationLocale(startup_manifest->initial_locale_default()); |
| 111 } | 113 } |
| 112 | 114 |
| 113 PrefService* prefs = g_browser_process->local_state(); | 115 PrefService* prefs = g_browser_process->local_state(); |
| 114 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { | 116 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { |
| 115 if (core_oobe_actor_) | 117 if (core_oobe_actor_) |
| 116 core_oobe_actor_->ShowDeviceResetScreen(); | 118 core_oobe_actor_->ShowDeviceResetScreen(); |
| 119 |
| 120 return; |
| 121 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { |
| 122 if (core_oobe_actor_) |
| 123 core_oobe_actor_->ShowEnableDebuggingScreen(); |
| 124 |
| 117 return; | 125 return; |
| 118 } | 126 } |
| 119 | 127 |
| 120 // Make sure all our network technologies are turned on. On OOBE, the user | 128 // Make sure all our network technologies are turned on. On OOBE, the user |
| 121 // should be able to select any of the available networks on the device. | 129 // should be able to select any of the available networks on the device. |
| 122 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); | 130 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); |
| 123 handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), | 131 handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), |
| 124 true, | 132 true, |
| 125 chromeos::network_handler::ErrorCallback()); | 133 chromeos::network_handler::ErrorCallback()); |
| 126 ShowScreen(OobeUI::kScreenOobeNetwork, NULL); | 134 |
| 135 base::DictionaryValue network_screen_params; |
| 136 network_screen_params.SetBoolean("isDeveloperMode", |
| 137 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 138 chromeos::switches::kSystemDevMode)); |
| 139 ShowScreen(OobeUI::kScreenOobeNetwork, &network_screen_params); |
| 127 core_oobe_actor_->InitDemoModeDetection(); | 140 core_oobe_actor_->InitDemoModeDetection(); |
| 128 } | 141 } |
| 129 | 142 |
| 130 void NetworkScreenHandler::Hide() { | 143 void NetworkScreenHandler::Hide() { |
| 131 } | 144 } |
| 132 | 145 |
| 133 void NetworkScreenHandler::ShowError(const base::string16& message) { | 146 void NetworkScreenHandler::ShowError(const base::string16& message) { |
| 134 CallJS("showError", message); | 147 CallJS("showError", message); |
| 135 } | 148 } |
| 136 | 149 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 161 | 174 |
| 162 builder->Add("networkScreenTitle", IDS_WELCOME_SCREEN_TITLE); | 175 builder->Add("networkScreenTitle", IDS_WELCOME_SCREEN_TITLE); |
| 163 builder->Add("networkScreenAccessibleTitle", | 176 builder->Add("networkScreenAccessibleTitle", |
| 164 IDS_NETWORK_SCREEN_ACCESSIBLE_TITLE); | 177 IDS_NETWORK_SCREEN_ACCESSIBLE_TITLE); |
| 165 builder->Add("selectLanguage", IDS_LANGUAGE_SELECTION_SELECT); | 178 builder->Add("selectLanguage", IDS_LANGUAGE_SELECTION_SELECT); |
| 166 builder->Add("selectKeyboard", IDS_KEYBOARD_SELECTION_SELECT); | 179 builder->Add("selectKeyboard", IDS_KEYBOARD_SELECTION_SELECT); |
| 167 builder->Add("selectNetwork", IDS_NETWORK_SELECTION_SELECT); | 180 builder->Add("selectNetwork", IDS_NETWORK_SELECTION_SELECT); |
| 168 builder->Add("selectTimezone", IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION); | 181 builder->Add("selectTimezone", IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION); |
| 169 builder->Add("proxySettings", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON); | 182 builder->Add("proxySettings", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON); |
| 170 builder->Add("continueButton", IDS_NETWORK_SELECTION_CONTINUE_BUTTON); | 183 builder->Add("continueButton", IDS_NETWORK_SELECTION_CONTINUE_BUTTON); |
| 184 builder->Add("debuggingFeaturesLink", IDS_NETWORK_ENABLE_DEV_FEATURES_LINK); |
| 171 } | 185 } |
| 172 | 186 |
| 173 void NetworkScreenHandler::GetAdditionalParameters( | 187 void NetworkScreenHandler::GetAdditionalParameters( |
| 174 base::DictionaryValue* dict) { | 188 base::DictionaryValue* dict) { |
| 175 const std::string application_locale = | 189 const std::string application_locale = |
| 176 g_browser_process->GetApplicationLocale(); | 190 g_browser_process->GetApplicationLocale(); |
| 177 const std::string selected_language = selected_language_code_.empty() ? | 191 const std::string selected_language = selected_language_code_.empty() ? |
| 178 application_locale : selected_language_code_; | 192 application_locale : selected_language_code_; |
| 179 const std::string selected_input_method = | 193 const std::string selected_input_method = |
| 180 input_method::InputMethodManager::Get() | 194 input_method::InputMethodManager::Get() |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 timezone_option->SetString("value", timezone_id); | 378 timezone_option->SetString("value", timezone_id); |
| 365 timezone_option->SetString("title", timezone_name); | 379 timezone_option->SetString("title", timezone_name); |
| 366 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 380 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
| 367 timezone_list->Append(timezone_option.release()); | 381 timezone_list->Append(timezone_option.release()); |
| 368 } | 382 } |
| 369 | 383 |
| 370 return timezone_list.release(); | 384 return timezone_list.release(); |
| 371 } | 385 } |
| 372 | 386 |
| 373 } // namespace chromeos | 387 } // namespace chromeos |
| OLD | NEW |