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/options/chromeos/cros_language_options_handler
.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 base::string16 CrosLanguageOptionsHandler::GetProductName() { | 387 base::string16 CrosLanguageOptionsHandler::GetProductName() { |
388 return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME); | 388 return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME); |
389 } | 389 } |
390 | 390 |
391 void CrosLanguageOptionsHandler::SetApplicationLocale( | 391 void CrosLanguageOptionsHandler::SetApplicationLocale( |
392 const std::string& language_code) { | 392 const std::string& language_code) { |
393 Profile* profile = Profile::FromWebUI(web_ui()); | 393 Profile* profile = Profile::FromWebUI(web_ui()); |
394 UserManager* user_manager = UserManager::Get(); | 394 UserManager* user_manager = UserManager::Get(); |
395 | 395 |
396 // Only the primary user can change the locale. | 396 // Only the primary user can change the locale. |
397 if (user_manager->GetUserByProfile(profile)->email() == | 397 User* user = user_manager->GetUserByProfile(profile); |
398 user_manager->GetPrimaryUser()->email()) { | 398 if (user && user->email() == user_manager->GetPrimaryUser()->email()) { |
399 profile->ChangeAppLocale(language_code, | 399 profile->ChangeAppLocale(language_code, |
400 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 400 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { | 404 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { |
405 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 405 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
406 chrome::AttemptUserExit(); | 406 chrome::AttemptUserExit(); |
407 } | 407 } |
408 | 408 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 ConvertInputMethodDescriptosToIMEList( | 493 ConvertInputMethodDescriptosToIMEList( |
494 component_extension_manager->GetAllIMEAsInputMethodDescriptor())); | 494 component_extension_manager->GetAllIMEAsInputMethodDescriptor())); |
495 web_ui()->CallJavascriptFunction( | 495 web_ui()->CallJavascriptFunction( |
496 "options.LanguageOptions.onComponentManagerInitialized", | 496 "options.LanguageOptions.onComponentManagerInitialized", |
497 *ime_list); | 497 *ime_list); |
498 composition_extension_appended_ = true; | 498 composition_extension_appended_ = true; |
499 } | 499 } |
500 | 500 |
501 } // namespace options | 501 } // namespace options |
502 } // namespace chromeos | 502 } // namespace chromeos |
OLD | NEW |