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* user = ProfileHelper::Get()->GetUserByProfile(user_profile_); | 57 user_manager::User* user = |
| 58 ProfileHelper::Get()->GetUserByProfile(user_profile_); |
58 if (gaia::AreEmailsSame(user->email(), account_id) && | 59 if (gaia::AreEmailsSame(user->email(), account_id) && |
59 !user->display_email().empty()) | 60 !user->display_email().empty()) |
60 return user->display_email(); | 61 return user->display_email(); |
61 return account_id; | 62 return account_id; |
62 } | 63 } |
63 | 64 |
64 void UserAccountsDelegateChromeOS::DeleteAccount( | 65 void UserAccountsDelegateChromeOS::DeleteAccount( |
65 const std::string& account_id) { | 66 const std::string& account_id) { |
66 MutableProfileOAuth2TokenService* oauth2_token_service = | 67 MutableProfileOAuth2TokenService* oauth2_token_service = |
67 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( | 68 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( |
68 user_profile_); | 69 user_profile_); |
69 oauth2_token_service->RevokeCredentials(account_id); | 70 oauth2_token_service->RevokeCredentials(account_id); |
70 } | 71 } |
71 | 72 |
72 void UserAccountsDelegateChromeOS::LaunchAddAccountDialog() { | 73 void UserAccountsDelegateChromeOS::LaunchAddAccountDialog() { |
73 ui::InlineLoginDialog::Show(user_profile_); | 74 ui::InlineLoginDialog::Show(user_profile_); |
74 } | 75 } |
75 | 76 |
76 void UserAccountsDelegateChromeOS::OnRefreshTokenAvailable( | 77 void UserAccountsDelegateChromeOS::OnRefreshTokenAvailable( |
77 const std::string& account_id) { | 78 const std::string& account_id) { |
78 NotifyAccountListChanged(); | 79 NotifyAccountListChanged(); |
79 } | 80 } |
80 | 81 |
81 void UserAccountsDelegateChromeOS::OnRefreshTokenRevoked( | 82 void UserAccountsDelegateChromeOS::OnRefreshTokenRevoked( |
82 const std::string& account_id) { | 83 const std::string& account_id) { |
83 NotifyAccountListChanged(); | 84 NotifyAccountListChanged(); |
84 } | 85 } |
85 | 86 |
86 } // namespace chromeos | 87 } // namespace chromeos |
OLD | NEW |