| 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/invalidation/profile_invalidation_auth_provider.h" | 5 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 7 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 8 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 8 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 9 | 9 |
| 10 namespace invalidation { | 10 namespace invalidation { |
| 11 | 11 |
| 12 ProfileInvalidationAuthProvider::ProfileInvalidationAuthProvider( | 12 ProfileInvalidationAuthProvider::ProfileInvalidationAuthProvider( |
| 13 SigninManagerBase* signin_manager, | 13 SigninManagerBase* signin_manager, |
| 14 ProfileOAuth2TokenService* token_service, | 14 ProfileOAuth2TokenService* token_service, |
| 15 LoginUIService* login_ui_service) | 15 LoginUIService* login_ui_service) |
| 16 : signin_manager_(signin_manager), | 16 : signin_manager_(signin_manager), |
| 17 token_service_(token_service), | 17 token_service_(token_service), |
| 18 login_ui_service_(login_ui_service) { | 18 login_ui_service_(login_ui_service) { |
| 19 signin_manager_->AddObserver(this); | 19 signin_manager_->AddObserver(this); |
| 20 } | 20 } |
| 21 | 21 |
| 22 ProfileInvalidationAuthProvider::~ProfileInvalidationAuthProvider() { | 22 ProfileInvalidationAuthProvider::~ProfileInvalidationAuthProvider() { |
| 23 signin_manager_->RemoveObserver(this); | 23 signin_manager_->RemoveObserver(this); |
| 24 } | 24 } |
| 25 | 25 |
| 26 std::string ProfileInvalidationAuthProvider::GetUsername() { |
| 27 return signin_manager_->GetAuthenticatedUsername(); |
| 28 } |
| 29 |
| 26 std::string ProfileInvalidationAuthProvider::GetAccountId() { | 30 std::string ProfileInvalidationAuthProvider::GetAccountId() { |
| 27 return signin_manager_->GetAuthenticatedAccountId(); | 31 return signin_manager_->GetAuthenticatedAccountId(); |
| 28 } | 32 } |
| 29 | 33 |
| 30 OAuth2TokenService* ProfileInvalidationAuthProvider::GetTokenService() { | 34 OAuth2TokenService* ProfileInvalidationAuthProvider::GetTokenService() { |
| 31 return token_service_; | 35 return token_service_; |
| 32 } | 36 } |
| 33 | 37 |
| 34 bool ProfileInvalidationAuthProvider::ShowLoginUI() { | 38 bool ProfileInvalidationAuthProvider::ShowLoginUI() { |
| 35 login_ui_service_->ShowLoginPopup(); | 39 login_ui_service_->ShowLoginPopup(); |
| 36 return true; | 40 return true; |
| 37 } | 41 } |
| 38 | 42 |
| 43 void ProfileInvalidationAuthProvider::GoogleSigninSucceeded( |
| 44 const std::string& username, |
| 45 const std::string& password) { |
| 46 FireInvalidationAuthLogin(); |
| 47 } |
| 48 |
| 39 void ProfileInvalidationAuthProvider::GoogleSignedOut( | 49 void ProfileInvalidationAuthProvider::GoogleSignedOut( |
| 40 const std::string& username) { | 50 const std::string& username) { |
| 41 FireInvalidationAuthLogout(); | 51 FireInvalidationAuthLogout(); |
| 42 } | 52 } |
| 43 | 53 |
| 44 } // namespace invalidation | 54 } // namespace invalidation |
| OLD | NEW |