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" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 builder->Add("continueButton", IDS_NETWORK_SELECTION_CONTINUE_BUTTON); | 186 builder->Add("continueButton", IDS_NETWORK_SELECTION_CONTINUE_BUTTON); |
187 } | 187 } |
188 | 188 |
189 void NetworkScreenHandler::GetAdditionalParameters( | 189 void NetworkScreenHandler::GetAdditionalParameters( |
190 base::DictionaryValue* dict) { | 190 base::DictionaryValue* dict) { |
191 const std::string application_locale = | 191 const std::string application_locale = |
192 g_browser_process->GetApplicationLocale(); | 192 g_browser_process->GetApplicationLocale(); |
193 const std::string selected_language = selected_language_code_.empty() ? | 193 const std::string selected_language = selected_language_code_.empty() ? |
194 application_locale : selected_language_code_; | 194 application_locale : selected_language_code_; |
195 const std::string selected_input_method = | 195 const std::string selected_input_method = |
196 input_method::InputMethodManager::Get()->GetCurrentInputMethod().id(); | 196 input_method::InputMethodManager::Get() |
| 197 ->GetActiveIMEState() |
| 198 ->GetCurrentInputMethod() |
| 199 .id(); |
197 | 200 |
198 dict->Set("languageList", | 201 dict->Set("languageList", |
199 GetUILanguageList(NULL, selected_language).release()); | 202 GetUILanguageList(NULL, selected_language).release()); |
200 dict->Set("inputMethodsList", | 203 dict->Set("inputMethodsList", |
201 GetLoginKeyboardLayouts(application_locale, | 204 GetAndActivateLoginKeyboardLayouts( |
202 selected_input_method).release()); | 205 application_locale, selected_input_method).release()); |
203 dict->Set("timezoneList", GetTimezoneList()); | 206 dict->Set("timezoneList", GetTimezoneList()); |
204 } | 207 } |
205 | 208 |
206 void NetworkScreenHandler::Initialize() { | 209 void NetworkScreenHandler::Initialize() { |
207 EnableContinue(is_continue_enabled_); | 210 EnableContinue(is_continue_enabled_); |
208 if (show_on_init_) { | 211 if (show_on_init_) { |
209 show_on_init_ = false; | 212 show_on_init_ = false; |
210 Show(); | 213 Show(); |
211 } | 214 } |
212 | 215 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 new locale_util::SwitchLanguageCallback( | 299 new locale_util::SwitchLanguageCallback( |
297 base::Bind(&NetworkScreenHandler::OnLanguageChangedCallback, | 300 base::Bind(&NetworkScreenHandler::OnLanguageChangedCallback, |
298 base::Passed(callback_data.Pass())))); | 301 base::Passed(callback_data.Pass())))); |
299 locale_util::SwitchLanguage(locale, | 302 locale_util::SwitchLanguage(locale, |
300 true /* enableLocaleKeyboardLayouts */, | 303 true /* enableLocaleKeyboardLayouts */, |
301 true /* login_layouts_only */, | 304 true /* login_layouts_only */, |
302 callback.Pass()); | 305 callback.Pass()); |
303 } | 306 } |
304 | 307 |
305 void NetworkScreenHandler::HandleOnInputMethodChanged(const std::string& id) { | 308 void NetworkScreenHandler::HandleOnInputMethodChanged(const std::string& id) { |
306 input_method::InputMethodManager::Get()->ChangeInputMethod(id); | 309 input_method::InputMethodManager::Get() |
| 310 ->GetActiveIMEState() |
| 311 ->ChangeInputMethod(id, false /* show_message */); |
307 } | 312 } |
308 | 313 |
309 void NetworkScreenHandler::HandleOnTimezoneChanged( | 314 void NetworkScreenHandler::HandleOnTimezoneChanged( |
310 const std::string& timezone_id) { | 315 const std::string& timezone_id) { |
311 std::string current_timezone_id; | 316 std::string current_timezone_id; |
312 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); | 317 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); |
313 if (current_timezone_id == timezone_id) | 318 if (current_timezone_id == timezone_id) |
314 return; | 319 return; |
315 | 320 |
316 CrosSettings::Get()->SetString(kSystemTimezone, timezone_id); | 321 CrosSettings::Get()->SetString(kSystemTimezone, timezone_id); |
317 } | 322 } |
318 | 323 |
319 void NetworkScreenHandler::OnSystemTimezoneChanged() { | 324 void NetworkScreenHandler::OnSystemTimezoneChanged() { |
320 std::string current_timezone_id; | 325 std::string current_timezone_id; |
321 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); | 326 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); |
322 CallJS("setTimezone", current_timezone_id); | 327 CallJS("setTimezone", current_timezone_id); |
323 } | 328 } |
324 | 329 |
325 void NetworkScreenHandler::InputMethodChanged( | 330 void NetworkScreenHandler::InputMethodChanged( |
326 input_method::InputMethodManager* manager, bool show_message) { | 331 input_method::InputMethodManager* manager, bool show_message) { |
327 CallJS("setInputMethod", manager->GetCurrentInputMethod().id()); | 332 CallJS("setInputMethod", |
| 333 manager->GetActiveIMEState()->GetCurrentInputMethod().id()); |
328 } | 334 } |
329 | 335 |
330 void NetworkScreenHandler::ReloadLocalizedContent() { | 336 void NetworkScreenHandler::ReloadLocalizedContent() { |
331 base::DictionaryValue localized_strings; | 337 base::DictionaryValue localized_strings; |
332 static_cast<OobeUI*>(web_ui()->GetController()) | 338 static_cast<OobeUI*>(web_ui()->GetController()) |
333 ->GetLocalizedStrings(&localized_strings); | 339 ->GetLocalizedStrings(&localized_strings); |
334 core_oobe_actor_->ReloadContent(localized_strings); | 340 core_oobe_actor_->ReloadContent(localized_strings); |
335 | 341 |
336 // Buttons are recreated, updated "Continue" button state. | 342 // Buttons are recreated, updated "Continue" button state. |
337 EnableContinue(is_continue_enabled_); | 343 EnableContinue(is_continue_enabled_); |
(...skipping 21 matching lines...) Expand all Loading... |
359 timezone_option->SetString("value", timezone_id); | 365 timezone_option->SetString("value", timezone_id); |
360 timezone_option->SetString("title", timezone_name); | 366 timezone_option->SetString("title", timezone_name); |
361 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 367 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
362 timezone_list->Append(timezone_option.release()); | 368 timezone_list->Append(timezone_option.release()); |
363 } | 369 } |
364 | 370 |
365 return timezone_list.release(); | 371 return timezone_list.release(); |
366 } | 372 } |
367 | 373 |
368 } // namespace chromeos | 374 } // namespace chromeos |
OLD | NEW |