| 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/string16.h" | 12 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
| 14 #include "base/threading/worker_pool.h" | 15 #include "base/threading/worker_pool.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 18 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 18 #include "chrome/browser/chromeos/base/locale_util.h" | 19 #include "chrome/browser/chromeos/base/locale_util.h" |
| 19 #include "chrome/browser/chromeos/customization_document.h" | 20 #include "chrome/browser/chromeos/customization_document.h" |
| 20 #include "chrome/browser/chromeos/idle_detector.h" | 21 #include "chrome/browser/chromeos/idle_detector.h" |
| 21 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 22 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 22 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 23 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
| 23 #include "chrome/browser/chromeos/system/input_device_settings.h" | 24 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 24 #include "chrome/browser/chromeos/system/timezone_util.h" | 25 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 26 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 27 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 30 #include "chromeos/chromeos_switches.h" |
| 29 #include "chromeos/ime/extension_ime_util.h" | 31 #include "chromeos/ime/extension_ime_util.h" |
| 30 #include "chromeos/network/network_handler.h" | 32 #include "chromeos/network/network_handler.h" |
| 31 #include "chromeos/network/network_state_handler.h" | 33 #include "chromeos/network/network_state_handler.h" |
| 32 #include "components/user_manager/user_manager.h" | 34 #include "components/user_manager/user_manager.h" |
| 33 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/gfx/rect.h" | 37 #include "ui/gfx/rect.h" |
| 36 #include "ui/views/layout/fill_layout.h" | 38 #include "ui/views/layout/fill_layout.h" |
| 37 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 38 | 40 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (selected_language_code_.empty()) { | 98 if (selected_language_code_.empty()) { |
| 97 const StartupCustomizationDocument* startup_manifest = | 99 const StartupCustomizationDocument* startup_manifest = |
| 98 StartupCustomizationDocument::GetInstance(); | 100 StartupCustomizationDocument::GetInstance(); |
| 99 SetApplicationLocale(startup_manifest->initial_locale_default()); | 101 SetApplicationLocale(startup_manifest->initial_locale_default()); |
| 100 } | 102 } |
| 101 | 103 |
| 102 PrefService* prefs = g_browser_process->local_state(); | 104 PrefService* prefs = g_browser_process->local_state(); |
| 103 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { | 105 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { |
| 104 if (core_oobe_actor_) | 106 if (core_oobe_actor_) |
| 105 core_oobe_actor_->ShowDeviceResetScreen(); | 107 core_oobe_actor_->ShowDeviceResetScreen(); |
| 108 |
| 109 return; |
| 110 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { |
| 111 if (core_oobe_actor_) |
| 112 core_oobe_actor_->ShowEnableDebuggingScreen(); |
| 113 |
| 106 return; | 114 return; |
| 107 } | 115 } |
| 108 | 116 |
| 109 // Make sure all our network technologies are turned on. On OOBE, the user | 117 // Make sure all our network technologies are turned on. On OOBE, the user |
| 110 // should be able to select any of the available networks on the device. | 118 // should be able to select any of the available networks on the device. |
| 111 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); | 119 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); |
| 112 handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), | 120 handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), |
| 113 true, | 121 true, |
| 114 chromeos::network_handler::ErrorCallback()); | 122 chromeos::network_handler::ErrorCallback()); |
| 115 ShowScreen(OobeUI::kScreenOobeNetwork, NULL); | 123 |
| 124 base::DictionaryValue network_screen_params; |
| 125 network_screen_params.SetBoolean("isDeveloperMode", |
| 126 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 127 chromeos::switches::kSystemDevMode)); |
| 128 ShowScreen(OobeUI::kScreenOobeNetwork, &network_screen_params); |
| 116 core_oobe_actor_->InitDemoModeDetection(); | 129 core_oobe_actor_->InitDemoModeDetection(); |
| 117 } | 130 } |
| 118 | 131 |
| 119 void NetworkScreenHandler::Hide() { | 132 void NetworkScreenHandler::Hide() { |
| 120 } | 133 } |
| 121 | 134 |
| 122 void NetworkScreenHandler::ShowError(const base::string16& message) { | 135 void NetworkScreenHandler::ShowError(const base::string16& message) { |
| 123 CallJS("showError", message); | 136 CallJS("showError", message); |
| 124 } | 137 } |
| 125 | 138 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 150 | 163 |
| 151 builder->Add("networkScreenTitle", IDS_WELCOME_SCREEN_TITLE); | 164 builder->Add("networkScreenTitle", IDS_WELCOME_SCREEN_TITLE); |
| 152 builder->Add("networkScreenAccessibleTitle", | 165 builder->Add("networkScreenAccessibleTitle", |
| 153 IDS_NETWORK_SCREEN_ACCESSIBLE_TITLE); | 166 IDS_NETWORK_SCREEN_ACCESSIBLE_TITLE); |
| 154 builder->Add("selectLanguage", IDS_LANGUAGE_SELECTION_SELECT); | 167 builder->Add("selectLanguage", IDS_LANGUAGE_SELECTION_SELECT); |
| 155 builder->Add("selectKeyboard", IDS_KEYBOARD_SELECTION_SELECT); | 168 builder->Add("selectKeyboard", IDS_KEYBOARD_SELECTION_SELECT); |
| 156 builder->Add("selectNetwork", IDS_NETWORK_SELECTION_SELECT); | 169 builder->Add("selectNetwork", IDS_NETWORK_SELECTION_SELECT); |
| 157 builder->Add("selectTimezone", IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION); | 170 builder->Add("selectTimezone", IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION); |
| 158 builder->Add("proxySettings", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON); | 171 builder->Add("proxySettings", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON); |
| 159 builder->Add("continueButton", IDS_NETWORK_SELECTION_CONTINUE_BUTTON); | 172 builder->Add("continueButton", IDS_NETWORK_SELECTION_CONTINUE_BUTTON); |
| 173 builder->Add("debuggingFeaturesLink", IDS_NETWORK_ENABLE_DEV_FEATURES_LINK); |
| 160 } | 174 } |
| 161 | 175 |
| 162 void NetworkScreenHandler::OnLanguageListResolved( | 176 void NetworkScreenHandler::OnLanguageListResolved( |
| 163 scoped_ptr<base::ListValue> new_language_list, | 177 scoped_ptr<base::ListValue> new_language_list, |
| 164 std::string new_language_list_locale, | 178 std::string new_language_list_locale, |
| 165 std::string new_selected_language) { | 179 std::string new_selected_language) { |
| 166 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 167 | 181 |
| 168 language_list_.reset(new_language_list.release()); | 182 language_list_.reset(new_language_list.release()); |
| 169 language_list_locale_ = new_language_list_locale; | 183 language_list_locale_ = new_language_list_locale; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 timezone_option->SetString("value", timezone_id); | 396 timezone_option->SetString("value", timezone_id); |
| 383 timezone_option->SetString("title", timezone_name); | 397 timezone_option->SetString("title", timezone_name); |
| 384 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 398 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
| 385 timezone_list->Append(timezone_option.release()); | 399 timezone_list->Append(timezone_option.release()); |
| 386 } | 400 } |
| 387 | 401 |
| 388 return timezone_list.release(); | 402 return timezone_list.release(); |
| 389 } | 403 } |
| 390 | 404 |
| 391 } // namespace chromeos | 405 } // namespace chromeos |
| OLD | NEW |