OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ash/user_accounts_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/user_accounts_delegate_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 std::remove(accounts.begin(), accounts.end(), GetPrimaryAccountId()); | 47 std::remove(accounts.begin(), accounts.end(), GetPrimaryAccountId()); |
48 LOG_IF(WARNING, std::distance(it, accounts.end()) != 1) | 48 LOG_IF(WARNING, std::distance(it, accounts.end()) != 1) |
49 << "Found " << std::distance(it, accounts.end()) | 49 << "Found " << std::distance(it, accounts.end()) |
50 << " primary accounts in the account list."; | 50 << " primary accounts in the account list."; |
51 accounts.erase(it, accounts.end()); | 51 accounts.erase(it, accounts.end()); |
52 return accounts; | 52 return accounts; |
53 } | 53 } |
54 | 54 |
55 std::string UserAccountsDelegateChromeOS::GetAccountDisplayName( | 55 std::string UserAccountsDelegateChromeOS::GetAccountDisplayName( |
56 const std::string& account_id) { | 56 const std::string& account_id) { |
57 user_manager::User* user = | 57 const user_manager::User* user = |
58 ProfileHelper::Get()->GetUserByProfile(user_profile_); | 58 ProfileHelper::Get()->GetUserByProfile(user_profile_); |
59 if (gaia::AreEmailsSame(user->email(), account_id) && | 59 if (gaia::AreEmailsSame(user->email(), account_id) && |
60 !user->display_email().empty()) | 60 !user->display_email().empty()) |
61 return user->display_email(); | 61 return user->display_email(); |
62 return account_id; | 62 return account_id; |
63 } | 63 } |
64 | 64 |
65 void UserAccountsDelegateChromeOS::DeleteAccount( | 65 void UserAccountsDelegateChromeOS::DeleteAccount( |
66 const std::string& account_id) { | 66 const std::string& account_id) { |
67 MutableProfileOAuth2TokenService* oauth2_token_service = | 67 MutableProfileOAuth2TokenService* oauth2_token_service = |
(...skipping 10 matching lines...) Expand all Loading... |
78 const std::string& account_id) { | 78 const std::string& account_id) { |
79 NotifyAccountListChanged(); | 79 NotifyAccountListChanged(); |
80 } | 80 } |
81 | 81 |
82 void UserAccountsDelegateChromeOS::OnRefreshTokenRevoked( | 82 void UserAccountsDelegateChromeOS::OnRefreshTokenRevoked( |
83 const std::string& account_id) { | 83 const std::string& account_id) { |
84 NotifyAccountListChanged(); | 84 NotifyAccountListChanged(); |
85 } | 85 } |
86 | 86 |
87 } // namespace chromeos | 87 } // namespace chromeos |
OLD | NEW |