OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h" |
| 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 10 #include "chrome/browser/signin/signin_manager_base.h" |
| 11 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 12 #include "content/public/browser/notification_service.h" |
| 13 |
| 14 namespace invalidation { |
| 15 |
| 16 ProfileInvalidationAuthProvider::ProfileInvalidationAuthProvider( |
| 17 SigninManagerBase* signin_manager, |
| 18 ProfileOAuth2TokenService* token_service, |
| 19 LoginUIService* login_ui_service) |
| 20 : signin_manager_(signin_manager), |
| 21 token_service_(token_service), |
| 22 login_ui_service_(login_ui_service) { |
| 23 signin_manager_->AddObserver(this); |
| 24 } |
| 25 |
| 26 ProfileInvalidationAuthProvider:: |
| 27 ~ProfileInvalidationAuthProvider() { |
| 28 signin_manager_->RemoveObserver(this); |
| 29 } |
| 30 |
| 31 std::string ProfileInvalidationAuthProvider::GetAccountId() { |
| 32 return signin_manager_->GetAuthenticatedAccountId(); |
| 33 } |
| 34 |
| 35 OAuth2TokenService* ProfileInvalidationAuthProvider::GetTokenService() { |
| 36 return token_service_; |
| 37 } |
| 38 |
| 39 bool ProfileInvalidationAuthProvider::ShowLoginUI() { |
| 40 login_ui_service_->ShowLoginPopup(); |
| 41 return true; |
| 42 } |
| 43 |
| 44 void ProfileInvalidationAuthProvider::GoogleSignedOut( |
| 45 const std::string& username) { |
| 46 FireInvalidationAuthLogout(); |
| 47 } |
| 48 |
| 49 } // namespace invalidation |
OLD | NEW |