| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/login/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 User::OAuthTokenStatus result = | 628 User::OAuthTokenStatus result = |
| 629 static_cast<User::OAuthTokenStatus>(oauth_token_status); | 629 static_cast<User::OAuthTokenStatus>(oauth_token_status); |
| 630 if (result == User::OAUTH2_TOKEN_STATUS_INVALID) | 630 if (result == User::OAUTH2_TOKEN_STATUS_INVALID) |
| 631 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(result); | 631 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(result); |
| 632 return result; | 632 return result; |
| 633 } | 633 } |
| 634 return User::OAUTH_TOKEN_STATUS_UNKNOWN; | 634 return User::OAUTH_TOKEN_STATUS_UNKNOWN; |
| 635 } | 635 } |
| 636 | 636 |
| 637 void UserManagerImpl::SaveUserDisplayName(const std::string& user_id, | 637 void UserManagerImpl::SaveUserDisplayName(const std::string& user_id, |
| 638 const string16& display_name) { | 638 const base::string16& display_name) { |
| 639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 640 | 640 |
| 641 if (User* user = FindUserAndModify(user_id)) { | 641 if (User* user = FindUserAndModify(user_id)) { |
| 642 user->set_display_name(display_name); | 642 user->set_display_name(display_name); |
| 643 | 643 |
| 644 // Do not update local store if data stored or cached outside the user's | 644 // Do not update local store if data stored or cached outside the user's |
| 645 // cryptohome is to be treated as ephemeral. | 645 // cryptohome is to be treated as ephemeral. |
| 646 if (!IsUserNonCryptohomeDataEphemeral(user_id)) { | 646 if (!IsUserNonCryptohomeDataEphemeral(user_id)) { |
| 647 PrefService* local_state = g_browser_process->local_state(); | 647 PrefService* local_state = g_browser_process->local_state(); |
| 648 | 648 |
| 649 DictionaryPrefUpdate display_name_update(local_state, kUserDisplayName); | 649 DictionaryPrefUpdate display_name_update(local_state, kUserDisplayName); |
| 650 display_name_update->SetWithoutPathExpansion( | 650 display_name_update->SetWithoutPathExpansion( |
| 651 user_id, | 651 user_id, |
| 652 new base::StringValue(display_name)); | 652 new base::StringValue(display_name)); |
| 653 | 653 |
| 654 supervised_user_manager_->UpdateManagerName(user_id, display_name); | 654 supervised_user_manager_->UpdateManagerName(user_id, display_name); |
| 655 } | 655 } |
| 656 } | 656 } |
| 657 } | 657 } |
| 658 | 658 |
| 659 string16 UserManagerImpl::GetUserDisplayName( | 659 string16 UserManagerImpl::GetUserDisplayName( |
| 660 const std::string& user_id) const { | 660 const std::string& user_id) const { |
| 661 const User* user = FindUser(user_id); | 661 const User* user = FindUser(user_id); |
| 662 return user ? user->display_name() : string16(); | 662 return user ? user->display_name() : base::string16(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void UserManagerImpl::SaveUserDisplayEmail(const std::string& user_id, | 665 void UserManagerImpl::SaveUserDisplayEmail(const std::string& user_id, |
| 666 const std::string& display_email) { | 666 const std::string& display_email) { |
| 667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 668 | 668 |
| 669 User* user = FindUserAndModify(user_id); | 669 User* user = FindUserAndModify(user_id); |
| 670 if (!user) | 670 if (!user) |
| 671 return; // Ignore if there is no such user. | 671 return; // Ignore if there is no such user. |
| 672 | 672 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 692 } | 692 } |
| 693 | 693 |
| 694 void UserManagerImpl::UpdateUserAccountData( | 694 void UserManagerImpl::UpdateUserAccountData( |
| 695 const std::string& user_id, | 695 const std::string& user_id, |
| 696 const UserAccountData& account_data) { | 696 const UserAccountData& account_data) { |
| 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 698 | 698 |
| 699 SaveUserDisplayName(user_id, account_data.display_name()); | 699 SaveUserDisplayName(user_id, account_data.display_name()); |
| 700 | 700 |
| 701 if (User* user = FindUserAndModify(user_id)) { | 701 if (User* user = FindUserAndModify(user_id)) { |
| 702 string16 given_name = account_data.given_name(); | 702 base::string16 given_name = account_data.given_name(); |
| 703 user->set_given_name(given_name); | 703 user->set_given_name(given_name); |
| 704 if (!IsUserNonCryptohomeDataEphemeral(user_id)) { | 704 if (!IsUserNonCryptohomeDataEphemeral(user_id)) { |
| 705 PrefService* local_state = g_browser_process->local_state(); | 705 PrefService* local_state = g_browser_process->local_state(); |
| 706 | 706 |
| 707 DictionaryPrefUpdate given_name_update(local_state, kUserGivenName); | 707 DictionaryPrefUpdate given_name_update(local_state, kUserGivenName); |
| 708 given_name_update->SetWithoutPathExpansion( | 708 given_name_update->SetWithoutPathExpansion( |
| 709 user_id, | 709 user_id, |
| 710 new base::StringValue(given_name)); | 710 new base::StringValue(given_name)); |
| 711 } | 711 } |
| 712 } | 712 } |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 it != regular_users.end(); ++it) { | 1039 it != regular_users.end(); ++it) { |
| 1040 User* user = NULL; | 1040 User* user = NULL; |
| 1041 const std::string domain = gaia::ExtractDomainName(*it); | 1041 const std::string domain = gaia::ExtractDomainName(*it); |
| 1042 if (domain == UserManager::kLocallyManagedUserDomain) | 1042 if (domain == UserManager::kLocallyManagedUserDomain) |
| 1043 user = User::CreateLocallyManagedUser(*it); | 1043 user = User::CreateLocallyManagedUser(*it); |
| 1044 else | 1044 else |
| 1045 user = User::CreateRegularUser(*it); | 1045 user = User::CreateRegularUser(*it); |
| 1046 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); | 1046 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); |
| 1047 users_.push_back(user); | 1047 users_.push_back(user); |
| 1048 | 1048 |
| 1049 string16 display_name; | 1049 base::string16 display_name; |
| 1050 if (prefs_display_names->GetStringWithoutPathExpansion(*it, | 1050 if (prefs_display_names->GetStringWithoutPathExpansion(*it, |
| 1051 &display_name)) { | 1051 &display_name)) { |
| 1052 user->set_display_name(display_name); | 1052 user->set_display_name(display_name); |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 string16 given_name; | 1055 base::string16 given_name; |
| 1056 if (prefs_given_names->GetStringWithoutPathExpansion(*it, &given_name)) { | 1056 if (prefs_given_names->GetStringWithoutPathExpansion(*it, &given_name)) { |
| 1057 user->set_given_name(given_name); | 1057 user->set_given_name(given_name); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 std::string display_email; | 1060 std::string display_email; |
| 1061 if (prefs_display_emails->GetStringWithoutPathExpansion(*it, | 1061 if (prefs_display_emails->GetStringWithoutPathExpansion(*it, |
| 1062 &display_email)) { | 1062 &display_email)) { |
| 1063 user->set_display_email(display_email); | 1063 user->set_display_email(display_email); |
| 1064 } | 1064 } |
| 1065 } | 1065 } |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 | 1822 |
| 1823 void UserManagerImpl::DoUpdateAccountLocale( | 1823 void UserManagerImpl::DoUpdateAccountLocale( |
| 1824 const std::string& user_id, | 1824 const std::string& user_id, |
| 1825 const std::string& resolved_locale) { | 1825 const std::string& resolved_locale) { |
| 1826 if (User* user = FindUserAndModify(user_id)) | 1826 if (User* user = FindUserAndModify(user_id)) |
| 1827 user->SetAccountLocale(resolved_locale); | 1827 user->SetAccountLocale(resolved_locale); |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 | 1830 |
| 1831 } // namespace chromeos | 1831 } // namespace chromeos |
| OLD | NEW |