| 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" |
| 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 12 #include "chrome/browser/chromeos/ui/inline_login_dialog.h" | 12 #include "chrome/browser/chromeos/ui/inline_login_dialog.h" |
| 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 14 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
| 15 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" | |
| 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 15 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 17 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
| 18 #include "components/user_manager/user.h" | 17 #include "components/user_manager/user.h" |
| 19 #include "google_apis/gaia/gaia_auth_util.h" | 18 #include "google_apis/gaia/gaia_auth_util.h" |
| 20 | 19 |
| 21 namespace chromeos { | 20 namespace chromeos { |
| 22 | 21 |
| 23 UserAccountsDelegateChromeOS::UserAccountsDelegateChromeOS( | 22 UserAccountsDelegateChromeOS::UserAccountsDelegateChromeOS( |
| 24 Profile* user_profile) | 23 Profile* user_profile) |
| 25 : user_profile_(user_profile) { | 24 : user_profile_(user_profile) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const user_manager::User* user = | 56 const user_manager::User* user = |
| 58 ProfileHelper::Get()->GetUserByProfile(user_profile_); | 57 ProfileHelper::Get()->GetUserByProfile(user_profile_); |
| 59 if (gaia::AreEmailsSame(user->email(), account_id) && | 58 if (gaia::AreEmailsSame(user->email(), account_id) && |
| 60 !user->display_email().empty()) | 59 !user->display_email().empty()) |
| 61 return user->display_email(); | 60 return user->display_email(); |
| 62 return account_id; | 61 return account_id; |
| 63 } | 62 } |
| 64 | 63 |
| 65 void UserAccountsDelegateChromeOS::DeleteAccount( | 64 void UserAccountsDelegateChromeOS::DeleteAccount( |
| 66 const std::string& account_id) { | 65 const std::string& account_id) { |
| 67 MutableProfileOAuth2TokenService* oauth2_token_service = | 66 ProfileOAuth2TokenService* oauth2_token_service = |
| 68 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( | 67 ProfileOAuth2TokenServiceFactory::GetForProfile(user_profile_); |
| 69 user_profile_); | |
| 70 oauth2_token_service->RevokeCredentials(account_id); | 68 oauth2_token_service->RevokeCredentials(account_id); |
| 71 } | 69 } |
| 72 | 70 |
| 73 void UserAccountsDelegateChromeOS::LaunchAddAccountDialog() { | 71 void UserAccountsDelegateChromeOS::LaunchAddAccountDialog() { |
| 74 ui::InlineLoginDialog::Show(user_profile_); | 72 ui::InlineLoginDialog::Show(user_profile_); |
| 75 } | 73 } |
| 76 | 74 |
| 77 void UserAccountsDelegateChromeOS::OnRefreshTokenAvailable( | 75 void UserAccountsDelegateChromeOS::OnRefreshTokenAvailable( |
| 78 const std::string& account_id) { | 76 const std::string& account_id) { |
| 79 NotifyAccountListChanged(); | 77 NotifyAccountListChanged(); |
| 80 } | 78 } |
| 81 | 79 |
| 82 void UserAccountsDelegateChromeOS::OnRefreshTokenRevoked( | 80 void UserAccountsDelegateChromeOS::OnRefreshTokenRevoked( |
| 83 const std::string& account_id) { | 81 const std::string& account_id) { |
| 84 NotifyAccountListChanged(); | 82 NotifyAccountListChanged(); |
| 85 } | 83 } |
| 86 | 84 |
| 87 } // namespace chromeos | 85 } // namespace chromeos |
| OLD | NEW |