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

Side by Side Diff: chrome/browser/ui/webui/settings/languages_handler.cc

Issue 2471993002: Remove calls to User::email() from chrome/browser/ui/webui/* (Closed)
Patch Set: Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/settings/languages_handler.h" 5 #include "chrome/browser/ui/webui/settings/languages_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 #if defined(OS_WIN) 47 #if defined(OS_WIN)
48 PrefService* prefs = g_browser_process->local_state(); 48 PrefService* prefs = g_browser_process->local_state();
49 prefs->SetString(prefs::kApplicationLocale, language_code); 49 prefs->SetString(prefs::kApplicationLocale, language_code);
50 #elif defined(OS_CHROMEOS) 50 #elif defined(OS_CHROMEOS)
51 // Secondary users and public session users cannot change the locale. 51 // Secondary users and public session users cannot change the locale.
52 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 52 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
53 const user_manager::User* user = 53 const user_manager::User* user =
54 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); 54 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_);
55 if (user && 55 if (user &&
56 user->email() == user_manager->GetPrimaryUser()->email() && 56 user->GetAccountId() == user_manager->GetPrimaryUser()->GetAccountId() &&
57 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { 57 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
58 profile_->ChangeAppLocale(language_code, 58 profile_->ChangeAppLocale(language_code,
59 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); 59 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
60 } 60 }
61 #else 61 #else
62 NOTREACHED() << "Attempting to set locale on unsupported platform"; 62 NOTREACHED() << "Attempting to set locale on unsupported platform";
63 #endif 63 #endif
64 } 64 }
65 65
66 } // namespace settings 66 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698