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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 base::string16 CrosLanguageOptionsHandler::GetProductName() { | 180 base::string16 CrosLanguageOptionsHandler::GetProductName() { |
181 return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME); | 181 return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME); |
182 } | 182 } |
183 | 183 |
184 void CrosLanguageOptionsHandler::SetApplicationLocale( | 184 void CrosLanguageOptionsHandler::SetApplicationLocale( |
185 const std::string& language_code) { | 185 const std::string& language_code) { |
186 Profile* profile = Profile::FromWebUI(web_ui()); | 186 Profile* profile = Profile::FromWebUI(web_ui()); |
187 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 187 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
188 | 188 |
189 // Secondary users and public session users cannot change the locale. | 189 // Secondary users and public session users cannot change the locale. |
190 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); | 190 const user_manager::User* user = |
| 191 ProfileHelper::Get()->GetUserByProfile(profile); |
191 if (user && | 192 if (user && |
192 user->email() == user_manager->GetPrimaryUser()->email() && | 193 user->email() == user_manager->GetPrimaryUser()->email() && |
193 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 194 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
194 profile->ChangeAppLocale(language_code, | 195 profile->ChangeAppLocale(language_code, |
195 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 196 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
196 } | 197 } |
197 } | 198 } |
198 | 199 |
199 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { | 200 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { |
200 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 201 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); | 261 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); |
261 const extensions::Extension* extension = | 262 const extensions::Extension* extension = |
262 enabled_extensions.GetByID(extension_id); | 263 enabled_extensions.GetByID(extension_id); |
263 if (extension) | 264 if (extension) |
264 entry->SetString("extensionName", extension->name()); | 265 entry->SetString("extensionName", extension->name()); |
265 } | 266 } |
266 } | 267 } |
267 | 268 |
268 } // namespace options | 269 } // namespace options |
269 } // namespace chromeos | 270 } // namespace chromeos |
OLD | NEW |