| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 void CrosLanguageOptionsHandler::SetApplicationLocale( | 194 void CrosLanguageOptionsHandler::SetApplicationLocale( |
| 195 const std::string& language_code) { | 195 const std::string& language_code) { |
| 196 Profile* profile = Profile::FromWebUI(web_ui()); | 196 Profile* profile = Profile::FromWebUI(web_ui()); |
| 197 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 197 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 198 | 198 |
| 199 // Secondary users and public session users cannot change the locale. | 199 // Secondary users and public session users cannot change the locale. |
| 200 const user_manager::User* user = | 200 const user_manager::User* user = |
| 201 ProfileHelper::Get()->GetUserByProfile(profile); | 201 ProfileHelper::Get()->GetUserByProfile(profile); |
| 202 if (user && | 202 if (user && |
| 203 user->email() == user_manager->GetPrimaryUser()->email() && | 203 user->GetAccountId() == user_manager->GetPrimaryUser()->GetAccountId() && |
| 204 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 204 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 205 profile->ChangeAppLocale(language_code, | 205 profile->ChangeAppLocale(language_code, |
| 206 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 206 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { | 210 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { |
| 211 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 211 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
| 212 chrome::AttemptUserExit(); | 212 chrome::AttemptUserExit(); |
| 213 } | 213 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); | 269 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); |
| 270 const extensions::Extension* extension = | 270 const extensions::Extension* extension = |
| 271 enabled_extensions.GetByID(extension_id); | 271 enabled_extensions.GetByID(extension_id); |
| 272 if (extension) | 272 if (extension) |
| 273 entry->SetString("extensionName", extension->name()); | 273 entry->SetString("extensionName", extension->name()); |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace options | 277 } // namespace options |
| 278 } // namespace chromeos | 278 } // namespace chromeos |
| OLD | NEW |