Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 898003002: [Cleanup] Const-correct the profile() method for the EasyUnlockService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698