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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // We still do not have device owner, so owner settings are not applied. | 264 // We still do not have device owner, so owner settings are not applied. |
265 // But Guest session can be started before owner is created, so we need to | 265 // But Guest session can be started before owner is created, so we need to |
266 // save locale settings directly here. | 266 // save locale settings directly here. |
267 g_browser_process->local_state()->SetString(prefs::kApplicationLocale, | 267 g_browser_process->local_state()->SetString(prefs::kApplicationLocale, |
268 self->selected_language_code_); | 268 self->selected_language_code_); |
269 | 269 |
270 AccessibilityManager::Get()->OnLocaleChanged(); | 270 AccessibilityManager::Get()->OnLocaleChanged(); |
271 } | 271 } |
272 | 272 |
273 void NetworkScreenHandler::HandleOnLanguageChanged(const std::string& locale) { | 273 void NetworkScreenHandler::HandleOnLanguageChanged(const std::string& locale) { |
| 274 #if !defined(USE_ATHENA) |
274 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 275 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
275 if (app_locale == locale) | 276 if (app_locale == locale) |
276 return; | 277 return; |
277 | 278 |
278 base::WeakPtr<NetworkScreenHandler> weak_self = | 279 base::WeakPtr<NetworkScreenHandler> weak_self = |
279 weak_ptr_factory_.GetWeakPtr(); | 280 weak_ptr_factory_.GetWeakPtr(); |
280 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> callback_data( | 281 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> callback_data( |
281 new NetworkScreenHandlerOnLanguageChangedCallbackData(weak_self)); | 282 new NetworkScreenHandlerOnLanguageChangedCallbackData(weak_self)); |
282 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 283 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
283 new locale_util::SwitchLanguageCallback( | 284 new locale_util::SwitchLanguageCallback( |
284 base::Bind(&NetworkScreenHandler::OnLanguageChangedCallback, | 285 base::Bind(&NetworkScreenHandler::OnLanguageChangedCallback, |
285 base::Passed(callback_data.Pass())))); | 286 base::Passed(callback_data.Pass())))); |
286 locale_util::SwitchLanguage(locale, | 287 locale_util::SwitchLanguage(locale, |
287 true /* enableLocaleKeyboardLayouts */, | 288 true /* enableLocaleKeyboardLayouts */, |
288 true /* login_layouts_only */, | 289 true /* login_layouts_only */, |
289 callback.Pass()); | 290 callback.Pass()); |
| 291 #endif |
290 } | 292 } |
291 | 293 |
292 void NetworkScreenHandler::HandleOnInputMethodChanged(const std::string& id) { | 294 void NetworkScreenHandler::HandleOnInputMethodChanged(const std::string& id) { |
293 input_method::InputMethodManager::Get() | 295 input_method::InputMethodManager::Get() |
294 ->GetActiveIMEState() | 296 ->GetActiveIMEState() |
295 ->ChangeInputMethod(id, false /* show_message */); | 297 ->ChangeInputMethod(id, false /* show_message */); |
296 } | 298 } |
297 | 299 |
298 void NetworkScreenHandler::HandleOnTimezoneChanged( | 300 void NetworkScreenHandler::HandleOnTimezoneChanged( |
299 const std::string& timezone_id) { | 301 const std::string& timezone_id) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 timezone_option->SetString("value", timezone_id); | 351 timezone_option->SetString("value", timezone_id); |
350 timezone_option->SetString("title", timezone_name); | 352 timezone_option->SetString("title", timezone_name); |
351 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 353 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
352 timezone_list->Append(timezone_option.release()); | 354 timezone_list->Append(timezone_option.release()); |
353 } | 355 } |
354 | 356 |
355 return timezone_list.release(); | 357 return timezone_list.release(); |
356 } | 358 } |
357 | 359 |
358 } // namespace chromeos | 360 } // namespace chromeos |
OLD | NEW |