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

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

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const user_manager::User* user = 190 const user_manager::User* user =
191 ProfileHelper::Get()->GetUserByProfile(profile); 191 ProfileHelper::Get()->GetUserByProfile(profile);
192 if (user && 192 if (user &&
193 user->email() == user_manager->GetPrimaryUser()->email() && 193 user->GetUserID() == user_manager->GetPrimaryUser()->GetUserID() &&
194 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { 194 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
195 profile->ChangeAppLocale(language_code, 195 profile->ChangeAppLocale(language_code,
196 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); 196 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
197 } 197 }
198 } 198 }
199 199
200 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { 200 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) {
201 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); 201 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut"));
202 chrome::AttemptUserExit(); 202 chrome::AttemptUserExit();
203 } 203 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); 261 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id);
262 const extensions::Extension* extension = 262 const extensions::Extension* extension =
263 enabled_extensions.GetByID(extension_id); 263 enabled_extensions.GetByID(extension_id);
264 if (extension) 264 if (extension)
265 entry->SetString("extensionName", extension->name()); 265 entry->SetString("extensionName", extension->name());
266 } 266 }
267 } 267 }
268 268
269 } // namespace options 269 } // namespace options
270 } // namespace chromeos 270 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698